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

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    37E075B2710E6326EA09A7FD2EC7CFF16DEAAA4F3BBF76FD63EFB731483ABFF778791251AA60D08C7C235FA9F4A95F6E07121443E0E820FDE6EC38D0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016E82ABB77F44209DCAAE2F62C1E678795BC69C30CFE159600DC0885FE5793E97

Previous signature

BAD2FE2FE490BD89EE212F7DBAB2A0B62E585A227873441C028E1D00E7D663BC1F7DC518ABBFA58707B54EE78BC394780E5E28EFADD66243F34EE3344CB8D70E

Origin signature

304502201019C85D3BE80AD46452E3AC931C85D82BDBC796E44592149222AEAEAFFFA8A5022100D3538F85B3E64A4C9E6420B68BFFED7E9D42D1C2C6BFC8D1E98EDAFEFC36FDBA

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

0079DBB7E59EEC54EEB82044D0D1C4022EC76783B36AAACF4E1B780292F495F46B

Coordinator signature

AE912B777B4DF118C5C01CC9A5BED2C6360D35EF479CA3489E6825684917A84AE90E5F27455A9129C379BCF00B0EEC2FF7DD9F74321F3E40967CDC55FE6B740E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

EBABF694BCABAD58BB3A99C07042692248C0731F746A9953726AA91707106B514E265EDBF700C4985EB17CAB9DEAB61B746527B33C19472F884187B6EEF48D0F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

D33AD199416F962295AA2B209A0AF6AE6C0E490C0B39643D2698820070BFE5B7E125046E1105A0759F74F638FEE2D6FBC044714CCE938454C3B60E2E2FB72D0F