SpiceTraders
Spice Traders: On-chain space trading game with mining, ship management & Uniswap V4 DEX integration
Problem Statement
This project combines a comprehensive blockchain-based space trading game with DeFi infrastructure to create an immersive on-chain gaming experience. Players mine resources, manage fleets of NFT ships, and trade on planet-specific markets powered by Uniswap V4.Core Gameplay:Resource Mining System: Players mine 4 resource types (Metal, Sapho Juice, Water, Spice) across 5 unique planets using Pyth Entropy for verifiable randomnessShip Management: Own and manage NFT ships with different classes, cargo capacities, and fuel systemsInterplanetary Travel: Navigate 3D space using spice as fuel, with travel costs based on actual distance calculationsPlanet-Specific Trading: Trade resources on 20 unique trading pairs (4 resources × 5 planets) using Uniswap V4 AMMTechnical Innovation:Uniswap V4 Integration: Custom hooks create planet-specific markets that promote arbitrage opportunities - players must physically travel to different planets to access their unique trading ratesPyth Entropy Integration: Verifiable randomness for fair mining outcomesResource Wrapping: Seamless conversion between ERC1155 resources and ERC20 wrapped tokens for tradingGas-Optimized Contracts: Packed structs and efficient state managementSmart Contract System:World.sol: Planet management and travel cost calculationsPlayer.sol: Player state and ship management with packed structs for gas efficiencyShips.sol: ERC721 ship NFTs with customizable attributesMarket.sol: Uniswap V4 integration with automatic token wrapping/unwrappingMining.sol: Pyth Entropy-powered resource extraction with planet-specific difficultyFrontend Features:Next.js 15 with TypeScript and Tailwind CSSReal-time trading quotes and market dataMobile-responsive UI with ConnectKit wallet integrationFleet management interface with ship switching and refuelingComprehensive HUD showing resources, location, and ship statusEconomic Design:Strategic resource management with spice as the primary fuelPlanet specialization creating unique trading opportunitiesShip fleet building with different classes for various playstylesSustainable tokenomics with supply caps and fee structuresThe project demonstrates how advanced DeFi protocols can enhance gaming through verifiable randomness, decentralized trading, and location-based restrictions while maintaining engaging gameplay loops. It's deployed on Base mainnet with full Uniswap V4 integration.
Solution
This project uses Uniswap V4 for the decentralized trading infrastructure and Pyth Network for verifiable randomness in the mining system. The frontend is built with Next.js 15, TypeScript, and Tailwind CSS, while the smart contracts are developed using Foundry and Solidity. I integrated Uniswap V4's custom hooks to create planet-specific trading markets that require physical travel between planets to access different trading rates, promoting arbitrage opportunities. Pyth Entropy provides cryptographically secure randomness for fair resource mining outcomes across different planets. The project uses OpenZeppelin's audited contract libraries for security and implements gas-optimized packed structs for efficient on-chain storage. The trading system automatically wraps ERC1155 resources into ERC20 tokens for Uniswap compatibility and unwraps them back after trades, creating a seamless user experience between the gaming and DeFi layers.
Hackathon
ETHGlobal New Delhi
2025
Contributors
- abhinavgkrishnan
28 contributions