Advanced
MEV Mitigation — Key concepts
Avoid getting exploited at the mempool layer.
Developer Advanced
4/8 — MEV Mitigation — Key concepts
Supply chainUsers → wallets → (public/private) mempool → searchers → builders/relays → proposers. Each hop can leak or protect intent.
Talk is cheap. Show me the code.
Slippage bound
minOut = amountIn × (1 − slippageBps / 10,000)
Set conservatively; combine with deadlines to avoid stale quotes.
Private orderflowFlashbots Protect, MEV-share, or intent relayers keep tx out of the public mempool.
function boundMinOut(uint256 amountIn, uint256 slippageBps) internal pure returns (uint256) {
require(slippageBps <= 10_000, "bad bps");
return amountIn * (10_000 - slippageBps) / 10_000;
}
Replay/orderingNonces and deadlines matter in intent systems; builders decide ordering, so design to be insensitive to minor reordering.
Key points
- Public vs private orderflow:Protect user intent before it hits the public mempool.
- Slippage/deadlines:Always pair with minOut and short expiry.
- Signatures/intents:Users sign what they want; relayers execute with replay guards.
- Builders/relays:Separation adds centralization risk; monitor who submits your flow.
- User education:Show when you’re using private RPCs and what happens on fallback.