Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Airdrop

Git Source

Inherits: VRFConsumerBaseV2Plus, ReentrancyGuard, Errors, Events

State Variables

NUM_WORDS

uint32 private constant NUM_WORDS = 1;

REQUEST_CONFIRMATIONS

uint16 private constant REQUEST_CONFIRMATIONS = 3;

i_entranceFee

uint256 private immutable i_entranceFee;

i_amountOfParticipantsPerLottery

uint256 private immutable i_amountOfParticipantsPerLottery;

i_subId

uint256 private immutable i_subId;

i_keyHash

bytes32 private immutable i_keyHash;

i_callbackGasLimit

uint32 private immutable i_callbackGasLimit;

lotteries

lottery[] private lotteries;

s_currentLotteryId

uint256 private s_currentLotteryId;

Functions

constructor

constructor(
    uint256 _entranceFee,
    uint256 _amountOfParticipantsPerLottery,
    address _vrfCoordinator,
    uint256 _subId,
    bytes32 _keyHash,
    uint32 _callbackGasLimit
) VRFConsumerBaseV2Plus(_vrfCoordinator);

registerForAirdrop

function registerForAirdrop() external payable;

fulfillRandomWords

function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal override;

startTheRaffle

function startTheRaffle() public;

claimTheRewards

function claimTheRewards(uint256 _lotteryId) public nonReentrant;

Structs

Participant

struct Participant {
    bool active;
    uint256 currentLotteryId;
    uint256 amountToClaim;
}

lottery

struct lottery {
    State state;
    Participant[] participants;
    uint256 amountOfParticipants;
    uint256 amountOfTokens;
    uint256 changesToWinPerParticipant;
    address theWinner;
    uint256 time;
}

Enums

State

enum State {
    Registration,
    Waiting,
    Finished
}