Liquidity hooks, usually just called hooks, are separate smart contracts that a decentralised exchange pool runs automatically at defined moments in its life, such as before or after a swap, or when liquidity is added or removed. They were introduced as the defining feature of version 4 of Uniswap, which launched in January 2025. A hook lets a developer customise how a pool behaves without building a whole new exchange.
Earlier automated market makers offered a fixed set of pool types, and any new feature needed a fork of the code and a fresh pool of liquidity. Hooks turn the exchange into a platform: the core contract handles accounting and safety checks, and hooks add features on top. Other exchanges, including Balancer and PancakeSwap, have introduced similar hook systems.
Liquidity hooks in plain terms
Think of a shared kitchen with a standard oven that everyone uses. Hooks are like approved attachments that can be clipped onto a particular oven: a timer that changes the temperature at night, a sensor that turns the heat up when the kitchen is busy, or a lock that only opens for registered cooks. The oven itself stays the same, and the attachment only affects the oven it is clipped to.
For traders, a pool with a hook may charge different fees at different times, fill orders at set prices or reward certain behaviour. For liquidity providers, hooks can automate tasks they would otherwise do by hand. The catch is that each attachment is new code, and a badly made one can cause harm.
How hooks work in Uniswap v4
Uniswap v4 keeps all pools inside a single contract, called the pool manager, and settles token movements at the end of each transaction rather than after every step, a design known as flash accounting that relies on cheap temporary storage added to Ethereum in the Dencun upgrade of 2024. The single-contract design also makes creating a new pool far cheaper than in earlier versions, which is part of what makes experimenting with hooks practical. When a pool is created, it can be linked to one hook contract. That link is permanent for the life of the pool.
The pool manager calls the hook at the points the hook has asked for, which include:
- before and after a pool is initialised;
- before and after liquidity is added or removed;
- before and after a swap;
- before and after a donation of tokens to liquidity providers.
Which of these a hook uses is encoded in the hook contract's own address, so the pool manager can tell at a glance which calls to make. Hooks can also be allowed to change the amounts owed in a swap, set fees dynamically or keep their own internal state.
Uses
- Dynamic fees. Fees that rise in volatile markets and fall in calm ones, to protect liquidity providers from impermanent loss.
- Limit orders and time-weighted orders. Orders that fill when the price crosses a level, or large orders split over many blocks to reduce price impact.
- Price oracles. Pools that record price history for use by other protocols as a blockchain oracle.
- MEV mitigation. Mechanisms that capture or return value lost to maximal extractable value, for example by auctioning the right to trade first in a block.
- Access controls. Pools that only accept trades from verified addresses, which some institutions want for know-your-customer reasons.
- Automation for liquidity providers. Automatic re-centring of concentrated liquidity positions and compounding of fees.
Risks and criticism
Hooks shift risk from the core exchange to many separate developers. The Uniswap core contracts were audited extensively, but each hook is independent code, and a hook with a bug or a malicious design can trap funds, charge unexpected fees or give its author special privileges. Because a pool's hook cannot be changed, a flawed hook can only be escaped by moving liquidity to another pool. Hooks can also make transactions cost more gas, and the proliferation of similar pools with different hooks can split liquidity.
A related concern is that hooks are hard for ordinary users to inspect: the interface of a wallet or DEX aggregator may show only the pair and the price, not what the attached code does. Wallets and aggregators therefore tend to route trades only through pools with reviewed hooks, and users and liquidity providers are advised to check whether a hook has been audited and who controls it. Access-controlled pools have also drawn criticism from those who see them as a step away from the permissionless design of decentralised exchanges, while others see them as necessary for regulated users.