Index / MEV protection
MEV protection Uniswap v4 hooks
Defenses for LPs and swappers against toxic flow. Licensed Solidity excerpts with a link to the full source file.
AntiSandwichHook
Checkpoint top-of-block pool state and cap one swap direction to that price.
AntiSnipe
Launch guard — max buy (% supply), snipe tax on exact-input buys for N blocks after init.
BackGeoOracle
Geomean oracle that backruns its own pool so the recorded price is not stale.
Clanker
Dynamic-fee launch hook: beforeSwap sets fee, claims, runs an MEV module, then takes protocol delta.
JitVault
JIT lock blocks LP ops during swap; optional output skim accrues to vault balances.
LiquidityPenaltyHook
Withhold JIT LP fees in afterAddLiquidity and donate a linear penalty on early remove.
MEV donate
Skim swap output to pending, then flush() donates to in-range LPs.
MevWindow
Elevated swap fee and blocked add-liquidity for mevBlocks after pool init.
Sell guard
Sell cooldown blocks rapid dumps; repeat sells in a window pay ramp fee.
SlippageFeeHook
Simulate the swap, measure the tick it would move, then price the fee off that slippage.
SniperTax
Launch LP fee decays linearly from startFee to baseFee over duration seconds.
SuckerPunch
Free ETH-pair buys, hold-time sell fee decay, same-block sell taxed as MEV.