Type
CONTRACT
Validation date
2023-11-21 07:21:25 UTC
Fee
0 UCO

Code (935 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700558460 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 >= 1700558460
]

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)) == 0xFD9FB2C0E1B2548213657C7C21B8A836ACAF5460011216CDFE85208C77A83F85,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xf53e6850ae0ab0fbed822533645460a06cbf93f4", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, 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

    65FA22FF6D9D4C2540DA585705573CC3F1E331847314550F3594DE2DFFD6564B813F13819B46AA3C27724C87B1C19A51EA11DF8EB79F89A132B3B51D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B8BF4BC3C159591B50405716C61B35D35E59366CE55A791BCCF87DE68C7EFCEB

Previous signature

F644F5149B372A4E988DD737404F583719BD2A582A2732642B3B5F84CF94297AB21A04B776B04FD7E0850CB7F92969785CD91FF3858D3C89218BA95DF4E25A00

Origin signature

30450221008ECD57DC699ABB9B63234399ABED7F2CC0115A1ACDC13F1455CB2836AFF8FD1B022016B78BD9B29B25EF803828076AF91C6F8686C33D9FA05EC058098324ED776A3A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006C92EA969268DED3FD29ECC2237A4A5E9473BE29C0FCB56DC9F52B7023FBE659

Coordinator signature

34AEFEBC2114736D0A511631465FC07634D9305312936B400C873782C358A71B8E60335180C43CEABEC8C672A1924690F4D703452A02CA2866D03DF03A1EBD0F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

B9940D68651608423C6CDCC5E51F2C814FD657C429305C66B55CC05857CBFF0A1AD58742A4351BF522DA6C354F8A72AA5F8EFBD170D4CD58469EE7C8BB3F330D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

596C25782007472B6C96ED3B866BB9DD9D98B6BB75B887253A5FDA9E8CDC56AB770E5C791A3F07AA63DEB0736BD833CA9890B9F9342D36247A9896B1DA04D409