Type
CONTRACT
Validation date
2023-11-21 07:22:33 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x58d7a7942e534815684871a0e6c9038436987098", 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: 9.9202e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.98e-6, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    93F60E6034EBA59475113720F55E1EDCFA6AE6EEE922C80482B1992B4CEAF3A6484EF20B1C56ABF230E6B8E2E1E71DA33C2130422563A7876BBE7A71

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013BA255820DDE47341FB7ECB235E1BB4F536CD96B6554B282230F9D0826E3D455

Previous signature

0AF0C4BB856174E5BDD1533DD3484EC259D3157B3A3491C68BEEE465B7CBBD155922E894A55AE6A6627B11A0C1FF35CFF93AF8F78D6ECB8B0857F907B78D9F02

Origin signature

3044022048331B9424DDB77D73EA5B045223822E99B482378D72A9312BABC6E5E756C502022019B63A56A7ED4B689DD7B0E49D7E45DAD40D0CF55C76953AEE70E796C0E823EF

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

003C9A252E5F8F196F037E98C42B9DE493968AAC35B72A7D8C7AF569BB94D7396E

Coordinator signature

3FD2E23E8E4234295F745499E9819B834B6C458274DCAC7BF1BD3418A78231E435DDCF509D32D62DDAE3A7BE9E2993D0C5C66AE80A55659CE74CF4C693162C0C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

4C0CA811D39F7640B8B552DD7CB914CFC35C7E54C43761983804EC9E2D54345FE605F45D4F1395E9762B225E240AC7933AE548D9FBDBDAB7D736780CF9C01F0E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

4BC9154BDBB8CEFF359E34DA144FF181D8328ECFEB916C1CBAE51C38076CC6BA64206A3E66811E1D375A848748944E6E4084BF7A21D64494174C0BDB010EE306