Skip to main content

IRaffl

Git Source Interface that describes the Prize struct, the GameStatus and initialize function so the RafflFactory knows how to initialize the Raffl.

Functions

initialize

Initializes the contract by setting up the raffle variables and the prices information.
Parameters

criteriaMet

Checks if the raffle has met the minimum entries

deadlineExpired

Checks if the deadline has passed

upkeepPerformed

Checks if raffle already perfomed the upkeep

setSuccessCriteria

Sets the criteria as settled, sets the GameStatus as DrawStarted and emits event DeadlineSuccessCriteria Access control: factory is the only allowed to called this method

setFailedCriteria

Sets the criteria as settled, sets the GameStatus as FailedDraw and emits event DeadlineFailedCriteria Access control: factory is the only allowed to called this method

buyEntries

Purchase entries for the raffle. Handles the acquisition of entries for three scenarios: i) Entry is paid with network tokens, ii) Entry is paid with ERC-20 tokens, iii) Entry is free (allows up to 1 entry per user)
Parameters

refundEntries

Refund entries for a specific user. Invokable when the draw was not made because the min entries were not enought This method is not available if the entryPrice was zero
Parameters

refundPrizes

Refund prizes to the creator. Invokable when the draw was not made because the min entries were not enought

disperseRewards

Transfers the prizes to the provably fair and verifiable entrant, sets the GameStatus as SuccessDraw and emits event DrawSuccess Access control: factory is the only allowed to called this method through the Chainlink VRF Coordinator

Events

RaffleInitialized

Emit when a new raffle is initialized.

EntriesBought

Emit when a user buys entries.
Parameters

EntriesRefunded

Emit when a user gets refunded for their entries.
Parameters

PrizesRefunded

Emit when prizes are refunded.

DrawSuccess

Emit when a draw is successful.
Parameters

DeadlineSuccessCriteria

Emit when the criteria for deadline success is met.
Parameters

DeadlineFailedCriteria

Emit when the criteria for deadline failure is met.
Parameters

TokenGatingChanges

Emit when changes are made to token-gating parameters.

Structs

Prize

asset represents the address of the asset considered as a prize assetType defines the type of asset value represents the value of the prize. If asset is an ERC20, it’s the amount. If asset is an ERC721, it’s the tokenId.

TokenGate

token represents the address of the token gating asset amount represents the minimum value of the token gating

ExtraRecipient

recipient represents the address of the extra recipient of the pooled funds feePercentage is the percentage of the pooled funds (after fees) that will be shared to the extra recipient

Enums

AssetType

Asset type describe the kind of token behind the prize tok describes how the periods between release tokens.

GameStatus

GameStatus defines the possible states of the game (0) Initialized: Raffle is initialized and ready to receive entries until the deadline (1) FailedDraw: Raffle deadline was hit by the Chailink Upkeep but minimum entries were not met (2) DrawStarted: Raffle deadline was hit by the Chainlink Upkeep and it’s waiting for the Chainlink VRF with the lucky winner (3) SuccessDraw: Raffle received the provably fair and verifiable random lucky winner and distributed rewards.