Contract Overview

This section provides developer reference documentation for Megapot's smart contracts, including function signatures, parameters, and usage examples.


Contract Addresses

All contracts are deployed on Base (Chain ID: 8453).

Contract
Address
Description

Jackpot

0x3bAe643002069dBCbcd62B1A4eb4C4A397d042a2

Main lottery orchestrator

JackpotLPManager

0xE63E54DF82d894396B885CE498F828f2454d9dCf

Backer deposit and share management

JackpotTicketNFT

0x48FfE35AbB9f4780a4f1775C2Ce1c46185b366e4

ERC-721 ticket NFTs

JackpotAutoSubscription

0x02A58B725116BA687D9356Eafe0fA771d58a37ac

Auto-subscription management

BatchPurchaseFacilitator

0x01774B531591b286b9f02C6Bc02ab3fD9526Aa76

Batch ticket purchases

JackpotRandomTicketBuyer

0xb9560b43b91dE2c1DaF5dfbb76b2CFcDaFc13aBd

Random ticket purchases

GuaranteedMinimumPayoutCalculator

0x97a22361b6208aC8cd9afaea09D20feC47046CBD

Prize tier calculations

ScaledEntropyProvider

0x5D030DEC2e0d38935e662C0d2feD44B050c8Ae51

Pyth randomness integration


Security Audits

The Megapot protocol has been independently audited:

Auditor
Date
Report

Code4rena

Nov 2025

Independent Auditors

Dec 2025

The Megapot protocol above operates autonomously, enabling anyone to build on it, or use it, without permission.


Architecture

Megapot uses a modular smart contract architecture:

Contract Categories

Core Contracts

Contract
Description
Documentation

Main entry point for ticket purchases, LP operations, and prize claims

Core

ERC-721 NFTs representing lottery tickets

Core

Manages LP deposits, withdrawals, and share calculations

Core

User-Facing Contracts

Contract
Description
Documentation

Bulk ticket orders with static and dynamic tickets

Helper

Recurring ticket purchases across drawings

Helper

Cross-chain ticket purchases and claims

Helper

Simple random ticket purchases

Helper

Internal Contracts

Contract
Description
Documentation

Prize tier payout calculations

Internal

Pyth Network randomness integration

Internal

Key Concepts

Ticket Structure

Tickets consist of 5 normal ball numbers and 1 bonusball:

Drawing State

Each drawing has a complete state record:

Prize Tiers

The system uses 12 prize tiers based on matches:

Tier
Matches
Bonusball
Formula

0

0

No

0*2 + 0 = 0

1

0

Yes

0*2 + 1 = 1

2

1

No

1*2 + 0 = 2

3

1

Yes

1*2 + 1 = 3

...

...

...

...

10

5

No

5*2 + 0 = 10

11

5

Yes

5*2 + 1 = 11 (Jackpot!)

Referral System

Tickets can include referrers who earn fees:

Integration Quick Start

Buy Tickets

Claim Winnings

LP Operations

Last updated