Type
CONTRACT
Validation date
2023-11-12 15:32:15 UTC
Fee
0 UCO

Code (950 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    853E6A46A2DA28BB4EB835BB3A5879A208C37FDBB6A6C00CB7354350C6DF8A19C293C43FB0E98ED5C9D06DB99C94EAFF461D4124E251353155FBFF7B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00015340EBEB60B4C148639E9E6D73F626A6EDF4D82CBA8A38BBEA3EB8CA24E77F0E

Previous signature

CA6F60E86C80B9ED3A1CA135432E4D063AFC7C0C719B8146099B581506B93AE75D244C3067881AEDA03F3EB6FB7C6E933399DA5CDE9E3C961EDF8FDBCD577205

Origin signature

304602210093337E628D41F7F444AAC57E4CC0C330FF08904EECAED41AAB99502E0CEF857A0221009CD158B44AF5317063C70E62F3E9860F019415A44F33A4CB063988170CCAB100

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00D79628F4F5E8A87ACD4260C08B6179AFE674AEA4396E417CE1EEE89828B48C16

Coordinator signature

D494E4D0470FE63D8F372D579794BE9FF5B984DF1ACE273CE383CD43D92A8EBCB33167D45E64FDABE0DCFF4CFD5C62502CD6532B05C5951C2103A1ABEA2A8A0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B4DA54088D52763C0DB2FB70AD19EB69E26B8C7F0C248C98EA366D3B0F8B98A2D4F909DF9335ACF6BEC223CA28DE4A8E32ACB81D1F73E0BAD38A707F3CBF7208

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

090211D36092913810D18704F5B2D55DFAB0C8F098918F5CC2BB3DCB516564346ADA811279A83E3E8F0D374412E2F87288057F089400E148AD488714B7BAAD06