Type
CONTRACT
Validation date
2024-01-14 07:02:36 UTC
Fee
0 UCO

Code (943 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x44013e365ddc2c588b82e8275df1998d6ad0cedc", 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: 0x00000728082646346C9BF3676ED7E29407BC1D2073286F694CB4E783ED9817552E80, amount: 9.9202e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-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

    2FD30E110DB6CD39F54274ACBC4F14C0D60E30987EC208845BEED52C4FBADC14A2DF839C96029BDF2948E00B4237DB1DC34C7DCDCDDAB6DBB8361FB0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000178C5BEE4680EB707FB43275573D43ADDB2401163512B3D6D8CD7E7AFE2A070FF

Previous signature

101319BCD25FABCCAD93D19442FF9C418660E6DB077E694DA3F6EC78AC8802C3A9A1750072EF8D7153D399787C49B08B022468329F35BCA47C385F0C1B58500E

Origin signature

30450220657DF6EA1A5A04BAABB780D4B4D62DD0BFC466BD6C1A98C0325009EB21387D3A022100D175955217BD7132DA199A9D899DF614E71D3215795FE72DBAB4AB7EE92B0691

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

00047E4320DA01DD360367D0C4EF40F301E67F7E9791414839A0DF992DF8572CEC

Coordinator signature

2450DF76D99D9BD3E31B4B0E00BF5A52AEBB9A0A763EBBA73B4A67E28B957AEEF02938E800E7142819928841FD4025FACB98DE335C352307B8314EA70FCDAA03

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

3022897C679AD29296B8BE0937D3BAB68812866CCDFB6812AE854837F1DD91DC0BED07D6E9B5DAA32ECC89F8CB96395C10394270D93C7D0EDAB65E2A25D37109

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

6957308123920E3675FBD287D67812CC55B68489305EE3E558456DB2ED4C770DE90042D348E9DB8491E817564197497A27DD9FEBB281F77CF5AB5D686065D60C