Type
CONTRACT
Validation date
2023-12-07 13:43:51 UTC
Fee
0 UCO

Code (938 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    7E9D7F8AB749CEFB0F94282CC0DFBF96653F4102715FBB85C9DC5442F52D358CBA525B71426EA71E6E8C2C67C69B56E48773EAE71B5723CE3BDAE404

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000155EB25ABB7B9445CC3EC8AF49AE5C10DB9946E146A6A3ADE5BF21F10134C8D2D

Previous signature

93BA2E4A7FF321B5F19F19ADF149F5A91BD476020A24972E7AACBA16DC5BA2C71C150E5BBB11B1872447C0FDE3D9C174A4ED4EB9F102D6E31D51D81316230908

Origin signature

3044022031C30659A59CF7B02ADD929C66D9D6D3B6C188C275D04761076B262C10AC900A022013DB8454639E39825BC511A595952FCDC7CC4CB39A9AE5362C08BA3CF8130BD3

Proof of work

010104228ED9FE757FA46CEDCAE4E3FDDEC1EF6511A71B15E5611AA36EA41DFB969EF2FB83D72D13AD1E89873CD4EFF1364880B3557D72AE5188EF5E1BD09253CE235A

Proof of integrity

00097506BECCC272FB897FA0244CBB93804E16F2C6CCAC2FAC86BAB705664968F4

Coordinator signature

C2F79436A4724B155FCACD2126619E78F9F42C63D81EAD90900937072427F904C9D276532CFDC3EA44E1E2C5052B173DF98A64D67DCD8D6E50D022582687C20F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

196FCAB46A71DDFE901BF24300EBBCCE9B0942AA46163B51E58E4785046439584E8B476167D4FEA502D79EAF02FD54097DB4D66573161309D2732CF39C6BD60D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

0D669CFE7A8088B7D23EA95999F41EE1074C3394B055809FD8112CD8CE9869FC82C8901D760ED82646604B425048424AC3CCFBF9DBD2E4763C40BABFC4E5EE03