Type
CONTRACT
Validation date
2023-11-21 20:18:12 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    7D701594C2C8068FAF80B695A3C3EF842577510C273A303C8FC706EE2CF13A2AF5E96EF533F4626FB5EEAB848BB92F377CB0BD26BC98727F2875A910

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F0F5D14E5B4A04BFE88BCA885A4EBBD164510A013120D9C7C5D7218DEA23A17B

Previous signature

4C67A8E03810BBD98AD6A434355388FFC458B881548A62DA1B1629442B6A711D926ADAABE57D911437BEFB2588AF440880E604F0482E27EC22165C7A18248B04

Origin signature

3046022100A640D65E55659526FB97EDFB7B694C3014774E1413C311AA459506B083B7302D022100B3DEC09FD91B0B6CE186AD4F550F69BD618DE10B965E276D8D432CD5C18E0894

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

005A476DE65D76BDB743D050573DE2BC40BFDFD37F1A99B8417C5274B68BDEAD72

Coordinator signature

96E551B8D904DAE486AE4A8DA3B6CEB324AB691EE29EC0E0FCF17F446121EB5006485355A6E2AEEBDEB81D8FBDEE1D93B24DBCEB4A9A3BD0FAF89CF673DFAD06

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A11E3499772A83C1A7C3DEA2A9E3C54492FAB76F0EE3523FE6C680A6E530F8C35A6E7476343CDD0975D79511981AC9A584BA746BB527671B4480B12831046602

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

5C41D7F7AF0CBCCA20781E59108C8359B5BA20B2D00DF90AAC9F72FFA0D6EEEC4A21DC2E1731568F33E8A20C39BA8C14F20078C61CC316F88DD9FF28DFFF4905