Type
CONTRACT
Validation date
2023-11-14 20:30:31 UTC
Fee
0 UCO

Code (934 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    293F7E37E6375195B2E02D6B71CEF53700A946952EA14EB68E15D17587EF02C2F039564016DACD809AFFA07505C8515341F7E2C5200BD8F116059963

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000147BF2E24DF51392582954CC1B9953F419A28F0474134DAC06DFD5BA9AFEC12B7

Previous signature

10892A9C7F21EE519F33A1203488BA55E9DE668C9DB7AB40E1B11ABB0F83AA1C3FBE722874F5410955BDA78FAA4A7F4098B5D66056F05D71159BF8B870FE5701

Origin signature

3045022100AF066EE9C3CEEC5424F5FAF135A7D1125264BFC0676AD8AF32AE8B00340B030302206E348FDA54F1CB51FA2C95C1816FFC40C1C6943D247C2659958E16752C3A500F

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00AD49E1A4B8C41E7BB2C7E16ED501381D92AC3152F9023BCE75F97203066B815E

Coordinator signature

8C712C1F2BC0748BC538D49FDFFFC92E91F5A662AD8531CC1C5F21383B011FCCF9DE0850C523370779EC3B4F6C1BA277815BF15DAD2DE3853681E823F2344B03

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

4043D7F4AC458547BA6CEDBA743EFC455AE4CE918FEE9FE31D7D69065E91DED8C6DF8FFD1FA1705FE5A4582A007C656768B4AA120A0B89911B9B748DC029D509

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C43F30A4D38C36A635CC56F685DB353905E0DAE2C52B25C8B6868B1AF86F2733C2C06089FC95EFD6F9CBF3462A9FE02664D34CDDD5C7901D0D8DB8260289F90B