Your swap

ComponentAmount (USD)

Slippage tolerance sweep

Same trade size โ€” how the attacker's extractable value scales with your slippage setting.

Slippage toleranceExtractable (gross)Attacker net profit

How a sandwich attack works

Your swap sits in the public mempool for a few seconds before it's mined. A bot sees it, and does three things in the same block:

This calculator uses the standard heuristic: the attacker's gross extractable value โ‰ˆ trade size ร— slippage tolerance, since that's the exact ceiling your transaction will accept before reverting. Net profit subtracts two gas transactions and two DEX fee legs. It's a simplified model โ€” real extraction also depends on pool depth and exact AMM curve โ€” but it's the right order of magnitude for deciding how tight to set your slippage.

Minimum profitable trade size for the attacker

Below a certain trade size, gas costs eat the entire extractable value and the attack isn't worth running. That break-even point is exactly what the table above shows flip from "not profitable" to "profitable" as slippage tolerance rises.

Related: Slippage calculator ยท Network fees ยท Impermanent loss ยท Triangular arbitrage

Share: ๐• Post Reddit