Type
CONTRACT
Validation date
2023-10-25 15:14:43 UTC
Fee
0 UCO

Code (944 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698254040 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 9.95e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

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: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x8e34610d69c416c18aff12e738b94ae01af4d752", 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://sepolia.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: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A32BB813964982CCF9281ABABCBDC4F9352EB7654071517CD1618A958C2C8AF2D3153CCCA340F396D12B3CE4E0E20E8F408DB8B832AB1E4EB43F569C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001ADA43A7348443C8FF63EC30846023E504962C75B1044DBC8710EDFD6E0F8890A

Previous signature

624D1BCB570EF8CC8233D126702381B468B55ADD5225ED10F75A1A0805108775F44530E985039CEB5E03490DAD0C73E6896317ACA4A8488CD05F4E7994475800

Origin signature

3046022100CAA57F82239D6F7A09EBA756CE139810E205A30ECC8AD2C50BB85AAB0C04BA86022100C7F45288DAB6372AF45DF9EE07AB3349E76F8F1E5E35802D6228DE4EF01AA67E

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00160B21C4E8CC5F2E06CF3E9176E4DF1D2B5984A8D9C03759CB15E5761310A33C

Coordinator signature

EC025B52AC00ED26EB84712BA6D838F82190CD457A34BD7C4B4F171187605711058ED60A8CFD21211DA283DBC05B73D1E6DED331896C6DC3EBF83F0F61F00C04

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

EEA9D8D0811A5DFC982BD0A4A7B110B27AB30C1E231A21A858EE2945CBFA11023AF464B19B353F6969677DC4EB5A80A6A6257CEB6FB993DC4C83634A1446F40D

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

5B1A010F7785B277923EBCB453C842D28BA57B620B81556B8761CA9C9E680C77E111E1DBC08F8233B41E2872F474814FDB4D9845392715769F3F651847549301