Introduction
Uniswap is a decentralized exchange protocol that uses automated market maker (AMM) contracts to facilitate token trading on Ethereum and other EVM chains. Instead of matching buyers with sellers via an order book, liquidity providers deposit token pairs into pools, and traders swap against those pools at algorithmically determined prices. Uniswap pioneered the constant product AMM model.
What Uniswap Does
- Enables permissionless token swaps without registration, KYC, or centralized intermediaries
- Allows anyone to create liquidity pools for any ERC-20 token pair
- Provides concentrated liquidity (V3) so LPs can allocate capital within specific price ranges
- Routes trades across multiple pools for optimal pricing via the smart order router
- Supports multi-chain deployment on Ethereum, Arbitrum, Optimism, Polygon, Base, and others
Architecture Overview
Uniswap V3 core consists of Factory and Pool contracts. The Factory creates Pool contracts for each unique token pair and fee tier. Each Pool holds reserves of two tokens and uses a concentrated liquidity AMM where LPs specify price ranges for their positions as NFTs. The SwapRouter contract handles multi-hop trades across pools. A Quoter contract provides price quotes without executing transactions.
Self-Hosting & Configuration
- Deploy the open-source web interface locally by cloning the
interfacerepository - Use the Uniswap V3 SDK (
@uniswap/v3-sdk) to interact with pools programmatically - Integrate swap functionality via the Universal Router contract for batched operations
- Set up a local development environment with Hardhat forking mainnet state for testing
- Monitor pool positions and fees using the Uniswap subgraph on The Graph
Key Features
- Concentrated liquidity allows LPs to provide liquidity in specific price ranges for higher capital efficiency
- Multiple fee tiers (0.01%, 0.05%, 0.3%, 1%) let pools match volatility characteristics
- Non-fungible liquidity positions represented as NFTs with individual price range parameters
- Permissionless pool creation requires no approval to list new token pairs
- Oracle functionality with built-in time-weighted average price (TWAP) observations
Comparison with Similar Tools
- SushiSwap — forked from Uniswap V2 with additional features like yield farming; lacks V3 concentrated liquidity
- Curve — optimized for stablecoin and pegged-asset swaps with lower slippage; Uniswap covers all ERC-20 pairs
- Balancer — supports weighted pools with more than two tokens; Uniswap focuses on pair-based pools
- PancakeSwap — BNB Chain focused DEX; Uniswap is Ethereum-native with multi-chain expansion
- 1inch — DEX aggregator routing across multiple AMMs; Uniswap is a single protocol with its own liquidity
FAQ
Q: How do liquidity providers earn fees on Uniswap? A: LPs earn a share of the swap fee (set per pool tier) proportional to their liquidity within the active price range. Fees accrue in the pool and are collected when the position is modified.
Q: What is impermanent loss? A: When token prices change after depositing to a pool, the value of the LP position may be less than holding the tokens individually. Concentrated liquidity amplifies this effect within the chosen price range.
Q: Is the Uniswap protocol decentralized? A: Yes. The smart contracts are immutable and permissionless. The web interface is open source, and governance is managed by UNI token holders.
Q: What is the UNI token? A: UNI is the governance token that allows holders to vote on protocol parameters, fee switches, and treasury allocations.