Uniswap v2
Uniswap v2: Your Complete Guide to Swaps, Liquidity, and Fees
Uniswap v2 is a decentralized exchange (DEX) protocol that makes it simple to swap ERC-20 tokens directly from your wallet—no order books, no accounts, no custodians. Built on Ethereum and powered by an automated market maker (AMM), Uniswap v2 allows anyone to provide liquidity, earn fees, and trade permissionlessly. Whether you’re a curious beginner or a DeFi native, this guide shows you how Uniswap v2 works, how to use it safely, and when it might be the right choice compared to other versions.
Why Uniswap v2 still matters: clear AMM design, reliable ERC-20 to ERC-20 routing, robust price oracles (TWAP), and flash swaps—all in a familiar, open-source stack trusted across DeFi.
Trade with clarity. Provide liquidity with confidence. Own every move—on Uniswap v2.
What Is Uniswap v2?
Uniswap v2 is the second major iteration of the Uniswap protocol. It introduced direct ERC-20 to ERC-20 pools (no ETH intermediary needed), improved price oracles, and the ability to execute flash swaps—borrowing tokens within a single transaction if they’re repaid by end-of-tx. Its design remains elegantly simple: two-token pools, a constant product formula, and permissionless participation that has powered thousands of token markets.
Core Architecture: Factory, Pair, Router
Under the hood, Factory contracts deploy new Pair contracts (liquidity pools) for any token pair. The Router smart contract directs your swap across one or multiple pairs to get you the tokens you want. Liquidity providers (LPs) deposit equal values of two tokens into a pair and receive LP tokens that represent their share of the pool, along with a claim on trading fees.
The AMM Formula: x × y = k
Every pair follows the constant product market maker model: the product of reserves stays constant during swaps. As one token is bought, its price rises relative to the other. Arbitrage traders help keep pool prices aligned with the broader market. This elegant mechanic delivers 24/7 liquidity without centralized market makers or order books.
Key Features of Uniswap v2
- ✅ ERC-20 to ERC-20 pools without routing through ETH.
- ✅ 0.30% swap fee shared pro-rata with liquidity providers.
- ✅ Time-Weighted Average Price (TWAP) oracles for safer on-chain pricing.
- ✅ Flash swaps let you borrow tokens in a single transaction if repaid by end-of-tx.
- ✅ Permissionless: launch pools, provide liquidity, or trade—no approvals needed.
- ✅ Composable: easily integrates with DeFi apps, wallets, and on-chain strategies.
How to Use Uniswap v2 (Step-by-Step)
Getting started is straightforward. You’ll need an Ethereum-compatible wallet (e.g., MetaMask), some ETH for gas, and the ERC-20 tokens you want to swap or supply as liquidity. Follow these steps to avoid common pitfalls and execute smooth trades.
- Connect your wallet: Visit the Uniswap interface that still supports v2 routing and connect your wallet securely.
- Select tokens: Choose the token you’re selling and the token you want to buy. Double-check contract addresses to avoid fake tokens.
- Set slippage tolerance: In settings, choose a slippage that balances execution and safety (e.g., 0.1%–1% for liquid pairs).
- Review route and price impact: Verify the expected output and Price Impact. High impact suggests low liquidity.
- Consider gas: Network congestion affects speed and cost. Pick a gas setting that fits your urgency.
- Confirm the swap: Approve the token (first time only), then confirm the swap and wait for confirmation.
- Track the transaction: View status on a block explorer and keep a record for your portfolio tracking or taxes.
Fees, Gas, and Slippage on Uniswap v2
Uniswap v2 charges a 0.30% swap fee that accrues to LPs. A protocol fee switch (if enabled by governance) can redirect a portion (e.g., 0.05%) to the protocol, but historically it has been off. You’ll also pay Ethereum gas fees, which vary with network demand. To protect your trade, set an appropriate slippage tolerance—too low may cause failures; too high risks poor execution during volatile moves.
Impermanent Loss and LP Rewards
Liquidity providers earn a share of fees proportional to their pool share. However, they are exposed to impermanent loss when token prices diverge. If the fee revenue doesn’t offset this divergence, LPs can underperform simply holding. Many LPs manage this by choosing pairs with strong organic volume or correlated assets, and by actively monitoring pool performance.
Risks and How to Stay Safe
- ★ Smart contract risk: Uniswap v2 is audited and battle-tested, but risk can never be zero.
- ★ Fake or misleading tokens: Always verify contract addresses from official sources.
- ★ MEV and sandwich attacks: Use reasonable slippage and consider routing tools that mitigate MEV.
- ★ High volatility: During spikes, execution may vary; consider limit orders via integrated tools if available.
- ★ Impermanent loss for LPs: Understand the trade-off between fees earned and price divergence.
Pro tip: For new tokens, start with small test trades, confirm liquidity depth, and watch price impact before scaling position size.
Uniswap v2 vs v3 vs v1: Which Should You Use?
Each version serves different needs. Uniswap v2 offers straightforward pools and predictable behavior. Uniswap v3 introduces concentrated liquidity for greater capital efficiency and multiple fee tiers, but requires more active management. v1 is legacy. Use the comparison below to decide what’s best for your trade or liquidity strategy.
| Feature | Uniswap v1 | Uniswap v2 | Uniswap v3 |
|---|---|---|---|
| Token Routing | ETH ⇄ ERC-20 only | Direct ERC-20 ⇄ ERC-20 | Direct ERC-20 ⇄ ERC-20 |
| Fee Structure | 0.30% | 0.30% | Multiple tiers (e.g., 0.05%, 0.30%, 1%) |
| Liquidity Model | Constant product | Constant product | Concentrated liquidity ranges |
| Capital Efficiency | Low | Moderate | High (active management) |
| Price Oracles | Basic | TWAP oracles | Advanced TWAP, observations |
| Flash Swaps | No | Yes | Via integrations |
| Complexity | Low | Low–Moderate | Higher (LP range management) |
If you value simplicity and broad DeFi compatibility, Uniswap v2 remains a strong choice. If you’re optimizing for capital efficiency and can actively manage LP positions, v3 may deliver better results.
For Builders: Integrating Uniswap v2
Developers can leverage Router02 for routing, Factory for pair discovery, and Pair contracts for reserve reads and swaps. The v2 SDKs and community-maintained libraries simplify quoting, routing, and transaction building. Popular use cases include in-app swaps, on-chain rebalancing, arbitrage strategies, leveraged yield workflows, and oracle-powered automations using TWAP.
Flash Swaps and Composability
With flash swaps, you can borrow tokens from a v2 pool, execute custom logic, then repay within the same transaction. This unlocks advanced workflows like collateral swaps, liquidations, and arbitrage—without upfront capital. Because Uniswap v2 is highly composable, it plugs into lending markets, vaults, and structured products across DeFi.
Best Practices for Traders and LPs
- ✅ Verify tokens: Use official contract addresses from trusted sources.
- ✅ Mind slippage: Set limits and avoid thin liquidity pairs for larger trades.
- ✅ Watch gas: Execute during off-peak times to reduce costs.
- ✅ Test small first: Especially with new tokens or volatile conditions.
- ✅ LP prudently: Choose pairs with sustainable volume and understand IL risk.
- ✅ Diversify tools: Consider MEV-protected routing and portfolio trackers.
Frequently Asked Questions about Uniswap v2
What is Uniswap v2 in simple terms?
Uniswap v2 is a decentralized exchange where anyone can swap ERC-20 tokens or provide liquidity to earn fees. It uses an automated market maker model instead of order books, enabling 24/7 permissionless trading directly from your crypto wallet.
How is Uniswap v2 different from Uniswap v3?
Uniswap v2 offers classic two-token pools and a flat 0.30% fee. Uniswap v3 introduces concentrated liquidity and multiple fee tiers for better capital efficiency, but LPs must actively manage their price ranges. Traders may find v2 simpler; active LPs may prefer v3.
What fees will I pay on Uniswap v2?
You’ll pay a 0.30% swap fee that goes to liquidity providers and an Ethereum gas fee to process the transaction. A protocol fee switch may be enabled by governance but is historically off; check current settings for any changes.
What is impermanent loss for liquidity providers?
Impermanent loss occurs when the price of your pooled tokens diverges compared to simply holding them. If the fee income you earn doesn’t offset that divergence, your LP position can be worth less than a hold-only strategy. It can shrink or vanish if prices revert and fees accumulate.
How do I reduce slippage on Uniswap v2?
Trade in more liquid pairs, split large orders, set a lower slippage tolerance, and avoid periods of extreme volatility or high gas congestion. Using routing that mitigates MEV can also help you avoid sandwich attacks and improve execution quality.
Are flash swaps risky?
Flash swaps are a powerful developer tool that lets you borrow assets within a single transaction. The risk lies in your custom logic—if repayment conditions aren’t met by end-of-transaction, the whole transaction reverts. Smart contract testing and audits are essential.
Do I need UNI to use Uniswap v2?
No. You can trade on Uniswap v2 without holding UNI. UNI is a governance token that may be used for protocol decisions, but it isn’t required for swapping or providing liquidity.
Ready to experience seamless DeFi? Swap, pool, or build with confidence on Uniswap v2—where permissionless liquidity powers every move. Make your first trade today.