Type
CONTRACT
Validation date
2023-10-30 08:16:08 UTC
Fee
0 UCO

Code (912 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x77885c302a20b6fdf5b2271f3a5d5cc27b32c68f", 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.0e-8, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
# Transfer fee is less than the minimum decimals

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    10EE6EC7AD7D8ADC41CB4505CD704C637EBA0076D4E608D6DCAA307705719BE1F57DFD0A3324E29A19220F2F88350D84C2822B74F0BE2EA6D310094A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00014202E743CC217B736D1E4AF50CC6BED8B0793668D8AE06BA6E103CB94F7BBB37

Previous signature

7BFDC6368DF8A640373E6DE76726C314578E28DADF18C2C841F3A46A945109E09B4EB7305860D85C956383E39600BD68FBA8FAE2CA16A5024C5D211042F3060A

Origin signature

3045022065171B3CA4FF180FE3A8DCB1AD4B3D22B8CAED39C602E5C5FE3271D9B7BC7FB6022100E08D9E9B4EE41E24E2C75155B12B0077A152609114F584F5D916388DB682B5AF

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0016E54BBC07F39C264F0C25244971E2415D995799BC15A763EA224E5DFFBF6AC2

Coordinator signature

F78D634A7B9C2586FB753F78A471532E35E19295CC10E16A497F7631C17C341F4773971F8CA9F0DC6F85D46FF56AFB543509E31FD8C867DE74D96C6B2141F60E

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

E21A431AF0B97F8AAC3AD3D86B96086E636390421CBC10D53C9F3BEC3429505E4A916B111FB382841A7CEF886D5BFF316D6D61DEAEF237EFC88512176E5E7B06

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

A6CAF201267A0F15A171A89ACBA27CC8C81CE68FCB96C095C5FCC5DC1FDE9ADC35E65FA4C15AD94C399A5A8A5E2C4A10AE3BC3C100EB6501EF9F2C14D9361A04