Lotto Balls is designed with security as a core principle. This page outlines the security measures and considerations.
Smart Contract Security
Reentrancy Protection
The contract inherits from OpenZeppelin's ReentrancyGuard:
function play(...) external payable nonReentrant whenNotPaused onlyWhitelisted
All state changes occur before external calls, following the checks-effects-interactions pattern.
The contract can be paused in emergencies:
function pause() external onlyOwner
function unpause() external onlyOwner
When paused:
No new bets can be placed
Pending VRF callbacks can still complete
Admin functions remain accessible
Multiple layers of access control:
onlyWhitelisted (requires LAZER token)
Only VRF Coordinator can call
Must be whitelisted via setExternalCaller
Single Pending Bet
Players can only have one pending bet:
This prevents:
Complex multi-bet exploits
Randomness Security
VRF (Verifiable Random Function) ensures:
Unpredictability: Numbers cannot be predicted before reveal
Verifiability: Cryptographic proof of fairness
Tamper resistance: Cannot be manipulated by any party
Number Derivation
Four numbers are derived from a single VRF word:
This ensures:
Uniform distribution (0-9 for each position)
Deterministic derivation (verifiable)
No correlation between positions
Financial Security
Fee Distribution
USDC fees are immediately transferred to the owner:
Jackpot Protection
Multiple safeguards for the prize pool:
Buffer Rate (30%): Reserved funds never paid out
Jackpot Cap: Maximum single payout limit
No negative balances: Transfers check balances
LTB Transfer Safety
LTB transfers check balance before sending:
Emergency Procedures
Manual Game Override
If a VRF callback fails (extremely rare):
This:
Does NOT award any prizes
Logs the override for transparency
Fund Withdrawal
Owner can withdraw funds if needed:
Known Considerations
Token Approval Requirements
Players must approve tokens before playing. The contract does not implement permit() - standard approve() is required.
VRF Callback Gas
The callback has a gas limit (800,000). Complex operations could theoretically exceed this, though the current implementation is well within limits.
Centralization Points
The owner address has significant control:
Pause/unpause the contract
Users should be aware of this trust assumption.
Users should verify the audit status of the contracts before depositing significant funds. Look for:
Third-party security audits
Time the contracts have been live without issues
Reporting Vulnerabilities
If you discover a security vulnerability:
Contact the team through official channels
Allow reasonable time for a fix
Responsible disclosure is appreciated and may be rewarded