Type
CONTRACT
Validation date
2023-12-07 14:05:34 UTC
Fee
0 UCO

Code (935 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xc60b4748bbf056501906b2196c13a06c7f5c5b5f", 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: 0x000068155ADF3C147E5DF9132D7E481DFCF5AE665BCB6021CC9B1F21D7D86C2CCC7F, amount: 0.0595209, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.791e-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

    E6FC9A5A7A9985CA521CE71CD3ED8DBF618F04E6A43E9AEF2AAF02EA35A56D8451C2AE9778F1FE36BA642D2A8F947F85D0E1A80C5D36BD9AF5E1D2B8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A2B609EEFD3EBCC71F3D1E9AD357AECA1C946BD2CBD8FD2433DB5479EF49618C

Previous signature

BC5E6935C5E15017F38E7ECA63D9E73542B63A05E0CD946AA9FD61C7037E3C975F2C7F0554BEC08C5B96C75639D2E4EA86EC94F16247903C049E31A63A7A440D

Origin signature

3045022100E8AC744044F531167182919F391F13C0B6F88C9E10B85A0C2EDB253FA4F8E04D022008BDB03206270533FC966E0B7B5797365988E95F6D2AA49402759581880D3F1F

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

0073F8E6C2CA69362F441F0F02AC9B3681FEB1F9EBB829C072992B98EBFFE8F096

Coordinator signature

0DAD04D79568448C99129CAD0D4205D764641878F3899B029645F994D61EE47C72B8E9DE2EFD53F58984CD8A1280442C224C9079A07B22EA054A09663FF3BE04

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

155852170425A9CC38B6AE89245D14E804B649828E86A6F049F1E3583B896BFCBB897C7ED0874DAABA1DD65165B59ED89745E8E9D7117EA208428EC41404570D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

A82BA77BA5A8193DFB408E62819A5A335F356F8F89D17E44BE94D02009814A60E76765FA58931FC9093947E54A591E4A048A09ECFA55FA683A81DC1EBEF77C07