Type
CONTRACT
Validation date
2023-11-21 20:40:49 UTC
Fee
0 UCO

Code (952 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x155faf12b142e2dd052ac33a5717469ac5f39de9", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.02976045, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.955e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7ECC853907506AE89F20B08A34F8FC996783A363D999A88295C0241D4685AAD107A1DCB0BC7F58641D8F26AC978EE030D4C44840D0006496EDB61470

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016D6BE6E443265B5C4ECD4D1D2113371C8A16D4D9D73F7C750D3CB7FDF8AD3466

Previous signature

18F9E5A625ABDA3234900CBBB2FB24C698EDF32E3CC242293533F01D2E4D96845DB7FD38C928A3A729460A932CE9913083B63F90F17844686101677FFD6F570D

Origin signature

3045022100A6168ECDD9A0E776A0137ADD357990BCA65929969DA637391DB0F12C94A26F8102205C73286BFDF3D7DB6FBE42E109B8CA149FE69DDF85E4AD11EF933939ACCFF06D

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

000804352E0F4062B10925763931AC6F2DAB949B0C93370A3F675C36A3BB3D3FC2

Coordinator signature

C88CC6C07BACFEC4E0E4705881A3AE92B19F58140954F53ABD5F14FDE01BFC31EE874060142A63A6C75EFA0CEF62705A8E25C6DDFABC7B6F8AF8DC28DA97AA0A

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

98EA2DDFA979FD29C8946DE1879B3BC82FFF9A0CDBF6195743AD139098F63B3D5D67D3C876F430EFE135E7E2507626A42D8E7823EA21372B2BD5340936045D0F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

336830CC2F81E19B5484BE0110A2D895DB7E129A6860CBC748041FE6C9A2B3F4852D9C8841708F8D1980FC8318AD73ABA53019E4997630798561E9907766AE09