Add Crypto Roulette & Daily Lottery - Dual Gaming System#83
Open
fchambi wants to merge 1 commit intopyth-network:mainfrom
Open
Add Crypto Roulette & Daily Lottery - Dual Gaming System#83fchambi wants to merge 1 commit intopyth-network:mainfrom
fchambi wants to merge 1 commit intopyth-network:mainfrom
Conversation
…tropy V2 This submission demonstrates innovative use of Pyth Entropy V2 for verifiable on-chain randomness in a dual gaming ecosystem. Features: - Two contracts consuming Pyth Entropy (CryptoRoulette & DailyLottery) - Dual randomness patterns: high-frequency (roulette) + periodic (lottery) - Interconnected game economy with shared prize pool - Deployed and verified on Optimism Sepolia - Complete deployment scripts and comprehensive documentation Innovation: Uses Pyth Entropy for both continuous player-initiated spins and scheduled admin-triggered lottery draws, showcasing the protocol's versatility across different gaming mechanics within a single ecosystem. Technical Highlights: - Implements IEntropyConsumer interface in both contracts - Secure two-step randomness pattern (request + callback) - Cross-contract integration (roulette feeds lottery) - Winner-takes-all lottery mechanism - Emergency functions for edge cases Deployed Contracts: - CryptoRoulette: 0x19aab2239911164c9051ccaed184102a10d7121f - DailyLottery: 0x5149cc9f6c3a4b60cfa84125161e96b0cf677eb4 - Network: Optimism Sepolia (Chain ID: 11155420) Built for ETH Global Buenos Aires Hackathon Qualifying for Pyth Entropy Pool Prize (,000)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎰 Crypto Roulette & Daily Lottery
Pyth Entropy Submission - ETH Global Buenos Aires 2025
A dual gaming system demonstrating innovative use of Pyth Entropy V2 for verifiable on-chain randomness.
🎯 Project Overview
Crypto Roulette & Daily Lottery creates an interconnected gaming ecosystem where:
Both games powered by Pyth Entropy V2 for provably fair randomness.
🔮 Innovation: Dual Randomness Patterns
Unlike typical single-game implementations, this project showcases TWO distinct use cases for Pyth Entropy in one ecosystem:
Pattern 1: High-Frequency Randomness (CryptoRoulette)
Pattern 2: Periodic Randomness (DailyLottery)
This dual-pattern approach highlights Pyth Entropy's versatility across different gaming mechanics within a single interconnected economy.
✨ Key Features
🚀 Deployed Contracts (Optimism Sepolia)
0x19aab2239911164c9051ccaed184102a10d7121f0x5149cc9f6c3a4b60cfa84125161e96b0cf677eb4Network: Optimism Sepolia (Chain ID: 11155420)
Deployed Block: 36038675
Status: ✅ Verified and Functional
🛠️ Tech Stack
📊 Technical Implementation
CryptoRoulette.sol
// Request random number
uint64 sequenceNumber = entropy.requestV2{ value: entropyFee }();
// Callback with result
function entropyCallback(uint64 sequenceNumber, address, bytes32 randomNumber) {
uint256 randomIndex = uint256(randomNumber) % 5;
Asset resultAsset = Asset(randomIndex);
// Determine winner and add to lottery if won
}### DailyLottery.sol
// Trigger daily draw
uint64 sequenceNumber = entropy.requestV2{ value: entropyFee }();
// Callback selects winner
function entropyCallback(uint64 sequenceNumber, address, bytes32 randomNumber) {
uint256 winnerIndex = uint256(randomNumber) % whitelist.length;
address winner = whitelist[winnerIndex];
// Transfer prize to winner
}---
📁 Submission Contents
entropy-sdk-solidity/examples/crypto-roulette-lottery/
├── README.md (Comprehensive documentation)
├── DEPLOYMENT.md (Step-by-step deployment guide)
├── contracts/
│ ├── CryptoRoulette.sol (Roulette game contract)
│ ├── DailyLottery.sol (Lottery contract)
│ └── interfaces/
│ └── IDailyLottery.sol (Interface)
└── script/
└── DeployCryptoRoulette.s.sol (Deployment script)
🏆 Built For
ETH Global Buenos Aires Hackathon 2025
Track: DeFi / Gaming
Prize: Pyth Entropy Pool Prize
Qualification Requirements Met:
✅ Uses Pyth Entropy to generate random numbers on-chain
✅ Consumes random numbers in smart contracts via callbacks
✅ Demonstrates innovative use (dual patterns in one ecosystem)
✅ Production-ready deployment with verification
✅ Comprehensive documentation
This project goes beyond basic Pyth Entropy integration by:
Innovation: Demonstrates TWO distinct randomness patterns in a single ecosystem
Complexity: Cross-contract integration with shared state
Production-Ready: Fully deployed, verified, and functional
Documentation: Comprehensive README and deployment guide
Real-World Use: Practical gaming mechanics that users can actually play
The dual-pattern approach showcases Pyth Entropy's versatility: it's not just for one type of randomness, but can power different gaming mechanics working together in harmony.