Type
CONTRACT
Validation date
2023-12-06 10:23:34 UTC
Fee
0 UCO

Code (929 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf272df9993ac99e9a912d17e142b14be3754dfd9", 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: 0x0000E7914C512942650C9EF997F565849A1EA71B4CAE73D5555531173C33032B4C7C, amount: 0.02976045, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.955e-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

    4F2DE7E2B4AB69C690DD88B8E49C2766397A6E0D9F0DB074A353749491B886C397E498153B2A36506CE6410E8AF408AC60375CF3F9E1B1D97BC03584

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00014A0BEE7FDD2A0AF8FCE9BFA8EBF0E51BAC5A411A1510CC2DA74065F3617C85DD

Previous signature

991F42CB8E1603C9E48AB6AFE4B1BD5DB8CB53F356C62DA246F47B3B85B0E0A3DB5D7932BE6247EE08594469381486752D461D1F7F2B6437B4C9FAB299FBC300

Origin signature

304402203EC473119AB85C269D3EE45B1E254A82FA57B1FF60668CF4F68EDB1E2DBCE7B302207099E4205894507757D24691E5F53F5AF2B47D5D5A6A326F1871409D8894E7A2

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

005B2C9D7AECA406EE12C981CDF77745E5387960B48B881965F3A2FD451D0490AE

Coordinator signature

5DFD7ACC6C514D3D3CC048C87228F3A91169A95C0244B79EBBB4615F5FD176848816E47D6F532BF155BD3B38382508759DF238E1036B476083273E15C4FC3E09

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3CCC7532597E90337710EEBCAA5C5AAFED70DE88CFC29EBC1AE80D47DA94559D7C3DC6AEE52BAA6383E500C671A00E4FC563621BF56EC7AF0859EB4409ECDE03

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

70CDC05326C49B284BCD9ED946B9425937C768663A0FF070DA283E2D209941ACC094CB9E41D3A3605DA9A60377D388B8ABD71009DEB4E5DDBD3BE43F0494750A