Type
CONTRACT
Validation date
2023-11-15 00:44:59 UTC
Fee
0 UCO

Code (935 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

    82863AF925047A5722B7F5C5B6C68DEE229D90280E4343521BCA37B8B45E880A0C42E7EF16719EEBEF0AFD3BA515DAC047880812E2DD5C3040B94788

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001AE686B25C26FB2E2381F8FA87E3BA732E837ABD6D219865828C0F327B14B8268

Previous signature

F007B4DA36315C291EA904CFCC91D90EF6E5FD50569FA452A10208B76FF62BE69C889E9AB8A633571A49348E64DF41BC918ADEED46E7B252D7F2C61B1F2B9802

Origin signature

304502205F52A6B69408592B7AA5B0509F9E21C1FD2D32271E0DA5D5E627FAAA70CFC7E8022100F8FA8A2F70610C02FFE2E468CD1DAD32FF706354CA51EDD975E1F0F15F15C264

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00291D95592901057772CFA28F7842500AF3AA34FB0F83155D69CC6EBBF06A33BF

Coordinator signature

A26EC7493A4EA75F0B260B8639C43B5671FFAFBB521F57E29A41638E9F4317A29E1DB3D8C7A8F35BD85D3E5FE9CA9D7B2CAD8A7FFCB748C13F340B0B7F07C50D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

42535633BD54C8310B68D4AE47534B80254D43DEE7852A802B7625947C221B99DEFB6F77CBC5974459A865687C11AB060C3764AB600CADF084F8F7567AFA5505

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

E8F4E74FF8236BD6B79058C8316A01795E45FA1498B343AB733F2A6AC8CB78B8CCD503391B40081ED776EBC781201CFDADD93007664740A1922FA4EF3D270701