V4HOOKSCUT SHEET DIRECTORY

Index / DualPool

product · MIT · last updated 2026-08-27

DualPool

Uniswap ALF JIT hook: deploy multi-range LP around each swap, vault via ERC4626.

DualPoolHook is Uniswap Labs production code from v4-hooks-public. On each swap it runs a JIT cycle: beforeSwap locks LP ops, redeploys liquidity across weighted tick buckets, then afterSwap tears down positions and re-deposits surplus to ERC4626 vaults. Pool fee is static from PoolKey; the hook does not override fees. Study this for JIT + vault rehypothecation, not as a drop-in ALF deployment. Full file at the permalink. Listing is not an audit.

Permission bits

These bits must match the deployed address. Confirm on-chain before you route.

Initialize
ba
Liquidity
baba
Swap
ba
Donate
ba
Return delta
baaa

beforeInitializebeforeAddLiquiditybeforeRemoveLiquiditybeforeSwapafterSwap

Solidity

Excerpt from src/alf/DualPoolHook.sol. Production hook. Study the callbacks, do not paste it as your factory. Not an audit.

// SPDX-License-Identifier: MIT
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
    return Hooks.Permissions({
        beforeInitialize: true,
        afterInitialize: false,
        beforeAddLiquidity: true,
        beforeRemoveLiquidity: true,
        afterAddLiquidity: false,
        afterRemoveLiquidity: false,
        beforeSwap: true,
        afterSwap: true,
        beforeDonate: false,
        afterDonate: false,
        beforeSwapReturnDelta: false,
        afterSwapReturnDelta: false,
        afterAddLiquidityReturnDelta: false,
        afterRemoveLiquidityReturnDelta: false
    });
}

// beforeSwap: set JIT lock → deploy bucket LP → [swap] → afterSwap: remove LP, settle, vault

Spec

Kindproduct
Statusproduction
LicenseMIT
Sourcehttps://github.com/Uniswap/v4-hooks-public
CategoriesLP managementWrappers
PropertiesVanilla swap
ChainsEthereum
Docshttps://github.com/Uniswap/v4-hooks-public

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.