Comment on page
Types of MEV
Short overview of MEV
There are many types of MEV and we won't cover them all. Here below are the most common, and largest by volume, that affect defi trades (swaps):
Every swap carries information and has an effect on the market. As soon as a tx hits the mempool, others can read and use this information. These are the ways bots take advantage of this information, at the cost of the user who submitted the transaction.
If your transaction moves the market – e.g., pushes a token price up – then a bot can take advantage by buying the token first. Your transaction might fail, but the bot can count on the likelihood that you'll buy anyway. You end up paying more, and the bot will sell and profit immediately at your expense.
Generalized frontrunning: If you submit any trade that makes an instantaneous profit and can also be called by other wallets (e.g., a liquidation), then generalized frontrunners will spot it and "steal" your tx. They do this by copying your tx and bribing builders to include their transaction ahead of it.
If you don't route your swap optimally, you can disbalance the price in the pool you traded on, compared to the rest of the market. A large enough price change can create a profitable opportunity for a bot: The bot buys from a pool where the token is cheap and sells it to the pool where it's expensive (likely the pool where you bought the asset).
By not routing optimally, you overpaid for the tokens you bought. The profit the bot makes in the backrun comes directly out of your pocket.
Trades that don't have tight enough slippage tolerances are vulnerable to sandwiches. Larger trades are particularly attractive for sandwiching:
Upon seeing your transaction in the mempool, a bot:
- 1.Adds a buy order before your tx, moving the market just as much as your slippage tolerance allows;
- 2.Lets your trade execute, which pushes the price on the pool up;
- 3.Adds a sell order right behind your trade.
The bot (the Searcher) nets an instant profit from the price difference between their buy and sell order. You pay for this profit by receiving a worse price than the market would have given you.