Type
CONTRACT
Validation date
2023-12-06 10:40:54 UTC
Fee
0 UCO

Code (937 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb1c508852e645aee43c6f2371c8976c2fa8384d7", 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: 0x000066DD68582F5BFAB67EB0DF35126EAA13F0A1209B92E94ABE85F57F0284D083F5, amount: 0.01488023, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.477e-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

    0110CB9F72F8E28BBE30219F452968068FE3616085F0999AD1D5B74DBCBD53E4FD3CFC4EEA1A2DA4E640BF5755DD8640411AB94C4C51399C0ACD683B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F6012134C8C4B624C029475631FB5E683FABE0DDF2646BF80F9FCF1889BFD89E

Previous signature

E1AABFA6466287152775ED77E5AF2A5A200F135F7800E6F68219D788CC525A008CE7EC325E8B38D1F9F8742D1DB2FDF6D50630A69D3F083E9C2372CCF483C904

Origin signature

3045022075263203623B2BA52BEF5497977A38AEB9480ABD856910893D776DE1295E1DD0022100AB60EBE72F9686A68F84B67D5C861E5E052DF6E6F19858BC17D446C16637D006

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

008F49A9866711D5921BD8F3E060404A55A7A2655146B7FE522171525196414E15

Coordinator signature

E922C7ABC5F8F17CD21772478B80A2B281124FEC15A14716843BF6C37C4F5DEA2847E78BB1B8787569CB4ED61BC3E3F6FD2BDB75647F8FF90CC027624AF2960B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6EBFBBC5E4FDA21F3C5C9493FBA1E2B02CEA57EFB6471C55E0C5D66F6DA7078F3E9CAB01649E984FC17513AA3244491466B0225CB44EBFBA0394E1A5C939F90E

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

0C8AD9DCBA6E53043E9A2D5C246C2D4AB1AA1C4D91BB6C88ACC1A096B14011B7C2F82CFB79D4D49D2EF742FC64BB6CE340794F020E35AA41D15FF4861188B40D