Type
CONTRACT
Validation date
2023-11-30 14:00:08 UTC
Fee
0 UCO

Code (955 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x2b1f9fba5e0da663990fce69b9c55a73b3fc6178", 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: 0x000033959A276240B3CE0BD4BE4785523CB6E76A02351C2A0E6DC35A748FA83EFB88, amount: 0.04960075, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.4925e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B04909303834987CCEE97505F466ACE3BC795C666CE0BF169914884DF444EC814E227F02344E0F19F7306F0665C9094851CBD0B9B28364E33F7C1BA9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001DFD61C00A61D72EBD664246AA525BD0B9DBE831088A4BF473083C0FE2FA9AFC6

Previous signature

6BB11C4168984ABE8B352B5610CC4E72BD5A47B4D7170F9BEAD093115226B302BE9BF7C993C8ADE3B23A653A67E36BB8026D3CFBE4684BF32D463523BB08BA0C

Origin signature

304502200771E65FDBBA1D2ED4741DE137634290CF250BC1FCE49F85C4AEF6E9AA428AB10221008FEE9399CCD9C2F736CD6C5CB273CA2DFED7F77C91A0A290CEADAA197E2772B8

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00B41F011C307D65081267969F1BDB3ED27F1F8F6BD0F18820BDDC85C35C727650

Coordinator signature

D504B38B3DE8A49D5215B742E621F72BDC3E9E3283968190A03E9F03C3FCBFE9AE0E0E6CF0303193F016D2198ABDB690D8D23F2A17D05AAD10496E9E7E4C8706

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

1BAC102CDF6C2FAF45DE832E4CD701084DD2FBC02021D0407136CDE59EC9D7D771167A17E7F48C2B78240FAB932AC2508D5488298EB8781C8B883DF4AA2C3F0A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C1AA2803C75F30216645C64C8A0BF08D1415F22C1BF7314DFBB577438060698CAAC9F99F1B2D80788BF286F886CBD10F07E42D8B97500F422CE950A7A8207100