MEV protection hook on Robinhood Chain
Uniswap v4 Hook Contract 0x4f0067581931d9205e848862a7042b5ebc11f0c0 on Robinhood Chain · MEV protection
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
This hook charges swappers a dynamic LP fee and, after each non-executor swap, runs an arbitrage that returns part of the profit to the pool's LPs and sends the rest to a profit distributor, so arbitrage is an extra step after each trade and the fee applied is the dynamic fee within the pool's bounds, while swaps from the MEVX executor pay zero fee.
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
- Overrides the LP fee on every swap via beforeSwap, returning a dynamic fee from the MEVX router (getDynamicFee staticcall) clamped to per-pool min and max bounds, or a per-account fee override, or the static fee
- Requires pools to be initialized with dynamic fees enabled and registers each pool's config and key in afterInitialize
- Runs an arbitrage attempt after each swap in afterSwap by calling itself through runArbitrage, which checks for an arbitrage route via the MEVX router, executes it through the MEVX executor and tracks the profit
- Shares arbitrage profit: a configurable lpShareBps portion is donated back to the pool via poolManager.donate and the remainder is sent to a profit distributor contract
- Skips fee and arbitrage logic when the swap sender is the MEVX executor (fee returned as 0 in getFee, arbitrage check only)
- Hard mode can revert the swap in afterSwap when the arbitrage callback ran out of gas and the remaining gas is below the budget
- Swap behaviour
- Every swap pays the fee returned by getFee: zero when the sender is the MEVX executor, otherwise a per-account override if one exists, otherwise a dynamic fee from the MEVX router clamped to the pool's min and max bounds, otherwise the static fee. After a non-executor swap, an arbitrage attempt runs and a share of any profit is donated back to LPs. In hard mode, a swap can revert if the arbitrage attempt burned its gas budget.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Fees are set per swap by getFee and applied as an override fee flag. The static fee defaults from tick spacing (1 to 100, 10 to 500, 50 to 2500, 60 to 3000, 200 to 10000 hundredths of a bip) or the default fee. Dynamic fees are read from the MEVX router and clamped to the pool's min and max. Swaps from the MEVX executor pay zero fee. Arbitrage profit is split between LP donation (lpShareBps) and the profit distributor.
- Owner & admin controls
- DEFAULT_ADMIN_ROLE (AccessControlDefaultAdminRules with a delayed admin transfer) can set the profit distributor, MEVX executor and router addresses, global defaults including fee, LP share, gas budget, hard mode and dynamic fee bounds, default out-of-gas depth and the fee per tick spacing. Per-pool FEE_MANAGER_ROLE can set the static fee, dynamic fee enablement and bounds, and per-account fee overrides. Per-pool POOL_ADMIN_ROLE can set LP share, hard mode, gas budget and out-of-gas depth. Roles can be granted per pool or for all pools.
Enabled Uniswap v4 callbacks
beforeInitialize, afterInitialize, beforeSwap, afterSwap
beforeInitialize enforces that pools use dynamic fees. afterInitialize records pool config and registers the pool with the MEVX router. beforeSwap computes and applies the per-swap LP fee. afterSwap runs the arbitrage attempt, profit sharing and the hard-mode gas check.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, medium confidence).
Who controls it: A compromised default admin or one with the admin key could change the profit distributor, router and executor, set defaults and fee-per-tick values, and grant roles that set any pool's fee to the maximum. Pool fee managers and admins hold similar per-pool power.
Risk to user funds: The hook transiently holds arbitrage tokens and native currency during afterSwap and transfers profit out to the profit distributor. It donates a share to pool LPs through the pool manager. It does not hold LP positions, but the external router and executor it calls can move funds during arbitrage. Swaps can be reverted in hard mode.
Security findings
- [high] Admin can route fees and profit to chosen addresses: The default admin can swap the profit distributor and MEVX router and executor addresses. Arbitrage profit is transferred to the distributor, and the router supplies the dynamic fee, so a malicious admin could redirect profit or set fees arbitrarily within the bounds.
- [high] Fee managers can set any fee within the max bound: setPoolFee, setFeeOverride and dynamic bounds let a fee manager set a per-pool or per-account LP fee up to the protocol max, so a swapper or pool can be charged up to the maximum fee, and selected accounts can be given a different fee than others.
- [medium] Hard mode can revert swaps: When hardMode is enabled and the arbitrage callback fails or leaves too little gas, afterSwap reverts with Insufficient gas, which blocks the user's swap. Pool admins control this flag.
- [medium] Arbitrage runs inside user swaps and external calls are unbounded by value: afterSwap executes arbitrage through external routers and the executor with the hook holding funds. Calls are gas-limited but the hook pays and holds tokens during execution, and failures are caught so outcomes depend on the external contracts.
- [info] Admin roles are not limited by timelock: Default admin changes are delayed by AccessControlDefaultAdminRules, but the admin still has immediate effect over the parameters listed above once in control.
Contract details
- Verified source
- No
- Bytecode size
- 18,203 bytes
- Upgradeable proxy
- No
- Detected patterns
- donates, erc20, ownable
Pools using MEV protection hook
- WETH / USDG (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today