A fully functional, cross-chain, decentralized betting platform built on Celo with cross-chain payout intents powered by Axelar.
- π² Multi-Game Betting: CoinFlip, LuckyDice, MangoSpin games
- π Cross-Chain Payouts: Transfer winnings to any supported blockchain
- β‘ Real-Time Updates: Live feed with WebSocket connections
- π Leaderboards: Track top performers and statistics
- π Secure Escrow: Smart contract-based fund management
- π± Responsive Design: Beautiful dark theme with animations
- Smart Contracts: Deployed on Celo with Solidity
- Cross-Chain Bridge: Axelar integration for multi-chain transfers
- Real-Time API: WebSocket-powered live updates
- Wallet Integration: Valora, MetaMask, WalletConnect support
- Database: MongoDB for data persistence
- Security: Role-based access control and audit trails
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Blockchain β
β (Next.js) βββββΊβ (Node.js) βββββΊβ (Hardhat) β
β β β β β β
β β’ React/Next.js β β β’ Express API β β β’ Solidity β
β β’ Wagmi/Rainbow β β β’ WebSocket β β β’ Axelar Bridge β
β β’ Framer Motion β β β’ MongoDB β β β’ Event Listenersβ
β β’ Tailwind CSS β β β’ Real-time β β β’ Solver Serviceβ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
Mango.Tree/
βββ Backend/ # Node.js API Server
β βββ src/
β β βββ controllers/ # API Controllers
β β βββ routes/ # Express Routes
β β βββ services/ # Business Logic
β β βββ blockchain/ # Blockchain Integration
β β βββ models/ # Database Models
β β βββ utils/ # Utilities
β βββ package.json
βββ Frontend/ # Next.js Frontend
β βββ app/ # App Router
β βββ components/ # React Components
β βββ hooks/ # Custom Hooks
β βββ lib/ # Utilities
β βββ package.json
βββ Blockchain/ # Smart Contracts
β βββ contracts/ # Solidity Contracts
β βββ scripts/ # Deployment Scripts
β βββ services/ # Blockchain Services
β βββ package.json
βββ scripts/ # Deployment Scripts
- Network: Celo Sepolia Testnet (Chain ID: 11142220)
- Status: All 7 contracts deployed and functional
- Total Gas Used: 8,262,422
- Deployment Cost: 0.8262422 CELO
- Deployer:
0xC0Aa6fb8641c2b014d86112dB098AAb17bcc9b13
- β Smart Contracts Deployed
- β Contract Addresses Generated
- β CeloScan Links Available
- π Backend Integration (In Progress)
- π Frontend Integration (In Progress)
- π Cross-Chain Bridge Setup (Planned)
- Node.js 18+
- npm or pnpm
- Git
- MongoDB (for backend)
- Wallet with testnet funds
git clone https://github.com/your-username/mango-tree.git
cd mango-tree# Install all dependencies
npm run install:all
# Or install individually
cd Backend && npm install
cd ../Frontend && npm install
cd ../Blockchain && npm install# Copy environment files
cp Backend/.env.example Backend/.env
cp Blockchain/env.example Blockchain/.env
cp Frontend/.env.example Frontend/.env.local
# Update with your configuration# Deploy all contracts to Celo Sepolia
cd Blockchain
npm run mango:deploy-all# Start Backend (Terminal 1)
cd Backend && npm run dev
# Start Frontend (Terminal 2)
cd Frontend && npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- WebSocket: ws://localhost:5000
- CeloScan: https://sepolia.celoscan.io
cd Backend
npm install
npm run devcd Frontend
npm install
npm run devcd Blockchain
npm install
npm run compile
npm run mango:deploy-all # Deploy all contracts to Celo SepoliaPOST /api/bets- Create a new betPOST /api/bets/:id/join- Join an existing betPOST /api/bets/:id/resolve- Resolve a betGET /api/bets- Get active betsGET /api/bets/user/:address- Get user's bets
POST /api/payout/payout-intent- Create payout intentPOST /api/payout/confirm-payout- Confirm payoutGET /api/payout/payout-intents/:address- Get user's payouts
GET /api/leaderboard- Get leaderboardGET /api/leaderboard/user/:address/rank- Get user rankGET /api/leaderboard/top-performers- Get top performers
GET /api/feed/live- Get live activity feedGET /api/feed/recent- Get recent activityGET /api/feed/stats- Get feed statistics
- BetContract: Main betting logic and fund management
- BetEscrow: Secure escrow for bet funds
- IntentRouter: Cross-chain payout intent management
- GameLogic: Game mechanics and VRF integration
- VRFConsumer: Verifiable Random Function consumer
- MockToken: Test ERC20 token for development
- MangoTree: Treasury and fund management contract
// Celo Sepolia (Testnet) - LIVE β
BetContract: "0x9c4Ab9bdb97342A31cf0e2632610957cF633978C"
BetEscrow: "0x070021DC542C5b5b7e9aeBDB72aa6Cabda88905D"
IntentRouter: "0x0CFe46e97865ece06b0CfaD2CB8069833399986a"
MockToken: "0xD51Aa28401Ccf5ed584D5c1520857FD6Cd067A0a"
GameLogic: "0x6fbBe3dCb9E2110aA5aaf0198d34880f6639bEA4"
VRFConsumer: "0x10Ae60ADe4F5223C89EF958E1Df017737D0f0c8E"
MangoTree: "0x1bdE57E8Bfa994E4998F82Fa267b9f62fE6Ee9e4"
// Network: Celo Sepolia (Chain ID: 11142220)
// Deployer: 0xC0Aa6fb8641c2b014d86112dB098AAb17bcc9b13
// Total Gas Used: 8,262,422
// Total Cost: 0.8262422 CELO- BetContract - Main betting logic
- BetEscrow - Fund escrow
- IntentRouter - Cross-chain router
- MockToken - Test token
- GameLogic - Game mechanics
- VRFConsumer - Randomness
- MangoTree - Treasury
| Network | Chain ID | Status | RPC URL |
|---|---|---|---|
| Celo | 42220 | π Planned | https://forno.celo.org |
| Celo Sepolia | 11142220 | β LIVE | https://forno.celo-sepolia.celo-testnet.org |
| Celo Alfajores | 44787 | π Planned | https://alfajores-forno.celo-testnet.org |
| Polygon | 137 | π Planned | https://polygon-rpc.com |
| Polygon Mumbai | 80001 | π Planned | https://rpc-mumbai.maticvigil.com |
| Ethereum | 1 | π Planned | https://mainnet.infura.io/v3/YOUR_KEY |
| Base | 8453 | π Planned | https://mainnet.base.org |
- β Reentrancy Protection: All external calls protected
- β Access Control: Role-based permissions
- β Input Validation: Comprehensive parameter validation
- β Emergency Functions: Pause/unpause capabilities
- β Fee Limits: Maximum fee caps (10%)
- β Input Sanitization: All inputs validated
- β Rate Limiting: API rate limiting
- β CORS Protection: Cross-origin request protection
- β Authentication: Wallet-based authentication
- β Audit Logging: Comprehensive event logging
- Live bet activity
- Cross-chain transfer status
- User leaderboard rankings
- Platform statistics
// Bet Events
'bet:created' - New bet created
'bet:joined' - User joined bet
'bet:resolved' - Bet resolved
// Payout Events
'payout:intent:created' - Payout intent created
'payout:completed' - Payout completed
// Leaderboard Events
'leaderboard:update' - Leaderboard updatedcd Blockchain
npm test
npm run test:coveragecd Backend
npm testcd Frontend
npm test# Deploy smart contracts to Celo Sepolia
cd Blockchain && npm run mango:deploy-all
# Deploy backend
cd Backend && npm run build && npm start
# Deploy frontend
cd Frontend && npm run build && npm start# Backend
MONGODB_URI=mongodb://localhost:27017/mango-tree
RPC_URL=https://forno.celo-sepolia.celo-testnet.org
PRIVATE_KEY=your_private_key
INTENT_ROUTER_ADDRESS=0x0CFe46e97865ece06b0CfaD2CB8069833399986a
BET_CONTRACT_ADDRESS=0x9c4Ab9bdb97342A31cf0e2632610957cF633978C
# Frontend
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_WS_URL=ws://localhost:5000
NEXT_PUBLIC_CHAIN_ID=11142220
NEXT_PUBLIC_BET_CONTRACT=0x9c4Ab9bdb97342A31cf0e2632610957cF633978C
# Blockchain
PRIVATE_KEY=your_private_key
CELO_RPC_URL=https://forno.celo-sepolia.celo-testnet.org
CELOSCAN_API_KEY=your_celoscan_key- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: docs.mango-tree.com
- Discord: discord.gg/mango-tree
- Twitter: @MangoTreeBet
- Email: [email protected]
- Celo - Blockchain platform
- Axelar - Cross-chain infrastructure
- OpenZeppelin - Smart contract libraries
- Next.js - React framework
- Wagmi - React hooks for Ethereum
Decentralized betting for the future of gaming π²π³