V4HOOKSCUT SHEET DIRECTORY

Index / Clanker

product · MIT · last updated 2026-08-27

Clanker

Dynamic-fee launch hook: beforeSwap sets fee, claims, runs an MEV module, then takes protocol delta.

ClankerHook is MIT production code. getHookPermissions enables initialize, add-liquidity (blocked while the MEV module is hot), beforeSwap/afterSwap, and both swap return-delta bits so the hook can mint protocol fee into its PoolManager account. _beforeSwap sets the LP fee, claims, optionally runs mevModule.beforeSwap, then uses BeforeSwapDelta on paired token. Do not reimplement Clanker to “launch a coin” — use their factory. Excerpt is how a launchpad hook takes fee-on-delta. 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

beforeInitializebeforeAddLiquiditybeforeSwapafterSwapbeforeSwapReturnDeltaafterSwapReturnDelta

Solidity

Excerpt from src/hooks/ClankerHook.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,
        afterAddLiquidity: false,
        beforeRemoveLiquidity: false,
        afterRemoveLiquidity: false,
        beforeSwap: true,
        afterSwap: true,
        beforeDonate: false,
        afterDonate: false,
        beforeSwapReturnDelta: true,
        afterSwapReturnDelta: true,
        afterAddLiquidityReturnDelta: false,
        afterRemoveLiquidityReturnDelta: false
    });
}

function _beforeSwap(
    address,
    PoolKey calldata poolKey,
    IPoolManager.SwapParams calldata swapParams,
    bytes calldata mevModuleSwapData
) internal virtual override returns (bytes4, BeforeSwapDelta delta, uint24) {
    _setFee(poolKey, swapParams);
    _hookFeeClaim(poolKey);
    _lpLockerFeeClaim(poolKey);
    _runMevModule(poolKey, swapParams, mevModuleSwapData);
    // mint protocol fee as BeforeSwapDelta when swapping for/against the clanker
    return (BaseHook.beforeSwap.selector, delta, 0);
}

Spec

Kindproduct
Statusproduction
LicenseMIT
Sourcehttps://github.com/clanker-devco/v4-contracts
CategoriesLaunchpadsDynamic feesMEV protection
PropertiesDynamic feeVanilla swap
ChainsBase
Websitehttps://www.clanker.world/
Docshttps://clanker.gitbook.io/documentation/references/core-contracts/v4

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.