# Beatpot smart contract

BeatPot runs entirely on smart contracts deployed on HyperEVM. This page provides technical details for those who want to interact directly with the contracts or verify the code.

{% hint style="info" %}
[BeatPot is audited by Zellic](https://github.com/0xhyperbeat/Audits/blob/main/BeatPotV2%20-%20Zellic%20Audit%20Report.pdf)
{% endhint %}

### Contract Addresses

| Contract            | Address                                                                                                                    | Purpose                            |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **BeatPot**         | [`0x53f9715c91642da22ebdf6eaa45e86d5e94c8425`](https://hyperevmscan.io/address/0x53f9715c91642da22ebdf6eaa45e86d5e94c8425) | Main raffle contract               |
| **WithdrawalQueue** | [`0x7E89acFFAC47435778dd158Aa622A150de045e10`](https://hyperevmscan.io/address/0x7E89acFFAC47435778dd158Aa622A150de045e10) | Handles backer withdrawal requests |

### Key Functions

#### For Players

**purchaseEntries**

Purchase raffle tickets for the current round.

* Input: Number of entries to purchase, optional referrer address
* Cost: 0.1 WHYPE per entry
* Requires: WHYPE approval to the contract

#### For Backers

**backerDeposit**

Deposit WHYPE into the vault to become a liquidity provider.

* Input: Amount of WHYPE to deposit
* Returns: BPLPT shares based on current exchange rate
* Requires: WHYPE approval to the contract

**requestWithdrawal**

Request to withdraw your BPLPT shares.

* Input: Amount of BPLPT shares to withdraw
* Effect: Adds request to withdrawal queue
* Note: Withdrawal processes after current round ends

**claimWithdrawal**

Claim your WHYPE after withdrawal request is processed.

* Requires: Previous withdrawal request that has been processed
* Returns: WHYPE based on exchange rate at round end

#### For Referrers

**claimReferralFees**

Claim accumulated referral rewards.

* Returns: WHYPE referral fees to your wallet

### Share Token

* Name: BeatPot Liquidity Provider Token
* Symbol: BPLPT
* Type: ERC-20 compatible
* Purpose: Represents your share of the backer vault

### Verifying the Contract

{% stepper %}
{% step %}

#### Visit the contract page

Go to the contract address links above.
{% endstep %}

{% step %}

#### View verified source

Open the "Contract" tab to see verified source code.
{% endstep %}

{% step %}

#### Inspect interactions

Check the "Transactions" tab to see all interactions.
{% endstep %}

{% step %}

#### Review events

Review "Events" to see deposits, withdrawals, and winner selections.
{% endstep %}
{% endstepper %}

### Reading Contract State

Useful read functions:

| Function              | Returns                           |
| --------------------- | --------------------------------- |
| `getCurrentRound`     | Current round number and details  |
| `getEntries`          | Your entries for a specific round |
| `exchangeRate`        | Current WHYPE per BPLPT share     |
| `totalBackerDeposits` | Total WHYPE in backer vault       |

### Events

The contract emits events for all major actions:

* `EntryPurchased` - When tickets are bought
* `WinnerSelected` - When a winner is chosen
* `PrizeClaimed` - When a winner claims their prize
* `BackerDeposit` - When liquidity is added
* `WithdrawalRequested` - When a withdrawal is queued
* `WithdrawalClaimed` - When a withdrawal is completed

### Security

The BeatPot contracts:

* Are deployed on HyperEVM mainnet
* Use Pyth Entropy for verifiable randomness
* Implement withdrawal queuing to prevent front-running
* Have no admin functions that can steal funds

{% hint style="info" %}
**For developers**

If you're building integrations or want to interact programmatically:

1. Use the contract addresses above
2. Import the ABI from HyperEVMScan
3. Ensure WHYPE approval before deposits/purchases
4. Monitor events for real-time updates

The contracts follow standard Solidity patterns and should be familiar to anyone experienced with DeFi protocols.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperbeat.org/beatpot/beatpot-smart-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
