Uniswap v4

Uniswap v4 Explained: Singleton Architecture, Hooks, and What Changed from v3

Uniswap has long been the most dominant decentralized exchange on Ethereum, and Uniswap v4 represents its most significant architectural overhaul yet. Now live with a published whitepaper, v4 introduces a singleton PoolManager contract, a hooks-based extensibility system, flash accounting, and native ETH support. This guide breaks down exactly what changed, how it compares to v3, and what it means for traders, liquidity providers, and developers.

What Is Uniswap v4?

Uniswap v4 is the fourth major version of the Uniswap protocol, now live on mainnet. It keeps the concentrated liquidity model introduced in v3 but rebuilds the underlying architecture around three core innovations:

  1. Singleton PoolManager: Instead of deploying a separate smart contract for every liquidity pool (as v3 did), v4 manages all pools inside one contract. This dramatically reduces the gas cost of creating new pools and executing multi-hop swaps across pools.
  2. Hooks: Hooks are smart contracts that attach to a pool and run custom logic at specific events, such as before a swap, after a swap, before liquidity is added, or after liquidity is removed. This lets developers build dynamic fee models, on-chain limit orders, TWAMM (time-weighted average market makers), and custom oracles without changing the core protocol.
  3. Flash Accounting: Rather than transferring tokens in and out of contracts at every step of a swap, v4 tracks net balances internally and settles only the final difference. This reduces unnecessary token transfers and lowers gas costs for complex multi-step operations.

These three changes together make v4 more gas-efficient, more flexible, and more extensible than any previous version of Uniswap.

Uniswap v4 vs v3: What Actually Changed

Here is a direct comparison of the key architectural and feature differences between Uniswap v3 and v4:

πŸ‘‰ Quick takeaway: Uniswap v4’s singleton architecture and hooks system are the two most significant changes. The singleton reduces pool creation and multi-hop gas costs substantially. Hooks unlock custom logic at every stage of the pool lifecycle, effectively turning Uniswap into a programmable liquidity infrastructure layer.

Feature Uniswap v3 Uniswap v4
Pool Architecture Separate contract per pool Single PoolManager contract (singleton)
πŸ† Lower deployment overhead
Fee Tiers Fixed tiers:
0.01%, 0.05%, 0.3%, 1%
Unlimited custom fee tiers via hooks
πŸ† Full fee flexibility
Extensibility πŸ”΄ None
Fixed logic per pool
🟒 Hooks at 8+ pool lifecycle events
πŸ† Most extensible AMM architecture
ETH Support ⚠️ Requires wrapping to WETH 🟒 Native ETH supported directly
Gas: Pool Creation ⚠️ Higher
New contract deployment per pool
🟒 Lower
Pool is a record inside the singleton
Gas: Multi-Hop Swaps ⚠️ Multiple token transfers per hop 🟒 Flash accounting settles net balance once
πŸ† Most gas-efficient multi-hop execution
LP Position Type ERC-721 NFT (non-fungible) ERC-6909 or custom via hooks
Custom Logic πŸ”΄ Not available natively 🟒 Pre-swap, post-swap, pre-add, post-add hooks
Order Book Capability πŸ”΄ Not available 🟒 Achievable via hooks
e.g. on-chain limit orders
Dynamic Fees πŸ”΄ Not available 🟒 Available via hooks

For developers migrating from v3, the official v4 vs v3 documentation covers the specific interface and contract changes in detail.

History of Uniswap

Uniswap launched in November 2018 as the first Ethereum-based DEX. The primitive v1 introduced the first liquidity pools (LPs), LP tokens, and swap of ETH with Ethereum tokens, ERC-20s.

Uniswap v1 also introduced the price algorithm that balances the exchange demand with the liquidity pool supply. It’s called CPMMM (constant product market maker model), and it’s one reason so many DEXs imitate Uniswap.

The UNI token launched in 2020 with Uniswap v2, which also optimized Ethereum swaps. Until now, if you had Token A and wanted token B, you had to buy and sell ETH tokens first. Not anymore. Also this direct system boosted LP deposits from $65M to +$9B by 2021.

That same year, Uniswap v3 launches and quickly becomes the most popular DEX on Ethereum. This version was several times more capital-efficient than Uniswap v2, bringing features such as:

  • Concentrated liquidity
  • Active liquidity
  • Flexible fee tiers
  • Advanced blockchain oracles
  • Multi-range pool positions

This steeply reduced risk and capital needed for LP providers while earning the same fee revenue.

Despite the competitive DEX landscape across multiple networks, Uniswap has maintained its position as the leading decentralized exchange. With v4 now live, the question of whether it would be as revolutionary as previous versions can be answered: the hooks architecture and singleton design represent the most significant extensibility upgrade in the protocol’s history.

