Type
CONTRACT
Validation date
2024-01-25 16:29:36 UTC
Fee
0 UCO

Code (955 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf9b936b22dd420d412779dda600f01cdc2d3010d", 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: 0x0000562D8F6FBFDA64DF561549EF53BBF667F87F43793CDB6F0A22C311316138925B, amount: 0.12896195, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.8805e-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

    644152175535C4AA40BC5AA8C69C22C2C6A417AEDCCD787E491442FF9D75D45CC16593EF793D1166E4C155AE412469AE921DE4B5C84A2E21E408E726

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F16B0C34B65F3D372513C967FCED359468AFC79568E47643290D6FA497FE8226

Previous signature

7A3BDCBC9159B92275AB52007C82351420A0D1096E054CD28993E094471A04D1AC4B6E8B6C23992ED7B72AE4F64B838351A4E6ACC669316A3745C6170F357405

Origin signature

304402202D1C528F8AD68B1D400033FC33F115095992058B5FCAD9509DD41F1C05AFA3DD022060E46D1E9C981B4176053FA75D8756A2C1CF58CFEE2225E6B1126F2EC7B7DC20

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

00F39F97E4252727AF7DDAD635D457F6D606DAD3BF5D3F823F40D8D38BB7EFE5F5

Coordinator signature

B606E9612E01BABD2202CFB9D67311ACEDA7D1162A78F2C15573C87345E91F788412B96C126554ABCC36D4717194C42951F40447F2E778049F19A86F36660A0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

A00E7172A9E58E3AEDCCDEDB59249BC3ADBB72ECA6C23DC6752B9B33CB89DC8789188774A7A08B6C6C58ECF1BAF67CBCA3C116EECB4D6E995D829E5C6944A301

Validator #2 public key

000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D

Validator #2 signature

E63257B26B84E7E090E4570F96A7D0C7A808E1A582BEFDB1B11609D675B407C45C9A2A7E776083D5973721B2C6FB321D1BB3C04754D6A98A28AE6A2971746B0A