Type
CONTRACT
Validation date
2023-11-15 07:39:29 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    3AA76E389ACEE78F4A713A1E801E5CD45F25F85ED907C3BF5EC4A9BE52C029A31FCD39069721AA3B99AF61BA9462D82F8409D9805958009218F00A47

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F5510C3F7D50F38EC32453A77429764577E49F912D8FF06CB90E24AEF42E5875

Previous signature

84F11CCC05BEAED3F284958D7D405865523804B544961E42D1E3B41AEFCB075E05F12541D48B0B1CF1F08D09FDDA2835E95FECFC413F8E6FBF4B99AE92E2D10E

Origin signature

30450220383C5C7333A0CA4BEFCC7DD12B63B1AC15E41F609253E1EF765FA271A1F37BDA022100DC35118A297EEE446F3B34CD8369870240809A78EA4866846D38B308B45987E9

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00B9E02B4540114D0AD2F729D8932B9B32A20194F7F5B737B5DAE01FA15107EA48

Coordinator signature

6AAAC5AC08215C05147EE79EE992D2F658361EB543EBDDF2A7EA348967F3FD391AFBA15C7E1D162D671CF6950BD409163529E52EE68F04DAD4BFCAB6E6863B02

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

8BFA37BCA00C7296ACD17A83C6A4589D8DAADBDF479737AF450502F7EE5503293F49BFE7113CE72024F4026E9F54712F773BE90B8E251500BD80BEB3E9191D06

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

8E5F670A3DBDB49D90CA9CAF4B4F64222AB5F085B85004BB7405FABBD00C0D02A1ADF1A269A3FE151816C076617E9B3FA111F33E889B935322D48520F479380A