Index / Full range
pattern · UNLICENSED · last updated 2026-08-27
Full range
Force v2-style full-range LP: only the hook can modify liquidity, users mint a pool ERC20 instead.
FullRange’s beforeInitialize requires tickSpacing 60 and deploys a per-pool ERC20 receipt. beforeAddLiquidity reverts unless sender is the hook, so LPs must call addLiquidity on the hook (min to max tick). beforeSwap marks that fees have accrued. This is how you wrap a v4 pool as constant-product inventory. UNLICENSED Uniswap example — take the full file, including rebalance/donate dust. Listing is not an audit.
Permission bits
These bits must match the deployed address. Confirm on-chain before you route.
beforeInitializebeforeAddLiquiditybeforeSwap
Solidity
Excerpt from contracts/hooks/examples/FullRange.sol. Copy the full file to implement this. Not an audit.
// SPDX-License-Identifier: UNLICENSED
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
return Hooks.Permissions({
beforeInitialize: true,
afterInitialize: false,
beforeAddLiquidity: true,
beforeRemoveLiquidity: false,
afterAddLiquidity: false,
afterRemoveLiquidity: false,
beforeSwap: true,
afterSwap: false,
beforeDonate: false,
afterDonate: false,
beforeSwapReturnDelta: false,
afterSwapReturnDelta: false,
afterAddLiquidityReturnDelta: false,
afterRemoveLiquidityReturnDelta: false
});
}
function beforeAddLiquidity(
address sender,
PoolKey calldata,
IPoolManager.ModifyLiquidityParams calldata,
bytes calldata
) external view override returns (bytes4) {
if (sender != address(this)) revert SenderMustBeHook();
return FullRange.beforeAddLiquidity.selector;
}Spec
| Kind | pattern |
|---|---|
| Status | experimental |
| License | UNLICENSED |
| Source | https://github.com/Uniswap/v4-periphery |
| Categories | LP managementWrappers |
| Properties | Vanilla swap |
| Chains | Ethereum |
FAQ
Can I paste this into production? The snippet is an excerpt. Use the full file at the source URL, match flags to the address, and treat this page as a map, not a guarantee.
How do I build this safely? Start with secure v4 hooks and the OpenZeppelin hooks guide.