Type
CONTRACT
Validation date
2023-11-13 19:45:36 UTC
Fee
0 UCO

Code (933 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xdb2f4580880bab57c1068bbeffef9261e4378660", 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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 0.0992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-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

    A297E7666C8875E0CE0FEBAE795504921E4448275E8E15C23A9D8155A04BAC68FDB963107BC05DA7716F5CE01A3088C4BD07ADB039055335DBC9B959

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00011B1D4F9DFBF7D444B716377652D8C4433186B34E9EFFC7EF7E4A57EC6041216F

Previous signature

FFEE3E309A6E113C1EBA71D760BC9B1B1E889B5CF1A2E28908FB9F8788D95F5361BB0DBDE0C8759864E536BD8448121F9070D93F3FA84825289C85A53174F805

Origin signature

3044022039BFC7128BBC1933B8281EEB0D2C069F78538F07E11B23B58DF31537B2A6225F02206EBC6E1A71AA4DFDFE4C68C878015A683BDCDE1793A623E2730364C505160A1A

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0038885CB5B8BC6ECFB686FDED7BD134B9DE1515C00C62B0FC461F70A20E7C289A

Coordinator signature

18B462406579A65B7B8906478AB19DB75F1A9DAA38B993C562C98D8108433350C75A853098F6C3B4B47510A3054E322DF415B7A04F704ABD4295E78DEE466B0C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A34A2978A31A2823AAD0E6751FFB66B8CDD102F7A4FAFB3403F4F31F706878AD01B1DF04A70161C9EB09470D74DE55D3AA82197ABA00A81521CDC96D27650903

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

11DCB4312ABFBFE43903B2207A30CC0467816C92DBE97E310692A61F2253A8644E244D5ED554C2EF8F952944E50A3030A37D090EC93D1050B1D20B68683E2003