Type
CONTRACT
Validation date
2023-11-21 09:58:40 UTC
Fee
0 UCO

Code (952 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700567880 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 >= 1700567880
]

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)) == 0x5CBA66C2CAD781A2C035345946DBCF1A5991C03A2800DD1441911FC6EEEE8F8C,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb1ac993d89e1b1e8fe582cdfedf5fe52e987d588", 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: 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

    ADE89C081F1302F87ABAC35E2FCD7A692822FD2DD1841DF498925B12AE33B53162F50D0F8DA36B4D74667A8DF541C75E1CACD51994EC841B5CB5B705

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001265B1614AED693801AB00ED10175BD5156FDF00FB3A3AD5EBBE4EF2A4B680EE7

Previous signature

DF42E5D4FCED4CAB5EA2BECB8D5A8F5AE84F97B48287212D56F4A22C13B4DF71F944B35212B81FD0409DEA29D3B0F0558D103E382043F80A24550A6DD5B77008

Origin signature

30450220711C7F738F56CF25E32EC0FA9F851EF210CACD54E44904DEDA553AABAF1532EC0221008F6693AC116062103692BFF2E01CC1884A8010FB8B5B0C46A5F224DA6FE0D45F

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

001FAC8A9EEBF05A8A7F31F9E96E80A93735B5A87645A335B009EB2DD191E03C4A

Coordinator signature

EEC68FE61607D9E653D74110B11DA445367D9CA4674BB7A7776DC33D5C73D5B8A8F856AD6A83E25DE806222CD7D22CEB205F58B692F97BFB53CA7A90E5664C0B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5D8F192CB05AE09F8FA6F8B624E677A2786756E3EBC63B69D4F0F0CD49FB0AA199C8334B9EA01A1403CEDD5DEFE34A74544ABECCC930CA9B5967EBE563A7650E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

38371577A5BB86C851C3F7164D112986B10FA25C6B0FBE34907D08DBE0B5E3873FBBD1437A8D5CD178CB11514F702AEEE7579260C7D171F4FBC3A5453674F902