A fully decentralized fantasy sports platform built for EVM with Chainlink Functions for trustless score oracle and settlement.
- Create Contests — Anyone can create a fantasy contest for any cricket match
- Join & Submit Teams — Pick 11 players, captain (2×), vice-captain (1.5×)
- Automatic Settlement — Chainlink fetches scores and calculates winners off-chain
- Decentralized Prizes — Top 3 or Top 10 winners split the pool
- Gas Optimized — Batch operations, compressed contracts, <24KB each
- Scalable — Handles 600+ participants per contest
┌──────────────────────────────────────────────────┐
│ Chain11.sol (22KB) │
│ • Contest management │
│ • Team validation (batched) │
│ • Prize distribution │
└───────────────────┬──────────────────────────────┘
│
▼ calls
┌──────────────────────────────────────────────────┐
│ Chain11Oracle.sol (19KB) │
│ • Chainlink Functions integration │
│ • Match initialization (squad data) │
│ • Score fetching (fantasy points) │
│ • Settlement calculation (off-chain) │
└───────────────────┬──────────────────────────────┘
│
▼ requests
┌──────────────────────────────────────────────────┐
│ Chainlink DON │
│ • Fetches match data from Cricket API │
│ • Fetches final scores │
│ • Calculates winners (batched RPC calls) │
│ • Returns top K winners │
└──────────────────────────────────────────────────┘
node >= 18.0.0
npm >= 9.0.0# Clone repository
git clone https://github.com/DaevMithran/chain11.git
cd chain11
# Install dependencies
npm install
# Copy environment template
cp .env.example .env# .env
PRIVATE_KEY= # Deployer wallet private key
BASE_RPC_URL=https://mainnet.base.org # Base mainnet RPC
BASESCAN_API_KEY= # For contract verification
# Chainlink Functions
CHAINLINK_ROUTER_ADDRESS=0xf9B8fc078197181C841c296C876945aaa425B278
CHAINLINK_DON_ID=0x66756e2d626173652d6d61696e6e65742d310000000000000000000000000000
CHAINLINK_SUBSCRIPTION_ID= # Your Chainlink subscription ID
# Contract addresses (set after deployment)
ORACLE_ADDRESS=
CORE_ADDRESS=npx hardhat compile# All tests
npx hardhat test
# With gas reporting
REPORT_GAS=true npx hardhat test# Create Chainlink subscription first:
# https://functions.chain.link (Base Sepolia)
# Deploy Oracle
npx hardhat run scripts/deploy-oracle.ts --network base-sepolia
# Deploy Core
export ORACLE_ADDRESS=0x...
npx hardhat run scripts/deploy-core.ts --network base-sepolia
# Link contracts
export CORE_ADDRESS=0x...
npx hardhat run scripts/link-contracts.ts --network base-sepolianpx hardhat verify --network base-sepolia $ORACLE_ADDRESS \
$CHAINLINK_ROUTER_ADDRESS \
$CHAINLINK_DON_ID \
$CHAINLINK_SUBSCRIPTION_ID
npx hardhat verify --network base-sepolia $CORE_ADDRESS \
$ORACLE_ADDRESSExpected gas costs:
- Create contest:
200k gas ($0.04) - Join & submit team:
59k gas ($0.01) — optimized with batch validation - Settlement:
300k gas ($0.06) — constant, regardless of participants
Contest creation: 0.01 ETH
Team entry: 0.01 ETH
Platform fee: 10% of all entries
3-9 participants (Top 3):
1st: 50% | 2nd: 30% | 3rd: 20%
10+ participants (Top 10):
1st: 30% | 2nd: 15% | 3rd: 10% | Ranks 4-10: 5% each
Match initialization: ~0.3 LINK (~$1.50)
Score fetching: ~0.3 LINK (~$1.50)
Settlement: ~0.3 LINK (~$1.50)
Total: ~0.9 LINK (~$4.50)
| Category | Tool | Version | Purpose |
|---|---|---|---|
| Language | Solidity | 0.8.28 | Smart contracts |
| Framework | Hardhat | 2.22+ | Development environment |
| Library | Viem | 2.x | Contract interactions |
| Oracle | Chainlink Functions | 1.0.0 | Off-chain data & compute |
| Build | Terser | Latest | JS minification |
| Optimizer | Via IR | Built-in | Code optimization |
MIT License - see LICENSE for details.
- Core contract implementation
- Chainlink Functions integration
- Test suite
- Frontend dApp (React)
- Mobile app (React Native)
- Multi-sport support