Raffle States
Understanding the lifecycle and state transitions of Gaambl Raafl games
Raffle State Lifecycle
Raffles progress through several states from creation to completion. Understanding these states helps with monitoring and participation.
ACTIVE
Accepting PlayersRaffle is accepting new players. NFT is locked in contract until completion.
NFT Status: Locked in contract, owned by contract until completion
Player Actions: Can join by paying entry fee
Creator Actions: Cannot cancel or modify once created
WAITING_RANDOMNESS
Requesting EntropyRaffle reached completion trigger and randomness has been requested from Pyth Network.
Trigger: Max players reached OR manual completion with 2+ players
Duration: Usually 1-2 blocks, max 10 minutes before retry
Player Actions: No actions available, wait for randomness
READY_FOR_COMPLETION
Ready to FinalizeRandomness received, waiting for finalization with 2-block delay for MEV protection.
Requirement: Must wait 2 blocks after randomness for MEV protection
Finalization: Anyone can call finalizeRaffleCompletion(raffleId)
Bot Opportunity: Prime state for automated finalization
COMPLETED
Raffle FinishedWinner selected, NFT transferred, and prizes claimable.
NFT Status: Automatically transferred to winner during finalization
Creator Actions: Must claim prize pool minus platform fee
Winner Actions: NFT received automatically, no claim needed
CANCELLED
Raffle CancelledRaffle cancelled, usually due to zero participants at expiration.
NFT Status: Automatically returned to creator
Refunds: No refunds needed (no participants)
Trigger: Zero participants when raffle expires
REFUNDED
Single Player RefundRaffle had exactly one participant at expiration and was automatically refunded.
NFT Status: Automatically returned to creator
Refunds: Single participant gets entry fee back via claim system
Automatic: Handled during expired raffle completion
State Transitions
Raffles follow a predictable state transition pattern based on player participation and timing.
Normal Completion Flow
ACTIVE → WAITING_RANDOMNESS → READY_FOR_COMPLETION → COMPLETED
Expired Raffle Flow
ACTIVE → (expired) → CANCELLED (0 players) or REFUNDED (1 player) or WAITING_RANDOMNESS → COMPLETED (2+ players)