Type
CONTRACT
Validation date
2023-11-14 16:56:37 UTC
Fee
0 UCO

Code (945 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xe22cfe7b64f8cb716261f3eccb64004ff20ad29f", 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: 0x00009E02F4299ED39E03EA44474F1C9756FDB1F802D0063751598AA08F21AD9BFFB7, amount: 0.02519719, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 7.581e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    99D779A7A94A3EFBC438D4112EBFE27B9811F81CDB50A43E5AE5C714367E44EFF70361225B0D371ED5F78B5C4AFFCEAF69A6796D244188C19E8B0215

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016CDE5168E1D2752D0CA9702CFC3DA8EC300C038B41BD92ECA53A70F96317CE9B

Previous signature

3BF74C37ECE602BD7B154CB35A762A4FAA0D31BFFA35C2D834E50009DDACA31BCA985A7EA78F81FD1FDD8B0BDAF7ACA9CF27035629968EE9E89ABA7D675FC90B

Origin signature

30460221008FA7879060937A9953AA286509B7170C1740234A635EBA178639D7F5A6842BD7022100AE6E5DE56F282C7800EB0AF2E5214E1DE74D6137E9AB5886A71A962E33F00212

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00879E1169CD7AAAA3ED4991AC93A219CE782E314FFC13FF5F5F251B921A33A0CE

Coordinator signature

8490537E0BFCB8610F3A88251307CEFB06AEB6F7EDF3B33FFF2E44FE0AC316D1E4BF75C70E067AA539EF3D195ECBB444DA70A48168BC7ADA8B576A7C0D70F001

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

ACF7FF6E3F6496533485DE905452CD3052D863B77CFABA92267F054FC57FB0C0013F4180BCB14E8C064908BC7483F90216050191071CAD06762AB8EDDF7C2508

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

B563903E8BCB27557DE260A7E73B4FF085A2A82C927875B2E1B021D2C16F4936E52C98F1EF734AA85DEBCAF6FB2E6CDD5129815EC9AC4880354030B6739FD807