Type
CONTRACT
Validation date
2023-11-15 08:41:51 UTC
Fee
0 UCO

Code (952 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700044860 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1700044860
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0xA6730DB130FA3373DE72A0C01CF2E38349461D5550E9F8024E449B266EED6E11,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x7d65453553757029ba06dfa31c912b62519e84e7", data: "0x#{abi_data}"]
    request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]

    headers = ["Content-Type": "application/json"]
    body = Json.to_string(request)

    res = Http.request("https://polygon-mumbai.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "POST", headers, body)
    if res.status == 200 && Json.is_valid?(res.body) do
      response = Json.parse(res.body)
      result = Map.get(response, "result")
      
      if result != nil do
        decoded_abi = Evm.abi_decode("(uint)", result)
        # Withdrawn status is 1
        valid? = List.at(decoded_abi, 0) == 1
      end
    end

    valid?
  )
]

actions triggered_by: transaction, on: reveal_secret(secret) do
  Contract.set_type "transfer"
  Contract.add_token_transfer to: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 0.0992015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0AC03E08CBB9E91B2F676BE4A3E7F00913514B86FB6C80D29C58DD966C5AA90B1B01AE0BF0A1D71CFA0D0FCC56468CC0691C1AAA9741DAD31864FD15

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010AF233DC9D9CC6D2E45036BB5D1269F8DF741236C27EC83C4E85DFDCB953F08D

Previous signature

9CCAB050699420716DD75E627B1854259A1B76721EB60D3CDCB517EE7F715AB51AEE319B6E54FC1C055B7836C9F0397EB833F2DFECB682A9EC0C8AE2B5C9CE01

Origin signature

3045022100EA56D14197C24A0D7A385FEDF77F734F2C764A54D034D5959B1DBF3347E5B8DF02203A54CAD5D703BCB52AFCCBBC77E787836FDA39664FB737B40F2A7261E925C3B2

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00536BB3861EA23263BAE28F686D54676532129310E0C448DB935924429823618E

Coordinator signature

1BE39A4D81AACEB1CAEEE07A045D6CBA246AB0CA380BD003AC2A2317F89A903EC10098541402B2DF82CBCD54B0FB88E4F2EB25F6EC9D048FBDD69AE035886E0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

CDEEE61175D4AF93FCE74705A0687814409F11276A89D04D7227BA36619F07F879DD4F22DA2EA68BA9ABB4F6E7F74235A06AF0B8C77561C21507BB414421AF02

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

7473F0743A79DA387544592425ADD9A09E14871F1FC39D6AF9FE24AD82962002F990ECE57991F5E429ED264782F74D9618F54535BC925A58851C1E5C304F2D05