Fees
Formula
gap = |pool - ref| / ref (pips)
takesGap = gap > band and the swap moves the pool toward ref
surcharge = takesGap ? (gap - band) x mult : 0
fee = min(base + surcharge, cap)
stale ref : fee = staticFeeAll parameters are per pool in PegHook.configs(poolId). The pure function feeFor and the view quoteAt(poolId, sqrtPriceX96, ref, zeroForOne) return the exact fee the hook would charge, which is what the Quote buttons on the site call.
Which side takes the gap
Selling kHYPE lowers the pool price. When the pool sits above the reference, selling kHYPE closes the gap and pays the surcharge; buying kHYPE pays the base. Below the reference it is the other way round. With the multiplier at one, the surcharge is about the size of the gap, so the arbitrageur's profit falls toward zero and the value stays with LPs.
Protocol share
On exact-input swaps the hook takes the protocol part of the fee from the input token in beforeSwap as a hook delta, held as ERC-6909 claims on the PoolManager. The rest is the LP fee override for that swap. Once a day the keeper harvests the claims, swaps them to HYPE on the pools themselves with tight slippage, and the result is paid to each pool's voters at 00:00 UTC.
Invariants
- A pool can only be initialised on PegHook with the dynamic-fee flag and a configuration set beforehand.
- The keeper can retune a pool only inside the caps the owner set, and cannot change its reference source.
- The hook never holds LP liquidity.
sweepandharvestmove only the protocol share and stray balances.

