Skip to main content

Uniswap V4 hooks

Uniswap V4 encodes hook permissions in the last 14 bits of the hook address. A hook can only register for a callback if the corresponding bit is set when the contract is deployed (typically via CREATE2 mining).

The scanner reads these bits directly from the address:

BitPermission
0x2000beforeInitialize
0x1000afterInitialize
0x0800beforeAddLiquidity
0x0400afterAddLiquidity
0x0200beforeRemoveLiquidity
0x0100afterRemoveLiquidity
0x0080beforeSwap
0x0040afterSwap
0x0020beforeDonate
0x0010afterDonate
0x0008beforeSwapReturnDelta
0x0004afterSwapReturnDelta
0x0002afterAddLiquidityReturnDelta
0x0001afterRemoveLiquidityReturnDelta

The four ReturnDelta permissions are particularly powerful — they let the hook mutate the swap's deltas, effectively setting custom fees or redirecting flow. The scanner escalates severity to high when any ReturnDelta bit is set.