For current trading volume and TVL data across Uniswap versions, trackers like DeFiLlama provide up-to-date figures across the v2, v3, and v4 protocol families.

Uniswap v4 Core Features: What Launched

The speculative features discussed before v4 launched can now be evaluated against what actually shipped. Here is what v4 introduced:

Hooks: The Biggest Change in v4

Hooks are the defining feature of Uniswap v4. A hook is a smart contract that a pool creator deploys and attaches to a pool at creation time. The hook contract can execute custom logic at up to eight lifecycle points: before and after a swap, before and after liquidity is added, before and after liquidity is removed, and before and after a donate call.

This enables developers to build features that were impossible in v3 without forking the entire protocol:

  • Dynamic fees that adjust based on volatility (the dynamic fee structure predicted here is now live via hooks)
  • On-chain limit orders and TWAMM (time-weighted average market maker) strategies
  • Custom oracles and price manipulation protections
  • Liquidity mining and reward distribution logic built directly into the pool
Singleton Architecture and Gas Efficiency

The off-chain order book speculation in the original article was partially answered differently than expected. Rather than moving logic off-chain, v4 achieves gas efficiency through the singleton PoolManager and flash accounting. All pools share one contract, eliminating the gas cost of deploying new contracts. Flash accounting settles only net token differences across a chain of swaps, reducing unnecessary ERC-20 transfers.

Native ETH Support

V4 removes the requirement to wrap ETH to WETH before swapping. Pools can now hold native ETH directly, saving users the WETH wrap and unwrap gas costs on every trade.

Fee Tier Flexibility

V3 offered four fixed fee tiers. V4 supports unlimited fee tiers, and hooks can implement fully dynamic fees that change in real time based on pool conditions.

How Hooks Work in Practice

Hooks are the most developer-relevant feature in v4. Here is how the lifecycle works step by step:

Step 1 — Pool Creation with a Hook

When a liquidity pool is created in v4, the creator specifies a hook contract address as part of the pool parameters. The hook address encodes which lifecycle callbacks the hook implements (this is done via specific address bits in the v4 architecture).

Step 2 — Hook Callbacks Fire Automatically

When a swap or liquidity action occurs on a pool, the PoolManager calls the appropriate hook functions in sequence. For a swap, the order is: beforeSwap (hook) then swap execution then afterSwap (hook).

Step 3 — Custom Logic Runs

Inside beforeSwap, a developer could: check an oracle price and revert if manipulation is detected, calculate a dynamic fee based on recent volatility, or update an internal accounting ledger. Inside afterSwap, the hook could distribute rewards, update a TWAP, or trigger another protocol action.

Step 4 — Flash Accounting Settles Balances

After all hook callbacks and the core swap execute, flash accounting resolves the net token balance. Only the final difference moves between wallets and the pool, not every intermediate transfer.

Real Hook Examples From the Ecosystem

  • TWAMM Hook: Executes large orders gradually over time to minimize price impact
  • Dynamic Fee Hook: Widens the fee spread during high-volatility periods to protect LPs
  • Limit Order Hook: Allows users to place orders that execute only when price reaches a target
  • Liquidity Mining Hook: Automatically distributes reward tokens to LPs proportional to their contribution

Developers can explore sample hook implementations in the official Uniswap v4 developer documentation.

Gas Savings in Uniswap v4: Where the Efficiency Comes From

One of the primary design goals of v4 is reducing gas costs for both pool creators and swappers. Here is where the savings come from:

Pool Creation Costs

In v3, creating a new pool meant deploying a new smart contract. Contract deployment is one of the most gas-intensive operations on Ethereum. In v4, a new pool is simply a new record inside the existing singleton PoolManager contract. The gas cost of pool creation drops substantially because no new contract bytecode needs to be deployed.

Multi-Hop Swap Costs

In v3, a swap that routes through three pools (for example, USDC to ETH to WBTC to DAI) requires token transfers at each hop. Each ERC-20 transfer costs gas. In v4, flash accounting tracks the net balance change across all three hops and executes only the final settlement transfer. Intermediate token movements are handled internally.

Native ETH Savings

Every time a v3 user swaps ETH, the protocol wraps it to WETH (costing gas) and later unwraps it (costing more gas). V4 supports native ETH natively, eliminating both wrap and unwrap operations from the gas bill.

Note: Specific gas cost figures vary by network conditions, swap complexity, and hook implementation. For current benchmarks, refer to the Uniswap v4 developer documentation and community tooling.

What Uniswap v4 Means for DeFi

