Type
CONTRACT
Validation date
2023-11-14 17:49:54 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    FD06A67C994CF2432440FE63E4268EF7FF2924DDFFBB6A0D48FDDE9BAB85880A22AC17C3327277583F6CF25478E2D6DDE8B17BDEBEC329F3E902E990

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001C68999E0EE87B69155206DDC73732C8534BA3054F4A918F00B68E39CBF49B923

Previous signature

E5E0A6E2109098ECF3CE4319B2D0F5E2A76DB38C6493E3C89F26DC1BE909E387424D08EEE5999EAF421698ED620C26ED82003A25EF574F64A0F161F503C42709

Origin signature

3045022100CD35187383AAB108A9B39AC8E06B433A88EDBDBED25B8DAB3FE756948A7DE0D502202533F4E1AF290A188397525FE5E8E1C64FE6AB4F409B78AA341D13E054D3C06B

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

006AAAE97C8C0F1BCDA19CC1F8E955B0ABE18F6EAE2909E6FB163D2648AE415282

Coordinator signature

7915DCFEA161B0872D1A60FA3288D841EFAE2228401ABDC6C89C3DDA7202C1FCD6C8F3BAD6F5C57187DBC72E86ACA62D244CB3EE99E7DA3173CCC46B160E5608

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C6D516E892DEC555E81C1E7899DEAEF0112500495BC4D0775370340479DDB6F7304CE6696E6A23B08C2FBCFB6E530EC6BD600CA109BFDD81BAB3BD8593879F0D

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

880D07B96FD21421F382A457C98D71947B031B0E7AE844D6E6AA204ED2100A0458F74600057380209C99DF70DE76E9D9B43D19A5BCD5DE00C53A86BBDF30F30D