Type
CONTRACT
Validation date
2023-12-09 15:44:59 UTC
Fee
0 UCO

Code (942 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x3eb2ab3ed5f66041832cd64917f3b5da0e6adee9", 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: 0x000066062AE51C8EDDB115B895B4917CF9A25F20A0CDAEEDCFC62085AB197F6B48FC, amount: 0.4960075, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0014925, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    30685F2AAF0C3607648DB051265E687EC16CF74BE82770E39CA259C5FF6E6DD5326799D997260B7A82C164F9C1E11B8DB2287F184737DCBBE005D93F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016C65DC94EA4F2215BBDE08EA40135E7B96AC908D8979989A22ED3E107F4F165C

Previous signature

5332BD8B611D49EB7A894D76BC5E12AE987A4D86D5A90CDB34FC0600E63F281C0B10056289F50C083E2A1A2367C7F6D29E8C24B7A24D351B296C612603FD740E

Origin signature

3045022100B6292DB5B2B2F9EFF175658083D3EF3B7C8CDDD098DBF91AE2193C1D581C3CD002204529778C4C2E673C9E8A625F1C0A1F680318D1DDFDA901E7E86BAF37BC4B4E81

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

009D239DAFC10DF8C3C6752998CC062A60ED7783F46A2CFAFF3485786DF9572A4B

Coordinator signature

1593FDA8AFD32C95EABB304F220DE27C0C226FC52BDDE32A5C71E3CAC6ACC464648C990E18D7B9FCD42B2A281C5ED1AEE447FFD6EF480D17A43FA18983E08500

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

A23D3C3000379E0E9FA7ADE4D954202601AB7B1566FB1D628904E57B270282DC25697ED8A87626DEF9543F302D29AE73F5B275B277B3FA31AA9452429253770D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F542C3B8717EDA24304C8D2A1C7ADBD2B5998FDFDA0B1E19AAC73008A792C5007E9259E3540B0ABABA2A21ABD8505F8A23F1F485E2D9DB207E89E7456DDC220F