Uniswap v2

Uniswap v2: The Essential Guide to the Classic AMM

Uniswap v2 is the DeFi workhorse that put permissionless token swaps on the map. Fast, non-custodial, and open-source, it pioneered on-chain markets for long-tail ERC-20 assets and created new ways to trade, earn fees, and build protocols. This guide breaks down how Uniswap v2 works, what makes it unique, where it shines versus newer versions, and how to use it confidently—whether you’re swapping, providing liquidity, or integrating into your app.



How Uniswap v2 Works

At its core, Uniswap v2 is an automated market maker (AMM) built on Ethereum. Instead of a traditional order book, prices are determined by a simple yet powerful formula and liquidity provided by users. You trade directly from your wallet, no signups, and no custodians—just transparent, on-chain swaps of ERC-20 tokens.

The Constant Product AMM (x*y = k)

Uniswap v2 uses the constant product formula, balancing two token reserves in a pool so their product remains constant. When a user swaps one token for another, the relative prices shift based on pool depth, ensuring continuous liquidity at algorithmic prices. Larger trades cause more price impact, while deeper pools minimize slippage for traders.

Liquidity Pools and LP Tokens

Each market is an ERC-20/ERC-20 pair (e.g., DAI/ETH). Liquidity providers (LPs) deposit equal values of both assets and receive LP tokens that represent their share of the pool. Trading fees (typically 0.30%) accrue to LPs in proportion to their share. When LPs withdraw, they burn LP tokens to redeem their underlying assets plus earned fees.

Routing, Pairs, and Composability

Swaps can route through multiple pairs to find the best path—helpful when direct liquidity is thin. Uniswap v2’s simple, immutable contracts make it easy for other protocols to integrate. From lending markets to yield aggregators, this composability is a key reason v2 still powers DeFi behind the scenes.



Key Features of Uniswap v2

  • Permissionless access: Anyone can list a token, create a pool, and trade—no gatekeepers.
  • ERC-20 to ERC-20 pairs: Direct token-to-token swaps without routing through ETH by default.
  • Flash swaps: Borrow tokens from a pool within one transaction, repay by end-of-tx or revert.
  • TWAP oracles: Built-in time-weighted average price mechanisms for safer on-chain pricing.
  • Non-custodial: You keep control of your funds; trades happen from your wallet.
  • Open-source & battle-tested: Transparent contracts with extensive real-world usage.
  • Composability: Integrates easily with wallets, dApps, and DeFi protocols.
Quick take: Uniswap v2 remains a reliable, permissionless DEX for long-tail tokens, on-chain oracles, and simple liquidity provisioning—ideal when you want predictable, familiar mechanics.


Benefits for Traders and Liquidity Providers

For Traders

  • Wide token access: Discover early-stage and niche ERC-20 assets.
  • Wallet-native swaps: Trade straight from your self-custody wallet.
  • Transparent pricing: View pool depth, slippage, and fees on-chain.
  • Censorship resistance: Open liquidity that anyone can use globally.

For Liquidity Providers

  • Earn trading fees: Capture a share of every trade in your pool.
  • Composability yields: Use LP tokens in other DeFi protocols for additional strategies.
  • Permissionless market-making: Seed liquidity for new or under-served markets.


Risks and Considerations on Uniswap v2

  • Impermanent loss: Price divergence between paired assets can reduce LP value versus holding.
  • Slippage & price impact: Large trades in shallow pools face worse execution.
  • Gas fees: Network congestion can make small trades uneconomical on L1.
  • MEV and frontrunning: On-chain transactions can be reordered by miners/validators.
  • Token risks: Illiquid or malicious tokens, taxes/transfer fees, or poorly designed contracts.
  • Smart contract risk: While audited and battle-tested, risk cannot be zero.

Tip: Manage risk with smaller trades, slippage limits, reputable tokens, and careful LP allocation.



Uniswap v2 vs v1 vs v3: What’s Different?

Uniswap v3 introduced concentrated liquidity and multiple fee tiers for capital efficiency, while v2 offers simplicity and predictable behavior. If you value granular control and deeper liquidity, v3 may fit. If you want straightforward pools and battle-tested contracts, Uniswap v2 remains a strong choice.

Feature Uniswap v1 Uniswap v2 Uniswap v3
Pair Type ETH/ERC-20 ERC-20/ERC-20 ERC-20/ERC-20
Fees 0.30% 0.30% Multiple tiers (e.g., 0.01%–1%)
Liquidity Passive, full range Passive, full range Concentrated, custom ranges
Oracles None Built-in TWAP Advanced TWAP
Flash Swaps No Yes Yes
Capital Efficiency Low Low–Medium High
Complexity Low Low Medium–High


