Type
CONTRACT
Validation date
2023-11-21 14:08:50 UTC
Fee
0 UCO

Code (953 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    00585BAA8B7778EEFF513CA0BE789D810C2747B852649A4B52E806FFEFF6E56A498F5C8C04FAC14DD589764753C6D6C530863FAA07C5BBA8EA7DFFD2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001796D8BD8643DEF2DD1689B96ED05837D588A6E930B5630CCC815B6976D6EA877

Previous signature

B29FD873C0D22C102C2A9894D5DB7020454272B0521BB3D6A18B09086B2E2E61B3854C4D6359DEBD772A65D4B6ECCCD84CB31C6C83D6B6CB733CE6ECCF3DD609

Origin signature

304502205A6410BCCB8F32139C071062303CE5FED862B191ECA6BE14617D127B56260987022100BF4C1CD59A76C583807490422EBE346667F59D1514067CB2E042854C0DDBCFDF

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0020D62414F6E5E024A49471D52019714370C979AE0645CA12770438D686555AED

Coordinator signature

644F2AA062D265ED497200B1332EF29FFBDD90875DB348E4AB92DC21572BFE4BEFFD958A11C96BD773EE0B837F49AB9E1FB736D74A073B81BD2E8C5A47818F0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

64EDC6A8ACDE43F44BD0636E9FADBCC3C2118758A37AEADD40641AC0E30F25F32BD6FDC48F471C5C7C59CF2C9FD4DE617621AEB1D945AA2E438B3C5834874600

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

1C97DE27796258B37539626585842744AAA25D2B1E9511BD174C17B9505710C215E1EE8D889C874337763E3C662BE1E5DE4AE537911A0F9DEAF2FE6EA0C5D90A