V4HOOKSCUT SHEET DIRECTORY

Index / Liquidity bootstrapping

pattern · MIT · last updated 2026-08-27

Liquidity bootstrapping

Linear-decay token sale via beforeSwapReturnDelta (LBP-style custom curve).

First-party rewrite inspired by kadenzipfel uni-lbp (AGPL). configureSale sets start/end time and price bounds. beforeSwapReturnDelta mints/burns ERC-6909 for ETH→token sales at currentPrice. beforeAddLiquidity reverts — no v4 LP during the sale phase. Teaching cut of an LBP launch curve. Listing is not an audit. Forge tests under test/LiquidityBootstrapping.t.sol.

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

beforeAddLiquiditybeforeSwapbeforeSwapReturnDelta

Solidity

Excerpt from contracts/LiquidityBootstrapping.sol. Copy the full file to implement this. Not an audit.

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

Spec

Kindpattern
Statusexperimental
LicenseMIT
Sourcehttps://github.com/CryptoGnome/v4hooks
CategoriesLaunchpads
PropertiesVanilla swap
ChainsEthereum
Docshttps://github.com/kadenzipfel/uni-lbp

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.