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

Code (935 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699810080 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 >= 1699810080
]

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)) == 0xBC3D317EAE2C2B8891BFFD453B4752990228FF46BDE86F132AEDB25E808837B1,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x54a01cd104377e9a441517cef3c3e6a61d6cdf17", 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: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, 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

    FF7ECB7410179032FC948F27086EFFBAFF6ACBF8537A1C12907858FD7D8B081045B2557FDFF250ADE8BF180AF0A23A69A144850C356B755D5116D7B6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001572780D936C0BAB4608243DC8CE080709BF9DA3141A3729CF0C7EF96B79AD8A7

Previous signature

A1DB27A6D27408E5938E867E9E6F498338C46976B70ABA7B6789E45CBB2311521195A2F247A84FFAC17E93D13B7258C56261D73CAF2372C430565A4BC0C8490B

Origin signature

304402206B4023D3A77C75B7FB7A7A75849371E39ABF4F234B772749604CE4DE0B125327022010295D9EEC6F0655D9AF63033E9D6C4F26BE8BAB4D523222DB3C467FFBD416C9

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

009ECFC965215A55D9D6C8C1E8A09C4A22BED52FDF2BC861060B6948DDFE851406

Coordinator signature

9AE4FAFE7152B5DCB8790FE08225D8DB7FA1DEEC0C6590C4F3AD9AD87A27777E91EC25C3850E57A85E7FBE15129B1E520842CBB409AAE6504FDA5766EC4FCD0F

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

01AC9F89DD6F99135C13BCA0130AC95472692559101F4C5DC21709EC78D0AFAC9B2FFEFD133A15F28AD4FAD17080440CB5C04F2D6CD6AB3388C66997BF755D0F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AAF4E250089E1FCB0E715CE309BADC9FEC0D785602FE841A3C5844B44F9AE80F095ED71B15A4ABBE4E33FF169CDF8E87781182654B1B96A31C27D4DD43C2E206