Type
CONTRACT
Validation date
2023-10-27 15:01:00 UTC
Fee
0 UCO

Code (953 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x622a57751f1d75954c122a747ec455df36dd6bd8", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 9.9202e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9B1018C90CEF97787AD84DEA99A26C7F02027B1D3FC8A56B8869BA3D3496566ED39D56548F49590ACCA8BBE3D8E897A88C734019D2A4D33D7806ACE8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C332939060664E7B2305C894CB781760C2AC74C47A4E86B4D5F8779309666F1E

Previous signature

46B3104BAFEC97CD5530566D50D5419012892AEB996B2BEA9AA43B03DA5577F865A0DACF6B0A7C2F73E768E5E4583031B694BD332B596B7C2486C8D108ABFB05

Origin signature

304402207D77CCA9F95C68C7BC4595EC09802F7F20B231B8E15351BB1FCB306C33F8B7C9022011B24F83FD27E98765ED6A71E476FC5DE3285CC2609320F40BD6E3DCD63197D6

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00FE856FD8DD516B0744058DC238A2BBB5E0D6144F920916F9B3C25A4DFA9DF120

Coordinator signature

85E01E9D04208798DC9FCEE16EF6A2950790F291C7BCD45DA5BA72A81EC96E5D388B09A1F7A435FF3BFBDB763B163D12A91B9D74DFC85DFB421C69505A2D930A

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

251B3FEC9F8B2F4D9BF0B3A757C08F9EFE26A3159A8AF3A7C31220A052A600302F233157A4F4FD5D5B2B17E4661137C78CBB8838BFDB8E29A4E5BC693C56D709

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

D33B2BED83B9BB66A65F5A6256D9B3CA2865373BB6DBED11DCCA336909BFA7BFBDBAE158F6D5734BDB8B7BE15C40DEAF49A35576D5C1CD59DD81BE75C477A20A