Slippage Tolerance Explained in Detail
Slippage tolerance is a bound on execution quality. For an exact-input swap, it is often amountOutMinimum. For an exact-output swap, it is often amountInMaximum.
The same idea applies to vault deposits, withdrawals, and share conversions.
Smart contract example
require(amountOut >= amountOutMinimum, "too much slippage");
The transaction reverts if execution is worse than the user's limit.
Slippage Tolerance in Auditing
Without slippage checks, users can receive worse execution after price movement, MEV, sandwiching, fees, or manipulated preview values. This is one of the practical defenses auditors look for when reviewing frontrunning attacks.
Auditors check that user-facing flows include minimum output, maximum input, and a deadline where needed.
Red flags in code
-
amountOutMinimumis zero. -
Exact-output swaps omit maximum input.
-
Vault deposits omit minimum shares.
-
Deadline is missing or effectively infinite.
-
Quotes are read from spot state and trusted after state changes.
How to test or review it
-
Move price between quote and execution.
-
Simulate sandwich-like transaction ordering.
-
Test minimum output and maximum input boundaries.
-
Check deadlines and recipients.
-
Apply the same thinking to vault shares and redemption assets.
Keep learning this topic
Slippage
Slippage is the difference between the expected trade price and the actual execution price, often caused by liquidity, volatility, or transaction ordering.
Sandwich Attack
A sandwich attack is a front-running pattern where an attacker places one transaction before and one after a victim trade to profit from the victim's price impact.
MEV
MEV, or maximal extractable value, is value that can be extracted from transaction inclusion, exclusion, or ordering beyond normal block rewards and fees.
Frontrunning & Sandwich Attacks
Frontrunning and sandwich attacks in Solidity: how MEV bots extract value from DeFi traders, real examples, and slippage-based protections.
Smart Contract Audit Checklist
Use this SCH tool to turn the concept into practical audit work.
Practice this in real audit scenarios
Definitions help, but auditors need reps. SCH turns concepts like Slippage Tolerance into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.