💰
Megapot
  • Overview
    • About Megapot
    • How to play
    • How to provide liquidity
    • How to refer users
    • Earn as a liquidity provider
    • About the Team
    • Megapoints
  • Deep dive
    • Components
    • System Diagram
    • Smart Contract
    • Provably Fair
  • Developers
    • Start Here
    • Add jackpot to your site
      • Custom Integration
        • Getting Started
        • Contract Functions
        • Jackpot Page
        • LP Deposit Page
        • History Page
      • React UI Kit
        • MegapotProvider
        • Jackpot
        • useJackpot
    • Sybil-resistant incentives
    • Launch jackpot in your token
    • Developer Reference
      • Testnet & Mainnet
      • Contract Overview & Functions
      • Megapot API
      • Megapot Examples
      • How to Earn Fees
      • Brand Kit
  • Appendix
    • VIP Program
    • FAQ
    • About Megapot
  • Terms of Service
  • Privacy Policy
  • Responsible Gaming
Powered by GitBook
On this page
  • View our example Github Repo
  • Community Example
  • How to Gift Tickets
  • Walkthrough
  • Example
  • Getting Purchased Tickets Info
  1. Developers

Sybil-resistant incentives

PrevioususeJackpotNextLaunch jackpot in your token

Last updated 6 hours ago

Instantly incentivize any action on your app in 1 hour and for less than $1 per real user.

Programmatically gift tickets by setting the recipient parameter to the wallet you want to gift the tickets to.

View our

Community Example

, a Telegram mini app, incentivizes signups with free Megapot tickets. !

How to Gift Tickets

Set your wallet address as the referrer parameter to the ticket purchase function and add the recipient parameter to the ticket purchase function of the wallet you want to gift the tickets to.

Walkthrough

Let's take a look at the purchaseTickets function:

purchaseTickets(address referrer, uint256 value, address recipient)
  • referrer: Your wallet address. Triggers the contract to pay you 10% of the ticket price for each ticket purchased.

  • value: The number of tickets to purchase, in szabo (6 decimals). 1_000_000 szabo = 1 ticket.

  • recipient: The address of the recipient of the tickets. This is the wallet of the person receiving the ticket(s).

Just set yourself as the referrer parameter and the recipient parameter to the wallet you want to gift the tickets to.

Example

Let's say you want to gift 1 ticket to the jackpot. You would set the referrer parameter to your wallet address and the value parameter to 1 tickets.

purchaseTickets(
    address referrer,
    uint256 value,
    address recipient
);

purchaseTickets(
    0x1234567890123456789012345678901234567890, // referrer
    1000000,                                    // value
    0x7890123456789012345678901234567890123456  // recipient
);

Getting Purchased Tickets Info

usersInfo(address user)
uint256 ticketsPurchased = usersInfo.ticketsPurchasedTotalBps / 7000;

You can get the number of tickets purchased by a wallet by calling the function with the recipient wallet address as the parameter.

This will return some data about the wallet. The ticketsPurchasedTotalBps is the number of tickets purchased by the wallet this round. To get the number of tickets purchased, you can divide this number by 7000. Our contract uses a basis points number to calculate tickets in the contract. Every ticket is worth 10_000 ticket units (See our ). 30% of the ticket price goes to LPs & referral fees. So to calculate the number of tickets purchased, you divide the total bps by 7000.

example Github Repo
Moai Cash
Try it here
usersInfo
deep dive