A fully onchain multiplayer strategy game built as a Farcaster Mini App on Base. Claim territory, harvest resources, battle for supremacy, and earn $TOMO tokens through innovative DeFi-gaming integration!
- Territory Claiming: Claim tiles on a shared onchain game map
- Resource Harvesting: Collect resources from your claimed territories
- Strategic Battles: Engage in tactical combat with other players
- Onchain Assets: All game assets are stored on Base blockchain
- Wallet Integration: Connect with MetaMask, Coinbase Wallet, WalletConnect
- Farcaster Native: Built as a Mini App for seamless Farcaster experience
Cast Colony is powered by Tomo-Labs revolutionary DeFi infrastructure that transforms traditional yield farming into an exciting lottery-based system:
- Advanced Aggregation: Liquidity sourced across multiple DEXs for optimal pricing
- Uniswap V4 Hooks: Custom logic layer built on Uniswap V4 infrastructure
- ZK Proof Layer: Zero-knowledge proofs ensure privacy, efficiency, and fairness
- Gamified Returns: Instead of traditional APY, users receive lottery tickets
- Real Yield: Pool generates actual yield from cross-DEX arbitrage and trading fees
- Prize Distribution: Yield distributed as lottery prizes creating excitement and bigger potential wins
- Dual Incentive: Gaming rewards + DeFi yield opportunities in one ecosystem
- Stablecoin Purchases: Buy $TOMO with USDC, USDT, ETH
- Automatic Lottery Entry: Every $TOMO purchase generates lottery tickets
- Game Integration: Use $TOMO for all Cast Colony game actions
- Yield Participation: Token holders automatically participate in lottery yield distribution
This creates the first truly gamified DeFi experience where gaming meets yield farming! 🚀
- Frontend: Next.js 16 with React 19
- Styling: Tailwind CSS v4
- Blockchain: Base (Ethereum L2)
- DeFi Layer: Tomo-Labs Cross DEX Liquidity with ZK Proofs
- DEX Integration: Uniswap V4 Hooks
- Web3: Wagmi v2, Viem, RainbowKit
- Platform: Farcaster Mini App SDK
- Language: TypeScript
- Node.js 18+
- npm or yarn
- Clone the repository:
git clone <your-repo-url>
cd cast-colony- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env
# Add your WalletConnect Project ID and other config- Run the development server:
npm run dev- Open http://localhost:3000 to see the game
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
Cast Colony is built as a Farcaster Mini App with:
- Manifest: Located at
/.well-known/farcaster.json - SDK Integration: Automatic initialization and splash screen handling
- Embed Support: Rich previews when shared in casts
- Mobile Optimized: Touch-friendly interface for mobile gameplay
src/
├── app/ # Next.js app router
├── components/ # React components
│ ├── FarcasterSDK.tsx # Farcaster Mini App integration
│ ├── GameMap.tsx # Main game map component
│ ├── WalletConnection.tsx # Web3 wallet integration
│ ├── BuyGemsModal.tsx # GEMS purchase interface
│ └── ...
├── context/ # React context providers
├── hooks/ # Custom React hooks
│ ├── useGameIntegration.ts # Game state & Web3 integration
│ └── useWeb3Contracts.ts # Smart contract interactions
├── contracts/ # Contract addresses and ABIs
└── types/ # TypeScript type definitions
public/
├── .well-known/
│ └── farcaster.json # Farcaster Mini App manifest
└── assets/ # Game assets and icons
- Cross DEX Liquidity Pool: Advanced liquidity aggregation across multiple DEXs
- Uniswap V4 Hooks: Custom logic layer built on Uniswap V4 infrastructure
- ZK Proof Layer: Zero-knowledge proofs ensure privacy and efficiency
- Lottery-Based Yield: Purchase $TOMO with USDC/USDT and receive lottery tickets
- Gamified Returns: Pool yield distributed as lottery prizes instead of traditional APY
- Dual Incentive: Gaming rewards + DeFi yield opportunities in one ecosystem
- Buy $TOMO tokens with stablecoins (USDC, USDT, ETH)
- Use $TOMO for all game actions (claiming, battling, upgrades)
- Every $TOMO purchase generates lottery entries for yield distribution
- Cross-DEX arbitrage generates real yield for lottery prize pool
- Claim tiles on the shared game map using $TOMO
- Each tile has different resource generation rates
- Claimed tiles generate resources over time
- All territory ownership stored onchain
- Multiple resource types with different utilities
- Harvest resources from your claimed territories
- Strategic resource allocation affects gameplay
- Resources used for upgrades and battles
- Turn-based tactical combat using $TOMO
- Territory control influences battle outcomes
- Risk/reward mechanics for aggressive expansion
- Battle results recorded onchain
- Connect wallet to play (MetaMask, Coinbase, WalletConnect)
- All game actions are blockchain transactions
- Real ownership of territories and resources
- Transparent, verifiable game state
Required environment variables:
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_key
NEXT_PUBLIC_CONTRACT_ADDRESS=deployed_contract_address- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy with default Next.js settings
- Ensure
vercel.jsonredirect is working
- Deploy to a public URL
- Verify
/.well-known/farcaster.jsonredirects to hosted manifest - Test Mini App functionality in Farcaster
- Submit to Farcaster Mini App directory
- Deploy game contracts to Base network
- Update contract addresses in
src/contracts/addresses.js - Verify contracts on BaseScan
- Test all contract interactions
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.