Type
CONTRACT
Validation date
2023-10-27 10:49:20 UTC
Fee
0 UCO

Code (936 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1698410880 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 >= 1698410880
]

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)) == 0x857FCEFB2943ABBAC9887A6C2B1FA37FA6C3AE630894B78E06FABF13F0291C60,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x31a23ce4c54fc07c7142574af6c276e2eb259d6e", 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

    6056C47575B906CBE0ED7F941F557F4A0EB7468FC7476E0BF835B263FDB8A83DD4CFF422F00F0FE0742E87DADDC4FE19DD6A927FF786521E2381A986

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000150DFCB5509B287244946458660BED37688F79784D6E00CD09962176D848F4CCF

Previous signature

1DDAD58D9BD5457D5AA8A3F9055F257DFD7C442E819573D92FAAEA5859C5E3F854C33A8493D55162C7794DC797D37B891DFE2CFF6E12A4731D73FD69B373700E

Origin signature

304602210083E6A1164596B585B3B2652474001210FB44424E2D2AB1742E07CC99E25381CE022100E68A2FD509CEDA24A2777706A6A8C8A654156E4D201284DD0061B6B303C08689

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

004B6A9E6B730908D6ADE9A8E185EB6A636025B56C5D45F7DC719838D4CBA14088

Coordinator signature

D7A697543E31D07CF8C756B5603101EF0C1B33E13555620242309860F5579D1D2671E3F3DB37835A3C9B2AA350BAAC3E2AC476A3B8F2B6FE3FC9498B6E9DDA0F

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

BABFC0511CE6818CD06A662C7D85F44331A27FF25050F4EB615B0C99E62050A06071627974251776CE144B2F8675F1707AAFF7AF4DC58F2E243193270FF7F500

Validator #2 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #2 signature

4D810A1EF1FA6B076411826ADCC8A9CA96102D5E8D24B9A051D62FE114274CDA1626818849BC8085028E87E9853B50A00BE5F3CED543C25E0A3B0FAFCAC9200C