For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add the Jackpot to Your Site

You already have a product. This page shows how to drop Megapot buy and claim into it, and earn fees on every ticket your users buy, without rebuilding your app around it.

Pick the path that fits how much you want to build:

  • Wire one flow: keep your own UI, call the contracts directly. Best when you want buy or claim inside an existing screen.

  • Fork the starter kit: a complete five-page React app you rebrand and ship. Fastest path to a full lottery experience.


Earn on every purchase


Weight A: Wire one flow

Keep your own UI. Call the contract that matches your scenario:

Scenario
Contract & method
Execution

Up to 10 custom-number tickets

Jackpot.buyTickets

Immediate

Random / quick-pick

JackpotRandomTicketBuyer.buyTickets

Immediate

More than 10 tickets

BatchPurchaseFacilitator.createBatchOrder

Keeper-executed

Recurring across drawings

JackpotAutoSubscription.createSubscription

Keeper-executed

Addresses and full signatures for all four are in the Protocol Reference. Each carries a trailing bytes32 _source and the _referrers / _referralSplit pair.

One representative flow: Jackpot.buyTickets

This is the common case: up to 10 custom tickets, minted immediately. The pattern (read price → approve USDC → call with referrer + source) is the same for the other three methods; only the contract and arguments change.

Confirm the exact signature and ABI at llms.megapot.io/abi/Jackpot.txt before shipping.

Showing prize info

Read live values rather than hardcoding anything:

  • Jackpot.getDrawingState() → current prize pool, ticketPrice, ballMax, bonusballMax, plus the live referralFee and referralWinShare rates (1e18 precision).

  • GuaranteedMinimumPayoutCalculator (the PayoutCalculator) → expected per-tier payouts for display.

Both addresses are in the Protocol Reference.

Claiming winnings

Surface a claim in your UI and call Jackpot.claimWinnings(uint256[] _ticketIds) with the user's winning ticket IDs. For win-detection, auto-compound, and claiming your own referral fees, see Claim winnings & fees.

Don't re-narrate the whole protocol here. For batch orders, subscriptions, auto-compound, LP, and read-state multicalls, point your editor at llms.megapot.io for AI-ready viem and wagmi recipes, and use the Protocol Reference for addresses and full signatures.


Weight B: Fork the starter kit

Want a complete app, not a single flow? The Megapot Starter Kit is a five-page React + wagmi reference frontend (Home, Play, Tickets, LP, History) implementing every core flow. It's the exact app running at demo.megapot.io. MIT licensed.

Set VITE_REFERRER_ADDRESS to your wallet and the source tag in config, rebrand, and ship. A dev-mode warning fires while the referrer or source tag is still the placeholder, so you can't accidentally deploy without attribution.

The kit ships three API-key deployment shapes: anonymous (no key), browser key (VITE_MEGAPOT_API_KEY), or server proxy (key stays server-side). Pick once per fork.

Everything else lives in the repo, don't look for it here:


Building with an AI assistant? Point it at llms.megapot.io and it loads the right skills and recipes itself.


Next

Last updated