Uniswap v4 launched in 2024 with the most significant architectural change in Uniswap's history: hooks. Hooks are smart contract plugins that attach to a Uniswap pool and execute custom logic at specific points in the swap lifecycle, enabling a new generation of DeFi primitives built directly into liquidity pools.
What Are Hooks?
A hook is a smart contract that Uniswap v4 calls at defined checkpoints during pool operations:
- beforeSwap / afterSwap: Logic before and after each trade
- beforeAddLiquidity / afterAddLiquidity: Logic around LP deposits
- beforeRemoveLiquidity / afterRemoveLiquidity: Logic around LP withdrawals
- beforeInitialize / afterInitialize: Logic when a new pool is created
Any developer can write a hook contract and deploy a Uniswap v4 pool with that hook attached. The hook has arbitrary logic — it can modify prices, collect fees, distribute rewards, access oracles, or call external contracts.
What Hooks Enable
Dynamic fees: A hook can adjust the pool's swap fee based on market conditions. Low volatility = low fee to compete for volume. High volatility = high fee to compensate LPs for impermanent loss risk. Curve's dynamic fee concept, but native to Uniswap.
On-chain limit orders: A hook can hold limit orders and execute them when the pool price crosses the order's target. Full limit order book functionality within a Uniswap pool.
TWAP execution: Automatically execute large orders over time at the AMM level, reducing price impact for large traders.
KYC/permissioned pools: A hook can check if a swapper is on an allowlist before permitting the trade. Enables compliant DeFi for institutional participants.
Custom reward distribution: LPs in a hooked pool can receive additional token rewards from the hook contract, creating a built-in incentive layer (similar to gauge rewards but without external infrastructure).
Oracle-integrated pricing: Hooks can pull external data into pricing decisions — making pool price responsive to off-chain information in ways standard AMMs cannot achieve.
The Singleton Architecture
Beyond hooks, v4 introduces a singleton contract — all Uniswap v4 pools exist within a single contract instead of separate contracts per pool (as in v3). Benefits:
- Multi-hop swaps across pools cost less gas (no ERC-20 transfers between pools)
- Flash accounting: token balances are netted across a transaction and settled once at the end
- Cheaper pool creation (no new contract deployment)
Uniswap v4 vs v3
| Feature | v3 | v4 | |---------|-----|-----| | Concentrated liquidity | Yes | Yes | | Custom logic | No | Yes (hooks) | | Pool architecture | Per-pool contracts | Singleton | | Multi-hop gas | Higher | Lower | | Hook ecosystem | N/A | Growing rapidly |
V4 is backwards compatible — v3 pools continue to operate. New pools on v4 can optionally attach hooks.
The Hook Ecosystem
The Uniswap Hook Incubator and community have built hundreds of hooks, including:
- Full-range LP auto-rebalancers
- Volatility oracle hooks for dynamic fees
- Allowlist/denylist access control hooks
- MEV-redistribution hooks (returning extracted value to LPs)
- Charitable contribution hooks (donating a % of fees to a cause)
Hooks transform Uniswap from an AMM into a platform — any DeFi primitive that needs exchange functionality can be built as a hook rather than a separate protocol.