BASE integration
Contracts
Base Mainnet
Base Sepolia
Audits
Jackpot Configuation
Mainnet
Our mainnet jackpot utilizes USDC on Base.
Ticket cost:
1
USDC
(1_000_000 USDC units in wei)Duration: 1 day
Minimum LP Depost: 100 USDC
Testnet (Base Sepolia)
Our testnet jackpot utilizes a custom ERC-20 token named MPUSDC. This token is freely mintable using the mint() function on the contract listed above. Feel free to mint tokens to add liquidity or purchase tickets.
Ticket cost:
1
MPUSDC
(1_000_000 MPUSDC units in wei)Duration: 10 minutes
Minimum LP Deposit: 10 USDC
Jackpot Functionality
Run Jackpot
runJackpot()
Our mainnet jackpot runs automatically through cron jobs.
Testnet jackpot is not run automatically. To run the jackpot you need to call the run jackpot function. You can use the following parameters to run this:
payableAmount
getJackpotFee - Obtain the jackpot fee from the contract in szabo (6 decimals) and convert to ETH. This is used to pay for the entropy provider results. Use ETH formatted number (example: 0.000015000000000001). This is paid in
ETH
userRandomNumber
=0x55fb29339a98ca25bedb7b5aa225041f669ca1407e926a95ce4a9b080ac66907
You can use any hex formatted bytes32 number (example:
Web3.utils.randomHex(32
)
Jackpot Size
You can determine the current jackpot size by comparing the userPoolTotal & lpPoolTotal. The larger of the 2 is the current jackpot size
Jackpot Odds
To calculate the odds of winning the jackpot:
Jackpot Size / (ticketPrice * (1 - feeBps / 10000)
Jackpot End Time
Purchasing Tickets
purcaseTickets(address referrer, uint256 value, address recipient)
referrer
- This is your wallet address, to receive referral fees from ticket purchases, claimable at anytime after user purchases tickets.value
- Amount of tickets * ticketPrice - Formatted in szabo (6 decimals) format.Example: 1 ticket -
1000000
USDC units, 10 tickets -10000000
USDC units
recipient
- Set this to the zero address0x0000000000000000000000000000000000000000
This parameter is used only for buying tickets on behalf of someone else. Say you wanted to pay for a ticket from your own wallet for someone else. You would input their wallet address here. For integrations this must be set to the zero address.
Notes
You must make sure the user has enough USDC for the purchase
You can call this function to check the users balance
Mainnet balanceOf(address account)
Testnet balanceOf(address account)
You must check USDC allowance / approve USDC spending to the jackpot contract
You can call this function to check the users spending allowance on the contract
You can call this function to approve USDC spending for the jackpot contract
Check user's info (Current tickets, winnings claimable)
usersInfo(address userWallet)
This will return the users current total of tickets purchased in the current jackpot, their claimable winnings, if any, and a boolean status if they are active in the current jackpot round.
Calculate ticket count for round
ticketsPurchasedTotalBps / 10000 / ((100 - (feeBps / 100)) / 100)
Withdraw Winnings
withdrawWinnings()
If a user has winnings to claim, you can call this function to claim any winnings the user may have.
Withdraw Referrer Fees
withdrawReferrerFees()
You can call this function to claim any referrer fees you have pending from tickets sold. Referrer fees are available immediately after a ticket is purchased where you are the referrer
in the purchaseTickets function call.
Last updated