Type
CONTRACT
Validation date
2023-11-15 20:58:19 UTC
Fee
0 UCO

Code (953 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x8f170eefc3c4af4f7fff2120c05502712ff5d1dc", 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: 0x00002058D607CBF792C23CC2389F4785D54ECBC695EFABF8856BBA051252962DBDE1, amount: 0.04960075, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.4925e-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

    F209863C8BF760F1F5F800DEF657170A56CE26D5D3CDCBCEF04B4D34F6558763E7A6855AD698C29CD6F48D8FCFF15A4A94D7E3D9D4973F2BDA3BE85F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017DECD5C5352A7144A32BBCF475E6B8013DDE419608553EBB4A78642EF0AB5F80

Previous signature

DC826DC1C4C44EB606A59B97E502A9A38F65D7A8A34F23C647FD39872A0BD1C0D679C45886767B0316958D39BC89D038AAB62854332372189AA13786220C920B

Origin signature

304602210094086E54BA0E161A289E581B7965C39BF2B8A62844D01AAEC30E7E39960064D4022100DCFDA1221AF485B232257F7D461DC8330207CEB47880A88DD24A9CF4C90AC078

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

009BA0FDA81B15CF9DD4717EF0A1C6706589337801DD3800CADA8CC48906ECF0FD

Coordinator signature

A137497DE5342F140BB9A99758098C048230576A4ECB1407DD20E8FA8186E7CD820B978DC6B2793BB4769243DE8F302C551BAF50FEED43C1DD41BE25E32DBE0C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

B9E3995DFB4649F3E1AB512D1DC152F2A243D7C1362AE4BE0C59D988823D91CCC8B141377E737AB27CE96B06EE58D15A0790E39BCAEAA3E2434B167A72608A01

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1E5F76199A74B92EF620C08EC4202D9D5E049B83A73DF70B45797F901BB4D2C68AF1580D63F926CF23B5DEA70852D8AB0A06052C782E5007875405EFA3E5F205