Type
CONTRACT
Validation date
2023-12-01 17:33:14 UTC
Fee
0 UCO

Code (938 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x60c4cee67fc5d56cbb25607becb3636eb8322b79", 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: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 0.06541159, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.9682e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AFDF0CEB9CF083D36C0243234D36EC1859C7D5A95ED1ABF8CDBECC7A4199AC4A84533F211202D2F67504AF8EC370FB857603217D67D0F27C81BBE25C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010014894351E79377D142B1F9933CFC7A9484C064E52FCA59AB5FD5A6FBBFFAA5

Previous signature

3159BB307297F3785110371D23681E864BA07A018AC03DB0DD62DF9B63FA382C3BBFE8DE377452443F6B12028588CFF69BEEE4B05DCFBCF904EED05185147907

Origin signature

30460221008878F07A27FDF4C428BC619A6E5A3A8A9FD08834D2FFE6B8E94BCA41CB05EF0602210096B31905EE076C56E00196D81BD664891F683DA37FD6B9269B0644CFA6A3E736

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00FB0E6439971278CA60ADA9F21213C8B55ABC0569713D7D9B247B9AD2B637B257

Coordinator signature

4E36D69850754547D7191C8CDE3358C6F738982E25FF09D8EF5C039C8CE626B3100ABD257421F9F4B22B9F2EE711777856B6697A48680A58F719392541783A0E

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

DEE8BF14D1736155CAC672F2AB746799D279409B22B3A239208865FE1511CFC69878DD246E578C416DEFE9E2948100171A7CFC9DA16E5E264EA1E8C7DC93F00E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

5098E7929AC11ED806279AEE817314E639A06C59D4AC6AF7FFFC31801CD03E9B5A707EA91CC673055F1E7641A8F186DFE2F6CFB25554731D94BFFDB28D1DB60C