← Back to home

polyswap

A uniswap based AMM allowing pooled transactions of polymarket postions.

Problem Statement

This project creates ERC-20 tokens from Polymarket ERC-1155 positions and deploys them to Uniswap. This converts polymarket into a permisionless, funglible and self-custodying protocol.The implementation includes tools for extracting positions from Gnosis Safe custody to EOA wallets, wrapping them as ERC-20s, and managing liquidity in the V4 hook. The frontend offers a position dashboard and swap interface supporting YES, NO, and POL tokens, tested with the 'Will Google have the best AI model by September 2025?' market."

Solution

Smart Contract Development:Uniswap V4 Hooks - Started with Saucepoint's constant-sum AMM implementation and fixed a critical bug in the beforeSwap return delta calculation that would have allowed contract draining. Reverted to univ3 due to difficulty with hook permissions on polygon, to be completed later.ERC-1155 to ERC-20 Wrapper - Adapted Gnosis's audited wrapper contracts for Polygon deployment, modifying gas optimizations and network-specific parametersDevelopment Tools - Foundry for testing and deployment, Remix for rapid prototyping of V4 hook interactionsAI Assistance - Nora for smart contract architecture and optimizationFrontend & Integration:Web Framework - React. TailwindCSSWeb3 Stack - RainbowKit for wallet connections, Wagmi/Viem for blockchain interactions, MetaMask as primary walletAI Development - Claude Code for GUI components, Web3 connectors, and Gnosis Safe integration scriptsDeployment - Vercel for automated CI/CD and hostingInfrastructure & Testing:Network - Polygon mainnet for lower transaction costs and faster confirmationsTest Market - "Will Google have the best AI model by September 2025?" from Polymarket as proof-of-conceptKey Technical Achievements:Fixed critical vulnerability in a specific V4 hook's swap delta calculationsImplemented MEV-resistant constant-sum AMM (X+Y=K) replacing traditional constant-product curvesBuilt complete pipeline from Gnosis Safe custody through ERC-20 wrapping to V4 liquidity poolsCreated unified interface for position tracking and swapping YES/NO/POL tokens

Hackathon

ETHGlobal New York 2025

2025

Contributors