What happens to your swap in a sandwich?
Advanced · Updated
In a sandwich, someone trades immediately before your swap and again immediately after it. The front trade buys the asset you were about to buy, and the price the pool offers you gets worse. Your swap executes at that worse price, inside the tolerance you signed. The back trade sells what was bought in front, and the difference, minus fees, stays with whoever placed the two trades around yours.
The effect on you is simple: you receive less of the output token than you would have if those two trades had not been there. You did not change your order. The state of the pool changed between the moment you sent it and the moment it entered the block. The maximum slippage you accepted is the ceiling of that loss in this form of extraction: if the move passes that ceiling, the swap fails instead of filling. This describes what happens to you. It does not describe how to assemble the trade, and it is not advice to switch venue or asset.
Informational text from Criptos.ai. It is not a buy or sell recommendation, and it is not tax advice. This is general information, not financial, tax or legal advice. We do not promise gains.
Related tools
In the glossary
Articles
In the Academy: Advanced · In the Academy · In the glossary