How to Earn by Referring

Integrate Megapot referrals into your application and earn fees from ticket purchases and winnings.

How Referral Fees Work

Referrers earn from two sources:

Fee Type
When Earned
Description

Purchase Fee

When referred user buys tickets

Percentage of ticket price

Win Share

When referred user claims a prize

Percentage of winnings

Both fee percentages are set at the protocol level and can be read from the drawing state:

  • referralFee - fraction of ticket price paid to referrers

  • referralWinShare - fraction of claimed winnings paid to referrers

Fees accumulate in the Jackpot contract and can be claimed at any time.


Setting a Referrer

When purchasing tickets through any method (Jackpot.buyTickets, BatchPurchaseFacilitator, or JackpotAutoSubscription), you pass referrer information in two arrays:

Parameter
Type
Description

_referrers

address[]

Array of referrer wallet addresses

_referralSplit

uint256[]

Weight for each referrer (must sum to 1e18)

Single Referrer

For a single referrer receiving 100% of fees:

Example with Jackpot.buyTickets:

Multiple Referrers

Split fees between multiple addresses by providing matching arrays:

50/50 split between two referrers:

80/20 split (e.g., primary affiliate and sub-affiliate):

Three-way split (70/20/10):

The split weights must sum to exactly 1e18 (1000000000000000000).

No Referrer

Pass empty arrays if there's no referrer:


Referral Scheme Tracking

Each unique combination of referrers and splits creates a "referral scheme" that is stored with the ticket. This scheme is used to:

  1. Pay purchase fees immediately when tickets are bought

  2. Pay win share fees when those tickets win prizes

You can look up a scheme's details using:


Viewing Accumulated Fees

Check your claimable referral balance using the referralFees mapping:

This returns the total USDC (6 decimals) you can claim. The balance includes:

  • Purchase fees from all tickets bought with you as referrer

  • Win share fees from any claimed winnings by users you referred


Claiming Fees

Call claimReferralFees() to withdraw your accumulated fees:

This transfers your entire claimable balance to your wallet. There is no minimum claim amount.


Reading Fee Parameters

Get the current referral fee rates from the drawing state:

These values use 1e18 precision (1e18 = 100%).

Last updated