Agentropolis

A city-builder where AI agents debate DeFi strategies and execute trades on Uniswap v4 hooks.

Agentropolis

Created At

HackMoney 2026

Winner of

Yellow

Yellow - Integrate Yellow SDK: Trading apps/Prediction markets/Marketplaces 1st place

ENS

ENS - Integrate ENS

Prize Pool

Project Description

Agentropolis is a gamified DeFi trading platform where you build a cyberpunk city, deploy AI agents, and let them debate your trading strategies before executing on-chain. You start by connecting your wallet and opening a Yellow Network state channel. From there you deploy agents into an isometric 3D city built with React Three Fiber. Each agent has a specialty: Alpha Hunter spots opportunities, Risk Sentinel flags dangers, Macro Oracle reads market conditions, Devil's Advocate pokes holes in plans, and Council Clerk synthesizes the final recommendation. When you want to trade, you enter the 3D Council Room and type a prompt like "Swap 10 USDC to ETH." All five agents deliberate in real time using Groq's Llama-3.3-70b, each contributing their perspective. The Council Clerk produces a final proposal with vote counts, risk level, and expected output. You approve or reject it. If approved, the swap executes on-chain through Uniswap v4's Universal Router on Base Sepolia. Three custom hooks enforce the council's decisions: CouncilFeeHook sets dynamic swap fees based on consensus, SwapGuardHook blocks trades exceeding the risk limit, and SentimentOracleHook records the council's market sentiment as an on-chain oracle. For identity, we use ENS text records. If you have an ENS name, the council reads your com.agentropolis.endpoint text record and auto-discovers your own custom agent API to include in deliberations. Agents are also discoverable on-chain through an ERC-8004 Agent Registry deployed on Base Sepolia. The in-game marketplace queries this registry to list agents with their metadata, strategy type, and reputation scores.

How it's Made

Agentropolis is a Turborepo monorepo with two packages: a Next.js 14 frontend and a Foundry smart contract suite, plus a shared types package. The frontend is entirely 3D. We used React Three Fiber and Drei to build the isometric city view and the council room. The city has procedurally placed buildings, walking agents that collect coins, and limit order towers that visually represent pending trades. Everything is styled with a custom Tailwind CSS cyberpunk design system (dark backgrounds, neon yellow/cyan/magenta accents, monospace fonts, uppercase tracking). For the AI layer, we hit Groq's API with Llama-3.3-70b. Each of the five agents gets a unique system prompt with a distinct personality and risk profile. The council API endpoint streams all five opinions, detects the user's intent (swap vs. DCA vs. risk check), and the Council Clerk agent synthesizes a final trade proposal with token addresses, amounts, and strategy type. On the smart contract side, we wrote three Uniswap v4 hooks in Solidity, all deployed on Base Sepolia:

  • CouncilFeeHook overrides LP fees in beforeSwap based on a value the council relayer sets after each deliberation.
  • SwapGuardHook reverts any swap exceeding the maxSwapSize that the Risk Sentinel sets.
  • SentimentOracleHook records market sentiment scores as an on-chain oracle in afterSwap, readable by other contracts.

Swaps execute through Uniswap v4's Universal Router using the Permit2 approval pattern. We build the execution plan client-side with viem and submit it from the user's wallet.

For Yellow Network, we integrated their @erc7824/nitrolite SDK. The app opens a real WebSocket to their clearnet sandbox, creates an app session with signed state channel messages, and charges micro-amounts for in-game actions like deploying agents. On session close, it settles the final balance on-chain.

For ENS, the council API resolves the user's ENS name on Ethereum Sepolia and reads com.agentropolis.endpoint, com.agentropolis.risk, and com.agentropolis.tokens text records. If an endpoint is found, the council actually fetches it and includes that external agent's opinion in the deliberation.

We also deployed an ERC-8004 Agent Registry contract on Base Sepolia. The in-game marketplace queries it using a binary-search ownerOf fallback (to work around Alchemy's free-tier getLogs limitations) and displays registered agents with their on-chain metadata.

background image mobile

Join the mailing list

Get the latest news and updates