Type
CONTRACT
Validation date
2023-11-21 20:02:23 UTC
Fee
0 UCO

Code (951 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    57CBC930407B156804BC2EB9DEABB9D214D5B738BDF50328E0387105A13C5B693B2C5208FB89C3D14CCA2621BA97A0A3C920ADE41F5BC3417BD7CC76

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001AC3FCA027D41AF00F138318AB011F1F27D99229BEA3483C46BD1FE020490EAEF

Previous signature

C058A365AEB5B6A0C683A580B8125EA8B1B9F52CE7EBC579AB651D1C754DA7D43161B62C4325BAB454FDDD67A30D7DD02585C2B2E0E121512B55BBA43197920E

Origin signature

3046022100DE52185E9C903254C5DF4B0BB500CBF08CBA4A3BA8942CE2EC083AB30C5B17950221009AFBAE640BFE6C2EDA992093E03F038950F84CE46AF419E24BA29ACE09DF30FC

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00A10169CE1547E1474AC9517E7D51581FF99B1CA02CE04D777192A62AF3B33FDF

Coordinator signature

252078F3270463A7112AB392677DB3349D2601578386D0648E3545F70BDC5042A15DD6BA624067A26E69CB5AF32D03C50171D25BB2AD904587C46F98B5431000

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

9804B999F7908BE55C849F1513BC5FEE977E55E415EA5AD95986D51C89B17B77CD6F8C352EC8DE0CF9A8510B90C4AF14EBC434B3F9A18C2EE1DBA9CD567C5D0A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

0AD9F09E5C63F8890050E10B591429FC114D3E2CFB7C5D15C59BF5B353015B43841A259DBFBA44925B72D3D5DB1672A6AB02A4408F03B61A3705FABDFEC92600