Skip to content

Uniswap v4 hooks, explained

A Uniswap v4 hook is a smart contract attached to a specific pool that runs code at defined points in the pool's own operations (before and after swaps, liquidity changes, and donations), letting a pool carry custom logic like dynamic fees, trade caps, or automatic burns with no off-chain infrastructure operating them.

On this page

One contract per pool, called during execution

Uniswap v4 holds every pool in a single PoolManager contract, and each pool names one hook address at creation. During a swap, the manager calls the hook at fixed checkpoints, typically beforeSwap and afterSwap, and the hook can read the swap's parameters, return an adjusted fee, cap or redirect amounts, or donate proceeds to LPs before the swap completes.

Which checkpoints a hook may run is committed on chain in the upper bits of the hook's own address: the flags are visible to anyone before they interact with the pool. That is what makes a hooked pool inspectable: permissions are part of the address you can verify, not a promise in a document.

What hooks can do

Common patterns include dynamic fees that respond to volatility or trade size, limits on trade size during a launch window, automatic routing of part of a buy to a dead address or to LPs, and pots funded per trade. All of it runs inside the pool's own execution, with no keeper, no bot, and no oracle unless the mechanic itself reads one.

The flip side: a hook is privileged code inside every swap. What it is allowed to do is bounded by the permission flags it declares, and what it actually does should be readable from its parameters. If neither is checkable, treat the pool as untrusted.

Composable blocks, not bespoke code

Hookr is modular infrastructure for Uniswap v4 hooks. Every Hookr pool is an ordinary Uniswap v4 pool on Hookr's shared hook, HookrRoot, or on a creator's own hook.

A creator picks Hook Blocks for each pool: Anti-Snipe, Dynamic fees, LP Rewards, Creator royalty, Auto Burn, King of the Pool and more. The Hook Blocks are chosen at launch and fixed for the pool's life. Arb recapture is on by default on every new pool.

Related: Core blocks The Hook Blocks built into Hookr's hook, and the ranges the contracts accept.

Costs and limits

Hook logic costs gas on top of the base swap. On Hookr, Auto Burn, LP Rewards and the Snipe tax charge buys only, so a sell pays the base fee and any dynamic fee. While Anti-Snipe's guard lasts, buys per parent block are capped and exact-output buys are refused.

Related: Hook Blocks Every Hook Block a pool can carry, with its parameters.