Type
CONTRACT
Validation date
2023-12-01 17:43:03 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E47ACD7052E077FA333DB4733D973D48A8DF15EBAE52B26BC435F88098D692B64F44936DFE65663507DE6DB829B2EBC26E4E6B635257ED28E1796A46

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001955E91C98F7D7F1CAD84DE9C0E5D8C886D20E5D037EB60F5305CE01C9FAF9B7F

Previous signature

A2FC57054C9D703D2883F62AA193D2453272F7CEDFB74E59187DEF497A02D4580AA9E41BF598CD2734CD23B38FE7A7BCF36399BF7D15222912F93E2D25ADBB0C

Origin signature

30440220753A523171E5BF2EB32E22D5C9879D2BF840C7E41B8C6F924EC1C2F4972E6D1E022033E5205193D0024EB222B4552A16EF592DF3EDD30DC42ABB614EA68BB7C829C6

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00D74839F686E0453E6752AEE44519180F1C6D93E085C0C3C4D1321FC9B9879F98

Coordinator signature

6466CC13C061E59EDB9E26B1DF2E25F1873149EFA06A1DF84B71DCFBFF80434FCB28F588C13A7EA63B40AF72E21269666A5CCB53ABC7B95A6FF2CD4AC3E20A0F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

726408946699BF8D61831248F30204216AA9BF9FD5A9E953104EED51C7F7003B024146E2A14C5AC6D13C0ED2E5FE3058B14A4A2CB03FA1333AB32323EEA45703

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

4CA7DF9EE2805CD765B4DD31CAE443E8B5D07A00865598570E858A16A68918FD05E9BDEF0B54CA307F638E602B92798F5A9523CEA84106A4746AAEC239D87009