Type
CONTRACT
Validation date
2023-11-08 13:35:46 UTC
Fee
0 UCO

Code (937 B)

  @version 1

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

  Contract.set_code ""
end

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

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: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x3e3e234a1a37cece286a95b6cabd2af4a7631b0b", 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://data-seed-prebsc-1-s2.bnbchain.org:8545", "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: 9.9202e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    122B0BB3DC43FD9E7E3FE914F6966E27AD23EC823C9878BB6310200079FDEE0B4B670A6508C0D8BA0914FE4213465670F3606BD3C94453818F056F5C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B17DD52197A7CACE1B99804E2BED6C471DE5F57F95C72A6064B46066ED83DD21

Previous signature

CCC80E216A18695D23F26BC32574ED4F53BE4AB0884F6512F3C513F8ABD5661CD5D9C5079FECDD3AA61EEDE48B740AC838272A35C384E665FC5677D4A8BFFA0A

Origin signature

3046022100A2566A726EC9A771AC17E707BA0532C87001B463769345F304DED6E79D95F8770221009C33B260B5899AE5E76E4497D289ED92AB29CD178125B353466DB76EF56D843D

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00EE0E59B70C210B51AC73D02CE1B6DFE6E4E00FA9D6313DD708E9ED5D549C6264

Coordinator signature

2B6DC1FA60D99714BFE65ED3ACA0363A1F0109E800B3C26C60FADE8F517F1C4164FEF6D8B7E4A852633CC3F526EB49D53B3E93A5F3212A4BEE78E69CCCDBDB06

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

4818287539182AE9AC0043883010E89EB4FF04EB69C2DC808F7A1BFFC1304E1B477FFE7503D53C76864E50AF2E4F7CEE39ECEC436167825B91A92443CC6C7607

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C4FFEF3FA77B3F7DE26A53878070BA96342BA732CEEDFA3616F6907BA2F03797076E2DE8806924B1983DA7A4591EF83A7472315EBC9116D9E25E8AF72A216000