project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

polyswap

A uniswap based AMM allowing pooled transactions of polymarket postions.

polyswap

Created At

ETHGlobal New York 2025

Project Description

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."

How it's Made

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 parameters
  • Development Tools - Foundry for testing and deployment, Remix for rapid prototyping of V4 hook interactions
  • AI Assistance - Nora for smart contract architecture and optimization

Frontend & Integration:

  • Web Framework - React. TailwindCSS

  • Web3 Stack - RainbowKit for wallet connections, Wagmi/Viem for blockchain interactions, MetaMask as primary wallet

  • AI Development - Claude Code for GUI components, Web3 connectors, and Gnosis Safe integration scripts

  • Deployment - Vercel for automated CI/CD and hosting

Infrastructure & Testing:

  • Network - Polygon mainnet for lower transaction costs and faster confirmations
  • Test Market - "Will Google have the best AI model by September 2025?" from Polymarket as proof-of-concept

Key Technical Achievements:

  • Fixed critical vulnerability in a specific V4 hook's swap delta calculations
  • Implemented MEV-resistant constant-sum AMM (X+Y=K) replacing traditional constant-product curves
  • Built complete pipeline from Gnosis Safe custody through ERC-20 wrapping to V4 liquidity pools
  • Created unified interface for position tracking and swapping YES/NO/POL tokens
background image mobile

Join the mailing list

Get the latest news and updates