DEX Sandwich Bots: How Slippage Tolerance Exposes Your Swaps
DEX traders routinely lose value on swaps without a clear explanation in the transaction receipt. Gas was paid, the trade confirmed, tokens arrived, yet the output was worse than quoted. In many cases, the cause is not pool depth or price impact. It is a front-running bot that identifies the trade before it settles and acts on it first.
Slippage Tolerance on DEX Trades: The Setting That Lets Bots In
| Quick answer: Slippage tolerance is the maximum price deviation a trader is willing to accept between the submission and confirmation of a swap. On AMM-based DEXs, price is determined by pool ratios rather than an order book, which means it can shift between the moment a trade is quoted and the moment it settles on-chain. |
- Setting slippage tolerance too low causes transactions to revert if any price movement occurs during confirmation.
- Setting it too high leaves room for worse execution and, more critically, creates a predictable window for bots.
Standard guidelines by token type:
Token type | Suggested slippage range |
| High-liquidity pairs (ETH/USDC, etc.) | 0.1% – 0.5% |
| Mid-cap altcoins | 0.5% – 1% |
| Low-liquidity or volatile tokens | 1% – 3% |
| Tax tokens | Tax rate + 1–2% buffer |
(source: DEXTools)
Tax tokens are a specific case that compounds the risk. These tokens apply a fixed buy or sell fee at the contract level – commonly 3% to 10%. A transaction will revert if slippage tolerance is set below the tax rate, which forces traders to set a higher minimum. That higher setting, in turn, makes the transaction more visible and attractive to bots.
The problem is that calculating the correct threshold requires knowledge of the token's tax rate, current pool depth, and recent price volatility – information that is rarely available at the point of trade.
How Frontrun Bots Target DEX Swaps in the Mempool
| Quick answer: Front-running bots exploit a structural feature of public blockchains: pending transactions are visible before they confirm. When a swap is submitted to a DEX, it enters the mempool. In this public queue, validators and automated systems can read transaction details, including the token pair, trade size, and slippage tolerance set by the trader. |
Sandwich searchers scan this queue continuously. When a transaction carries a high slippage tolerance, it signals a wide acceptable price range, which the bot can exploit through a sandwich attack:
- The bot submits a buy order for the same token, ahead of the target transaction, pushing the price up.
- The original transaction executes at the inflated price within the trader's stated tolerance.
- The bot immediately sells into the resulting price, locking in the difference.
All three transactions occur within the same block. The trader's swap goes through, but at a worse rate than the mempool quote. Losses per transaction are often small, in the range of 0.01 to 0.05 ETH, but consistent across every affected trade.
How Trading Directly on DEXTools Reduces This Risk
DEXTools is a DeFi analytics and trading platform that aggregates real-time data across chains and DEXs, including price charts, liquidity depth, transaction history, and token pair analytics.
Beyond data, DEXTools provides a built-in swap interface, DEXSwap, powered by aggregators including KyberSwap, which allows traders to execute transactions directly from the platform.
The key feature relevant to front-running risk is auto-slippage. Instead of requiring the trader to input a manual percentage, DEXTools calculates the optimal slippage tolerance for each token automatically.
|
This matters for two reasons:
- Reduced sandwich attack exposure: Auto-calculated slippage is set as tight as the current conditions allow, minimizing the exploitable window without causing unnecessary reverts.
- Tax token accuracy: Traders no longer need to look up contract tax rates or add arbitrary buffers. The calculation happens at the infrastructure level.
For a practical breakdown of how to set slippage across different DEXs and token types, see: How to Set Slippage Tolerance on Any DEX (2026).
Practical Tips for Safer Swaps on DEXTools
1. Check bot activity on the pair before swapping
Beyond slippage management, the DEXTools Pair page flags front-run bot activity directly in the transaction feed, marking suspicious addresses with a dedicated bot warning icon. Multiple bot-flagged rows in a short window mean sandwich attackers are sitting in that pool. Swapping during lower-volume periods on the same pair reduces competition from active automated trading systems.
2. Split large trades to fall below the bot's profitability threshold
Sandwich attacks are only worth executing when the extracted value covers gas costs. Smaller individual transactions are less attractive targets. Splitting a large trade into two or three smaller ones is one of the most effective ways to reduce exposure without changing any settings.
3. When a swap reverts, check price impact before raising slippage
The instinct is to increase slippage tolerance when a transaction fails. But if the price impact is already high, raising slippage may not address the underlying issue. It just makes the trade a better target. Reducing trade size addresses the root cause.
4. Check pool liquidity on the pair page before setting any slippage
Pool depth determines how much slippage a trade actually requires to go through. A shallow pool needs a wider tolerance, which directly increases bot exposure. Before swapping, the DEXTools pair page shows liquidity depth in real time. If the pool is thin relative to your trade size, either reduce the amount or find a deeper pool for the same pair before executing.
Conclusion
Frontrun sandwich attacks are a permanent feature of public mempool infrastructure. They do not require a vulnerability in the token or the DEX but operate on the predictability of pending transactions. The primary variable traders control is slippage tolerance, and the primary risk is setting it wider than necessary.
Tools that automate that calculation remove a consistent source of exposure. DEXTools builds this into the swap interface by default, with specific handling for the token types, tax tokens in particular, where manual calculation is most error-prone.