About Flip Battle
# 🎯 CoinFlip Betting System
A decentralized coin-flip betting platform built on Ethereum using Chainlink VRF for provably fair randomness. Players can create and join betting games with any ERC20 token, while the betting provider earns fees from completed games.
## 🎮 How It Works
1. **Create Bet**: A player creates a bet by choosing HEADS or TAILS and depositing tokens
2. **Join Bet**: Another player joins the bet by matching the same token amount
3. **Random Result**: Chainlink VRF generates a provably random result
4. **Payout**: Winner receives ~95% of the total pot, 5% goes to the betting provider
## 🏗️ Architecture
### Core Contracts
– **`CoinFlipFactory`**: Factory contract that deploys betting instances for different tokens
– **`CoinFlipBetting`**: Individual betting contract handling all game logic and VRF integration
– **`ICoinFlipBetting`**: Interface defining the betting contract structure
– **`TestToken`**: ERC20 token for testing purposes
### Key Features
– ✅ **Provably Fair**: Uses Chainlink VRF for verifiable randomness
– ✅ **Multi-Token Support**: Factory creates separate betting contracts for each token
– ✅ **Fee System**: 5% fee collected by betting provider
– ✅ **Emergency Withdrawals**: Players can withdraw after 24 hours if VRF fails
– ✅ **Comprehensive Events**: Full event tracking for all betting activities
– ✅ **Security**: ReentrancyGuard, custom errors, and proper access controls
Supported Chains
Similar Dapps