← Back to home

1inchHunt

Swap to survive! An RPG where your hero levels up by completing real onchain swaps via 1inch.

Problem Statement

1inchHuntis a comprehensive DeFi gaming application that leverages multiple 1inch APIs to create an immersive trading experience. The application combines real-time market data, limit order functionality, and gamification elements to provide users with a unique way to interact with DeFi protocols.

Solution

🛠 How it's made We built SwapQuest using:Next.js 14 for frontend routing and structureTailwind CSS + framer-motion for clean RPG-styled UIWagmi + Viem for Web3 wallet interactions and transactions1inch REST APIs to:Fetch real-time prices (Price Feed API)Show wallet token balances (Wallet Balance API)Get token data as in-game items (Token Metadata API)Trigger real swaps via Fusion+, Classic, or Limit Order (Swap API)Framer Motion for smooth grid-based character movement and level-up animationsEmoji-based rendering for characters, enemies, and zones to keep it lightweightCustom key event handler to enable WASD or arrow-key movement in a grid-style RPG mapWe reused the Token Metadata and Wallet Balances to build a live inventory UI and track mission progress dynamically. Price data from 1inch was used to auto-generate smart quest objectives based on trending or volatile tokens.The hackiest part? Probably animating emoji characters across a grid using framer-motion while syncing Web3 state in real-time. Surprisingly fun.1inch API1. Real-Time Price ChartsAPI Used:https://api.1inch.dev/charts/v1.0/chart/line/{token0}/{token1}/{period}/{chainId}Implementation: Dynamic price charts with multiple timeframes (24H, 1W, 1M, 1Y, AllTime)Features:Live price updatesInteractive chart annotationsStart and current price displaysPrice change calculations2. Limit Order ManagementAPI Used:https://api.1inch.dev/orderbook/v4.0/{chain}/address/{address}Implementation: Complete limit order creation, signing, and submission systemFeatures:EIP-712 order signingReal-time order status trackingOrder history managementGas price optimization3. Token Information & PortfolioAPI Used:https://api.1inch.dev/token/v1.2/{chainId}/custom/{address}Implementation: Dynamic token data fetching and portfolio managementFeatures:Real-time token pricesToken metadata (symbol, logo, decimals)Portfolio value calculationsMulti-chain support4. Gas Price OptimizationAPI Used:https://api.1inch.dev/gas-price/v1.4/1Implementation: Real-time gas price monitoring for optimal transaction timingFeatures:Live gas price updatesTransaction cost estimationGas optimization recommendations🏗️Technical ArchitectureFrontend (Next.js + React)Framework: Next.js with TypeScriptStyling: Tailwind CSS with custom animationsState Management: React hooks with localStorage persistenceWallet Integration: Wagmi + RainbowKit for Ethereum connectivityBackend (Next.js API Routes)API Routes:/api/charts/price,/api/limit-orders/*,/api/token-infoAuthentication: 1inch API key managementData Processing: Real-time data transformation and cachingKey ComponentsChartPrice: Real-time price visualizationLimitOrders: Order management interfaceTokenSelector: Dynamic token selectionGasPrice: Live gas monitoringMissionProgress: Gamification tracking🎮Gamification FeaturesMission SystemSwap Mission: Basic token swapping with XP rewardsAdvanced Swap: Complex trading strategiesLimit Order Mission: Order creation and managementShare Mission: Social media integrationProgression SystemExperience Points: Earned through trading activitiesLevel System: 500 XP per level progressionCharacter Customization: Avatar and name selectionAchievement Tracking: Mission completion rewards

Hackathon

ETHGlobal Unite

2025

Contributors