.png?fit=max&auto=format&n=Vl0nE0D6Q6gCTn0P&q=85&s=7e470918d01f82bb301d6012e85690eb)
The challenge
Liquidity pools (especially low-liquidity pools on launchpads and pools for creator coins) are highly exposed to MEV, including sandwich attacks. These strategies front-run regular users’ transactions to extract profit, often at the expense of traders and liquidity providers. The challenge is to mitigate this behavior with a solution that remains gas-efficient, fully on-chain, and independent of external infrastructure. It should not require additional nodes, off-chain oracles, or external modules. A standalone Smart Contract that can operate on any network where Uniswap v4 is available.The solution
Pulse Hook maintains a shared median of gas priority fees across all connected pools. When a user’s priority fee significantly exceeds this median, the Hook applies an additional swap fee. As a result, sharp priority-fee spikes become increasingly expensive and can make MEV-driven transactions economically unprofitable. At the same time, the mechanism adapts to network-wide demand. If priority fees rise broadly (for example, during a bullish market when many users compete for faster execution) the median rises with them. The additional penalty then rapidly decreases, allowing regular users to trade without being penalized for a market-wide increase in fees. Pulse Hook is a short name of Priority Fee Pulse Hook - the mechanism to listen to the pulse of the chain, creating a defense layer against MEV bots.The dynamic fee described above is applied to every swap on every pool that uses this hook. Whitelisting (below) does not turn the fee off for a pool — it only controls whether that pool’s swaps are allowed to influence the shared median.
Hook Features
Priority Fee Median
The main low-gas mechanism to keep up with pools activity pulse. Updates quite quickly as it is algorithmic median built using Frugal2U approach. Results in 15-blocks snapshots that keeps it even more effective.
Dynamic Fees 1.5x Curve
Keep the fees low for real users and high for MEV bots. Use specially created curve to punish only those who deserve it.
Dust Attacks Double Protection
The hook has a chain-specific whitelist of chain core tokens, set at deploy time. A pool is marked as registered once, when it is created, based on whether either of its two tokens is on that whitelist — this is not re-checked on every swap. Only registered pools’ swaps are allowed to update the shared Median. The second defense layer is the Tick Moves Tracker: even on a registered pool, a swap only updates the Median if the pool’s price has moved meaningfully since the last accepted update, which also helps avoid small (dust) transactions aimed at moving the Median.
Now you are welcome to E2E Flow section where it is described step-by-step how exactly this hook works (with code snippets included).
Ready to build?
Initialize Pool
Check the networks where the hook is already deployed and initialize your pool there!
Deploy Hook
You can copy this hook, modify it and deploy wherever your want. This hook is MIT-licensed. Note: the constructor’s listed-token array is only read once at deploy time and tolerates up to two zero-address entries before it reverts — double-check your token list before deploying.
.png?fit=max&auto=format&n=C7oPvmhXeuVhT6xg&q=85&s=54e062a2730088900bc417bad64dbd49)