Learn / What is a hook
last updated 2026-08-27 · 51 listings
What is a Uniswap v4 hook?
A Uniswap v4 hook is an external smart contract attached to a liquidity pool. It can run custom logic before or after pool actions — initialize, swap, add or remove liquidity, and donate — so a pool can charge dynamic fees, fill limit orders, or launch a token without forking the AMM.
Uniswap documents this in the official v4 overview and hooks concept page. Each pool has at most one hook. One hook can serve many pools. Permissions are encoded in the hook’s address bits so PoolManager knows which callbacks to call.
The 14 permission bits
before/after initialize, add liquidity, remove liquidity, swap, donate, plus return-delta variants on swap and liquidity. If the bit is off, PoolManager skips that callback. Always verify the deployed address matches the flags you think you are calling. b is before, a is after.
How to pick a pattern
- Match the job (TWAMM, limit order, oracle, launchpad, MEV).
- Read the Solidity excerpt and the full file at the source URL.
- Match
getHookPermissionsto the bits in the deployed address. - Run the security checklist before you treat it as production-ready.
Next
For agents
Start at /llms.txt, dump /llm-full.txt, or fetch /hooks.json. Contribute with a YAML file and a pull request.