Type
CONTRACT
Validation date
2023-12-02 19:55:34 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x09405e63ee8ab4767d2a84bbb5368dab8878f5e4", 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: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.01686426, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.074e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    145374BCD74FA6AA8E728BD33D1D275F1B47A02DF995C84AED7EB5E18F714DF18F3B845E22F626322E7F5562A1FB973FF6C16D6480D7CEE04EC534D1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00011EA3F0BFAB5878EF5AA1A5FE1F286D72C9F1D5F1B0AAF09D923D5666D1A01FD1

Previous signature

A86C996031BE982F4E5FB15E7CCF13EA07DC402BADF93DDB356B21E78328A8BFD8820E1CA6A3E87C06157894B1122752F50CF17E8A24B41F684EDCB044A58605

Origin signature

304502207F22C55EBA42B7FD2CEF7FA87D2A7C48510EC35AF8F1C73BDBB88DFB6BE783E7022100C1ECA850F4624B0456D380357F25C63EF0FF06455C867D1D9D9C660A3CD85338

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0001CBC968AA2DCADBCB1ECE3644F382E90D7A61CFA84AF131A32667CD36862CA1

Coordinator signature

05268B930CF2F512B45C61BFA7F4AEECFFD9EE8753EF001F92A9A872F48415ECD7CEA512A063D5399D5427562CEDAA01E1416B61101EDCA12CADF22931DA940D

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

15AE465C0272AC2CB230AE00F92616B181639FAF8782F47196EF56C8B6D4400C0D96A7B0402745C00E3D979DEFF8C91508F3331C2121288BE29F3A73EFED6F07

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A0A2C4E7B0F22F42F63D6897B8DE02FD7E07120677856D7937984A9F87E1A560888A9275D84D14D0438DFA01BA2982383608EBACF6178A393766174E5B9A3300