MetaSwap: a full decentralised exchange
2026Web3
newA complete exchange stack: Solidity AMM contracts, an indexer and routing API, gasless signed orders filled by a bot, and a real-time trading app running on its own devnet.

Problem
Most DeFi portfolio projects stop at a swap form wired to someone else's contracts. I wanted to understand an exchange all the way down: the pool math, the routing, the signatures, the indexer and the interface people actually trade on.
Solution
MetaSwap is the whole stack in one monorepo. The contracts (Foundry) cover V2 and V3 liquidity pools, an NFT position manager, Permit2 approvals, a universal router and MetaSwapX, a reactor for gasless, signed Dutch-auction orders. A TypeScript API indexes the chain, prices every token in USD, builds candles, finds split routes across pools and runs a filler bot that executes MetaSwapX orders on-chain. The React app (wagmi, Tailwind) has swap, limit, send, explore, liquidity positions, portfolio, vaults and token launch auctions, all updating live over WebSocket. One command starts the MetaChain devnet, deploys everything, seeds 8 tokens and 13 pools and replays 30 days of trading so every chart has history, while a market simulator keeps prices moving.
Outcome
It runs as a complete exchange on a local chain with no real funds. The contracts carry 184 Foundry tests, and the API and web app have unit, integration and Playwright suites that make real swaps, split routes and order fills against the running stack. It is the project where I learned the most about how money actually moves on-chain.