Getting Started on Uniswap v2

For Traders: Swap in Minutes

  1. Connect a web3 wallet (e.g., MetaMask, Coinbase Wallet) on Ethereum.
  2. Select the token pair and input the amount to swap.
  3. Review slippage tolerance and minimum received.
  4. Confirm the transaction and wait for on-chain finality.

For Liquidity Providers: Add Liquidity

  1. Choose a pair and deposit equal value of both tokens.
  2. Receive LP tokens representing your pool share.
  3. Accrue 0.30% fees from trades in your pool.
  4. Remove liquidity anytime by burning LP tokens.

Note: Consider volatility and potential impermanent loss before providing liquidity.



Pro Tips to Trade Smarter on Uniswap v2

  • Set slippage carefully: Tighten for stable pairs; allow more for volatile, low-liquidity tokens.
  • Check pool depth: Use analytics to gauge liquidity and expected price impact.
  • Batch actions when possible: Reduce gas costs by minimizing approvals and transactions.
  • Beware of honeypots/taxes: Verify transfer taxes and token permissions before swapping.
  • Use routing: Sometimes multi-hop paths deliver better execution than direct pairs.


Popular Uniswap v2 Use Cases

  • 🔄 Arbitrage: Balance prices across DEXs by capturing temporary spreads.
  • 🌱 Bootstrapping new markets: Seed liquidity for fresh token launches and community tokens.
  • 🧱 DeFi legos: Integrate v2 pools and oracles into lending, vaults, and structured products.
  • 🧪 Strategy testing: Prototype AMM strategies using familiar, immutable contracts.


Security and Best Practices

  • 🔐 Self-custody: Keep your seed phrase offline; verify official URLs and contract addresses.
  • 🧪 Token diligence: Check audits, holders, and on-chain history before adding liquidity.
  • 🧮 Fee math: Model potential earnings versus impermanent loss scenarios.
  • 🕒 Transaction timing: Avoid volatile gas spikes; confirm nonce and gas limits.
  • 🧰 Use analytics: Monitor pool APRs, volumes, and price ranges for better decisions.


Uniswap v2 for Builders and Integrators

Developers can integrate Uniswap v2 via the Router, Factory, and pair contracts, or leverage SDKs and subgraphs. The TWAP oracle provides time-averaged prices; flash swaps enable capital-efficient operations; and immutable pools simplify audits and long-term integrations. Many apps still rely on v2 for predictable behavior and broad pair coverage.

“Open liquidity creates open opportunity. With Uniswap v2, the market is always on—and it’s yours to build with.”


Frequently Asked Questions about Uniswap v2

What is Uniswap v2 in simple terms?

Uniswap v2 is a decentralized exchange where liquidity pools set prices algorithmically. You swap ERC-20 tokens directly from your wallet, while LPs earn fees by depositing token pairs into pools.

How are prices determined on Uniswap v2?

Prices follow the constant product formula x*y=k. Swaps change the token balances in a pool, which shifts the exchange rate. Larger trades relative to pool size cause more price impact and slippage.

What fees does Uniswap v2 charge?

Each trade typically pays a 0.30% fee that goes to liquidity providers. Additional network gas fees are paid to Ethereum validators to confirm your transaction.

What is impermanent loss for LPs?

Impermanent loss occurs when the price of tokens in a pool diverges from the price at the time of deposit. The rebalancing of pool assets can result in lower value compared to simply holding the tokens.

Does Uniswap v2 have oracles?

Yes. Uniswap v2 introduced time-weighted average price (TWAP) oracles that protocols can use to read averaged on-chain prices, reducing the impact of short-term volatility.

What are flash swaps on Uniswap v2?

Flash swaps let you withdraw tokens from a pool and use them within the same transaction, provided you return them (or the equivalent value) by the end of the transaction—otherwise the trade reverts.

Should I use Uniswap v2 or v3?

Choose v2 for simplicity, predictable fees, and broad pair coverage. Choose v3 for capital efficiency and advanced LP controls. Many users and protocols utilize both, depending on strategy and liquidity.



Ready to explore Uniswap v2? Connect your wallet, compare pools, and start swapping or providing liquidity with confidence. Trade smarter—permissionless, transparent, and on-chain.