Overview
MakxYieldPadHook is a stateless Uniswap V4 hook attached to every pool created by MakxYieldPad. Its sole purpose is to intercept swaps and route the creator’s hook fee to YieldPad.
It holds no funds and no rental state. All fee accounting is done in YieldPad via recordHookFee().
Immutables
| Variable | Description |
|---|---|
poolManager | Uniswap V4 PoolManager |
yieldPad | MakxYieldPad — source of pool config, receiver of fees |
Hook flags
0xCC for the Uniswap V4 router to recognize and enforce the required flags.
Fee architecture
Two independent fee layers per pool: LP fee — Fixed per pool (fee: 3000 = 0.3%), overridden on every swap via OVERRIDE_FEE_FLAG. Goes entirely to liquidity providers. Never changes for a given pool.
Hook fee — Flat bps set by the token creator (hookFeeBps). Applied to ETH on every swap. Routed to YieldPad and accrued in launchFeeBalance, claimable by the creator.
beforeSwap — ETH → Token swaps
ETH → token exact-input swaps (zeroForOne = true, amountSpecified < 0):
- Reads
hookFeeBpsfrom YieldPad viagetPoolConfig(poolId). - Calculates
fee = -amountSpecified × hookFeeBps / 10_000. - Returns a
BeforeSwapDeltathat reduces the ETH sent to the pool byfee. - Calls
poolManager.take(ETH, yieldPad, fee)— transfers the fee directly to YieldPad. - Calls
yieldPad.recordHookFee(poolId, fee)— YieldPad credits it tolaunchFeeBalance.
ethIn - hookFee. The LP fee applies to the reduced input.
afterSwap — Token → ETH swaps
token → ETH swaps (zeroForOne = false):
- Reads
hookFeeBpsfrom YieldPad. - Calculates
fee = delta.amount0() × hookFeeBps / 10_000(whereamount0is positive ETH output). - Returns a negative
afterSwapDeltareducing the ETH the swapper receives byfee. - Calls
poolManager.take(ETH, yieldPad, fee). - Calls
yieldPad.recordHookFee(poolId, fee).
Pool currency convention
All Makx pools use:currency0 = address(0)(native ETH) — always sorted firstcurrency1 = ERC-20 token address
What the hook does NOT do
- Does not hold ETH or tokens.
- Does not track rental state or
prepaidUntil. - Does not restrict who can swap.
- Does not implement
beforeInitialize,afterInitialize,beforeAddLiquidity,afterAddLiquidity,beforeRemoveLiquidity,afterRemoveLiquidity,beforeDonate, orafterDonate— all revert withHookNotImplemented.