MEV protection hook on Ethereum

Uniswap v4 Hook Contract 0x4f0067581931d9205e848862a7042b5ebc11f0c0 on Ethereum · MEV protection

Volume (24h)
$0
Value locked (TVL)
$10
All-time volume
$0
Pools using this hook
1
Swaps (24h)
0 (0 traders)
Total swaps
0

What it does

This hook sets a configurable swap fee (normally 0.01% to 1% but admin-adjustable up to 100%, with fee-free swaps for its own arbitrage executor) and back-runs each trade with an arbitrage whose profit is shared between LPs and a profit distributor, while LPs can always withdraw freely.

This read was written for the hook 0x4f00…f0c0 on Base and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.

How it works step by step

  • Requires dynamic-fee pools and sets the LP fee on every swap, defaulting by tick spacing (0.01%, 0.05%, 0.25%, 0.30%, 1%).
  • After each user swap, tries to run a back-run arbitrage through an external MEVX router and executor, capturing price discrepancies that would otherwise go to outside MEV bots.
  • Splits any arbitrage profit: a configurable share (0% to 100%) is donated to the pool's LPs and the rest goes to a profit distributor contract.
  • Fee managers can set per-pool static fees, enable a dynamic fee from the external router within min/max bounds, or give specific addresses custom fees; the MEVX executor itself swaps fee-free.
  • Optional hard mode reverts swaps that give the hook too little gas to attempt the arbitrage.
Swap behaviour
Before the swap the hook sets the LP fee (static, per-address override, or router-supplied dynamic fee clamped to bounds, all capped at 100%); after the swap it attempts an arbitrage back-run and, in hard mode, reverts swaps that starve the hook of gas. It does not take tokens from the swapper's input or output.
Liquidity behaviour
No liquidity callbacks; LPs can add and withdraw freely. LPs may receive donated arbitrage profits.
Fee behaviour
LP fee defaults by tick spacing (0.01% to 1%) but admins and fee managers can set it anywhere from 0% up to 100%, per pool or per trader, and the fee goes to LPs; the MEVX executor pays 0%. Arbitrage profits are split between LP donations and a profit distributor according to an admin-set share of 0% to 100%.
Owner & admin controls
A default admin (with OpenZeppelin delayed transfer) can change the router, executor, profit distributor, defaults and tick-spacing fees, and grant fee-manager or pool-admin roles. These roles can set static, dynamic or per-address fees up to 100%, change the LP profit share (0% to 100%), and toggle hard mode.

Enabled Uniswap v4 callbacks

beforeInitialize, afterInitialize, beforeSwap, afterSwap

beforeInitialize: rejects pools without a dynamic fee; afterInitialize: stores pool config and registers the pool with the MEVX router; beforeSwap: sets the swap fee; afterSwap: runs the arbitrage back-run and profit sharing.

Security & trust assessment

Risk level: high, estimated (decoded bytecode, high confidence).

Who controls it: A default admin and any granted fee-manager or pool-admin roles control fees, profit split, and external contracts. The worst case is setting a 100% fee for everyone or targeted addresses, and sending all arbitrage profit away from LPs.

Risk to user funds: The hook takes no tokens from swaps directly, but the LP fee charged to traders can range from 0% to 100%. LP principal cannot be locked or drained since withdrawal callbacks are disabled.

Security findings

  • [high] Uncapped swap fee: Fee managers can set pool, dynamic-bound, or per-address fees up to the Uniswap maximum of 100%, so swaps can be made confiscatory or selectively punitive for chosen traders.
  • [medium] Swappable external arbitrage contracts: The admin can replace the MEVX router (which supplies dynamic fees) and executor (which swaps fee-free and runs arbitrage) at any time.
  • [low] Hard mode can revert swaps: When enabled, swaps that leave the hook too little gas for arbitrage (up to 5,000,000 gas budget) revert.
  • [info] LP withdrawals unrestricted: Remove-liquidity callbacks are disabled, so LPs can always withdraw.

Contract details

Verified source
No
Bytecode size
18,203 bytes
Upgradeable proxy
No
Detected patterns
donates, erc20, ownable

Pools using MEV protection hook