Type
CONTRACT
Validation date
2023-10-27 13:55:32 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

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

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

    FE96986BEFFCE069876A8C82C5F8A5B6DA4A7B5405130B72B0E74C2E6405220439D0E8703E0A4C08CE07121D8DC37886B3BDF7D5C45D98B3F85A19CB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E9ACFAB52193F57BEF2D10DBDBBBE02064D40735C2B0536EC109A3ECA141958B

Previous signature

41D0C41BBDB12D8765456EE77BC58662F19E0B819EA3A8F81F2E1CB392FADC8942697547BF65399B909DE71B3981678D4CB5A1CF9DF0634F13AA071B5994020C

Origin signature

3046022100CBC9885B3B250C098CB76ABF4ABBB47C1CAD571CF75E8F5DBBAF3C3FA42AAD950221008CE767F0BB2ED88E408A5D1323075CEF4DE9CAD7B6FD4E3622FB0BD5DD3DB123

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00A8C2A0D98AA57A7C5C48C6511D1FAE9B41847BB97EC27625E2423C822D6D09A7

Coordinator signature

15FC71F42DF4793AA527084D07CBF751D30D9DC751D8C56E8AF5F4D63B5DBDB7C49EB8A5567CCF9BB27BD91115E5EFA7E89F9C6676DC7A7F22A9BFE0DFAE8C06

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

1333C075FCB0BD1425432FF01F89DB1A137C78A4CE0DEF4B26FA518A365C4526FFFB83A2158865D42762373685CCB86A1EF67DC610E9BA5BD6863D5376091601

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

B0AE93B19BDC9E0A4E8CC27CB35DCF6672CB5408A811F0B461B9C137F41E18706BF477240B240BDA9385D6C85ECF8BA85DCE89FB7A0CFE6D5B6A6716A0DE9F04