Complete technical overview of the Bet Protocol smart contract architecture
The Bet0x Protocol is a comprehensive blockchain-based sports betting platform built using the Diamond Pattern (EIP-2535) for maximum upgradability and modularity. The system consists of multiple facets that handle different aspects of the betting ecosystem.
Diamond (Proxy) ├── DiamondCutFacet (Upgrade Management) ├── DiamondLoupeFacet (Introspection) ├── BettingCoreFacet (Core Betting Logic) ├── AMMFacet (Automated Market Making) ├── OracleFacet (Price Feed Management) └── SecurityFacet (Security & Emergency Controls)
Purpose: Main proxy contract that delegates calls to appropriate facets.
Key Features: Proxy pattern implementation with delegatecall routing, version management with upgrade tracking, initial setup with DiamondCut functionality.
Purpose: Core betting functionality including event management, bet placement, and settlement.
Key Functions: createEvent(), activateEvent(), placeBet(), claimWinnings(), resolveEvent()
Purpose: Automated Market Making functionality for dynamic odds calculation and liquidity management.
Key Functions: createMarket(), addLiquidity(), removeLiquidity(), getMarketPrices()
Purpose: Security controls, emergency mechanisms, and user management.
Key Functions: emergencyPause(), emergencyUnpause(), blacklistUser(), isBlacklisted()
Purpose: Oracle management for external data feeds and event result determination.
Key Functions: addOracle(), submitResult(), getConsensusResult()
Governance token for protocol participation and voting with ERC-20 implementation, voting capabilities, and fee discount mechanisms.
Utility token for fee payments and protocol interactions with ERC-20 implementation, staking mechanisms, and reward distribution.