DropHook

The Uniswap v4 hook of all launch pools.

DropHook is the hook of every launch pool. The launchpad deploys it in its constructor, so each launchpad has one hook.

Permissions

The hook uses four Uniswap v4 hook functions. Uniswap v4 reads them from the low bits of the hook address.

Hook functionBehavior
beforeInitializeOnly the launchpad can initialize a pool. Starts the pool's collection schedule.
beforeAddLiquidityOnly the launchpad can add liquidity.
beforeRemoveLiquidityAllows only changes of zero liquidity, which collect fees. All other removals revert.
afterSwapCollects fees on schedule, then emits DropSwap. Does not change the swap amounts.

The hook does not use beforeSwap, and it does not return deltas.

Fee collection

After each swap, the hook collects the pool's fees if both are true:

  • The pool's LP fee is more than zero.
  • At least 12 hours have passed since collectedAt(poolId).

The hook then calls collectSwapFees on the launchpad and sets collectedAt(poolId) to the block timestamp.

Functions

FunctionReturns
launchpad()The launchpad that deployed the hook.
poolManager()The Uniswap v4 PoolManager.
collectedAt(poolId)The time of the pool's last automatic collection, or the time the pool was created.

Events

event DropSwap(
    PoolId indexed poolId,
    int128 amount0,
    int128 amount1,
    uint160 sqrtPriceX96
);

Emitted after each swap in a launch pool, including dev buys. The amounts are the swap delta from the swapper's side: negative is paid into the pool, positive is paid out. sqrtPriceX96 is the price after the swap.

Errors

ErrorCause
DropHook__InvalidInitializationSenderA pool with this hook is initialized by another address.
DropHook__LiquidityLockedAnother address adds liquidity, or anyone removes liquidity.

On this page