Type
CONTRACT
Validation date
2023-10-25 14:17:09 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 1.99e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x708bfecdcad06a16e38324fa91049fe231e8052c", 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: 1.9841e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.9e-7, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    90044FA4461E1CF2378D7131F5654201AB69C5B85D0B9D70FB1E13523F4FB2B1A011F645A0443F2E98137129BF5C7A668177B1EA0BEB7C2875D11865

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010A4527A9AEFBF2DE1A516230FA4249113B16CA439E0271B82A42120ECB2FE0D1

Previous signature

97A07EA051C1B83E8986ABB92519137A43AE9BDE4B9992510343E464E149044CA0838A10678FA90461DA381AAFF6F3FA0652BFE2EB18F23073C2D49C94805404

Origin signature

3046022100D8C9653B1632FC737F18153449E2EDBDE1C7E489E947ADE8CC83FBE83530E4B5022100D11F453855116FCB87D59CC0B30462EFFE7A719120F8ACF70A8E55508DBB804F

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

002DDB15A53338AC4ECCBFD9DA8BC50B54EC17FB50374922B263DC002589113C96

Coordinator signature

377E67A49DF50AD8726297399B9BBC6DCAD6E06358F0CF8E8B2DF6625E13F6CE09B816B1B453F751E5E8EFEF9D99859672DC8E2EFB6E15E7893A6321B849650F

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

E239A929DAA6E9BAF72940F977BFEF870C532190B8366452301B48F38A122E15BBE6B6F6719C4017FF9F9D66DA7DDF34F2D9EE3DD2F6072B6C16F8510A05280D

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

E90420D02A79A5E1A0AB900B0B0EF58089786CA52068C54D23950811CD471988F51F19F2C2F49143F8E8944B457C0B0B86F5E700DF35C76A528BB3FCE6257508