Now that v4 is live, we can assess its actual impact rather than speculate. The hooks system is the most significant contribution to DeFi infrastructure since concentrated liquidity in v3. By turning the AMM into a programmable middleware layer, v4 allows the broader developer ecosystem to build specialized financial products on top of Uniswap’s deep liquidity without fragmenting it.

The prediction that v4 would look more like an all-in-one exchange was partially correct in spirit. Hooks enable limit-order-like functionality, custom reward mechanisms, and sophisticated LP strategies — but the approach is modular rather than monolithic. Instead of Uniswap Labs building every feature, the hooks architecture lets any developer extend the protocol.

The singleton design also changes the competitive dynamics for DEX aggregators and liquidity routers. When all pools share one contract, routing across multiple v4 pools in a single transaction becomes significantly cheaper, which strengthens Uniswap’s position against fragmented competitors.

Continuous Clearing Auctions (CCA) and Liquidity Bootstrapping Pools (LBP) are also being explored as launch mechanisms within the v4 ecosystem, offering new token projects more sophisticated and fair launch options than simple AMM seeding.

Getting Started with Uniswap v4

For Traders and Swappers

If you use Uniswap to swap tokens, the v4 upgrade is largely transparent. You interact with the same Uniswap interface. The benefits you will notice over time include lower gas costs on complex swaps, access to pools with more flexible fee structures, and pools with hook-enabled features like dynamic pricing.

For Liquidity Providers

V4 gives LPs more tools to manage risk and maximize fee revenue. Key considerations when providing liquidity in v4:

  • Choose pools with hooks that match your risk tolerance (a dynamic fee hook, for example, adjusts fees during volatile periods to better compensate LPs)
  • Understand that hook contracts are external code — review any hook contract before depositing into a hook-enabled pool
  • Pool creation is cheaper in v4, so you may see more niche pools with tighter fee tiers for specific token pairs

For Developers

V4 opens the protocol to extensibility that previously required forking. To begin building on v4:

  1. Read the official v4 overview and architecture documentation at developers.uniswap.org
  2. Review the v4-core repository on GitHub for the whitepaper and core contract source code
  3. Study sample hook implementations to understand the callback interface
  4. Use the Continuous Clearing Auctions (CCA) and Liquidity Bootstrapping Pool (LBP) whitepapers if you are planning a new token launch on v4

The Uniswap developer portal provides integration guides, contract addresses, and SDK references for v4 deployments.

FAQ

Is Uniswap v4 live on mainnet?

Yes. Uniswap v4 is live. The core whitepaper was published in 2025 and the protocol has been deployed with developer documentation, sample hooks, and an official v4 landing site available. For current deployment addresses and supported chains, visit v4.uniswap.org and the Uniswap developer portal.

Do I need to do anything as a Uniswap user to use v4?

For most traders, the transition is handled at the interface level. If you use app.uniswap.org, the router will direct your swaps through the most efficient version of the protocol. You do not need to manually migrate anything.

Are hooks in Uniswap v4 safe to use?

Hooks are external smart contracts. The core Uniswap v4 protocol is audited, but individual hook contracts written by third-party developers are not guaranteed to be safe. Before providing liquidity to a hook-enabled pool, review the hook contract’s audit status and the reputation of the deployer. The Uniswap core contracts themselves do not change based on hook behavior.

Why is Uniswap swap so expensive?

Gas fees on Uniswap depend primarily on the Ethereum network. For lower fees, consider using Uniswap on Layer-2 networks like Arbitrum, Optimism, or Base, where the same tokens often trade for a fraction of the mainnet gas cost. V4’s flash accounting and singleton design also reduce gas costs for complex swaps compared to v3.

How do I avoid gas fees on Uniswap?

Bridge to a Layer-2 network supported by Uniswap. Gas fees on Arbitrum and Optimism can be 10-50x lower than Ethereum mainnet for the same swap. If you must use mainnet, transact during off-peak hours when network congestion is lower.

What is the licensing status of Uniswap v4?

Uniswap v4 has been released under a Business Source License (BUSL) similar to the approach used for v3. The BUSL restricts commercial use for a defined period before the code transitions to an open-source license. Community discussions around the BUSL versus fully open-source licensing have been ongoing in the DeFi ecosystem. For the current licensing terms, refer to the official Uniswap v4 repository and governance forums.

Max is a European based crypto specialist, marketer, and all-around writer. He brings an original and practical approach for timeless blockchain knowledge such as: in-depth guides on crypto 101, blockchain analysis, dApp reviews, and DeFi risk management. Max also wrote for news outlets, saas entrepreneurs, crypto exchanges, fintech B2B agencies, Metaverse game studios, trading coaches, and Web3 leaders like Enjin.


Posted

in

by

Tags: