Type
CONTRACT
Validation date
2023-12-06 07:56:25 UTC
Fee
0 UCO

Code (932 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xd61e26a9a1a066115cc0d391f1fe230f043b648a", 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: 0x0000229E63A69C9885130321C9FCDDFC8149C016D1EF0371C3B48F7E44069155ED9D, amount: 0.00992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B9BC1DFC666CD0C0023EED90610347CDDDDEA65085E4F8A238645CC79B179CE9C6AD3581B7AD1F5A82E265BB1F586630D8A345C388CA416819633D32

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001149EBE5FD05A39C8DE15F755EF4C1D734EA9DF1844B7DA474D6C50C3B4675E08

Previous signature

5BF92355068CE49C3737052C5A86859988C1C2DB8C864B3955973CEE9234BC7EF8CF903B05B64542DB71225DF2B3557DB6D9E6019759FAD43FC91BF9595DAA09

Origin signature

3046022100AE4D6C5473D3EE975ED04AC614691251530785CD9E8799B40D47501799283AA0022100E6E3CD13FB619BF01D1812191A6012942DB583D80D0E7D4A1EEBF56727D3FD98

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00F07538AF027634F166425A78B80D0B0C0CDD6295B7C1A2F1C2EE250871A62C46

Coordinator signature

583BECB9808BA5F50A9DA3DD556D1C7B25B3758D50EECF441217EE9DEBA749608D153D6374145E30A85D6991C8CB24AF9FA8FAB4AB8E9AC51742054D693AB402

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

8A72B88A41DA9948F2ACD1028A6437B5FA566EFDCC75E0652BDCE15575571477F3A6552A81210FE438FCBA737BF36970A162576DD8A485D16E75E47BEC33730B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

56932BAF7152AE2D5997259BEAFEE03E5A90681DD2116C860C11B4973AE38628E72CCD11C72CA900EE6174600ACA8C2976DC751D0C2321D7E935170C312AEB0B