Type
CONTRACT
Validation date
2023-10-24 14:53:33 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xbc48f7703262622d59a10a207e89fb29b9ce29a2", 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: 0x00009E731DE71C9598A6C853EA89C736B1DAC3652AE00753651B642536AB14821F06, amount: 9.9202e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    10F2A35B5A7FCA23DEBA7195596C53A1391A4AD6EEFA2B95125397A6625F7077F33005D06CD9E517149D5DD901BC17994C2BFEE4BF8D630F4FB3D1C6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000119567E876D5D0E8BAADA88E12D7F1F31004932CFE877B04E13947DE96116926B

Previous signature

3C76FF6FAA856D109182E7048FADA9CF81CB942747EA4FCD8E29AB9F759B0357D891D29982B33784D3E9642DD2C4EC35B8446320321F3765283A15E2CC15BB04

Origin signature

30450220089567B0305E2463E1B4B37A6C0326A71C29A83FD6A3271849EE2CB673C9914C022100EF9AB2E9BD62E79B1164351BDF49893B2339E4F1E1AAD1685AB062770E7D3122

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

001F1CD951ED84A71DCF306CEE1744A97B887DB3E13A0FC5B83BE86EE542364FAB

Coordinator signature

3F5437C4FD98678F43B599135F731E20D217CBA6C680E2EE9F7F9B738773320F883E41DBB2FD36253B4430CD17C14277F3A97DF852F6B7286824215421100C08

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

27F2D00977FC250848D33AE041347BE5E23A4E576A85F23B922AE5E2B4ED2F09A7C4E8C0060AE83D21F1ABA3DA4F3CFBEB147FEBE33A04959C280A2E0F773608

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

12AA8566A291DD0A2A7AC95BDB4315C9B9B61A9C5D4A7CDF7F0FFF5E0E6D544B0D748BD26A35167E89B883191BA2C7381591EC447B1E752E841E6299DB162F08