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:
| Bit | Permission |
|---|---|
0x2000 | beforeInitialize |
0x1000 | afterInitialize |
0x0800 | beforeAddLiquidity |
0x0400 | afterAddLiquidity |
0x0200 | beforeRemoveLiquidity |
0x0100 | afterRemoveLiquidity |
0x0080 | beforeSwap |
0x0040 | afterSwap |
0x0020 | beforeDonate |
0x0010 | afterDonate |
0x0008 | beforeSwapReturnDelta |
0x0004 | afterSwapReturnDelta |
0x0002 | afterAddLiquidityReturnDelta |
0x0001 | afterRemoveLiquidityReturnDelta |
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.