Slippage tolerance is the largest execution-price change a swap will accept before reverting. The useful setting depends on how much the route can move while your transaction waits to land, and how much worse a fill you are willing to accept.
Choose a loss limit before choosing a percentage.
- It sets an execution bound. For a sell, it caps how far the received amount may fall below the quote.
- It does not improve the quote. A wider limit can let a transaction execute through more price movement.
- It trades reverts for execution risk. A narrow limit protects the price but fails more often when the route moves.
For an exact-input swap, the contract checks a minimum destination amount. For exact output, it checks a maximum source amount. A limit is therefore a guard on execution, not an estimate of what the pool will do or a fee paid in advance.
Start with the route’s expected movement between quote and inclusion. A deep, stable pair may often work with around 10–50 basis points (0.10–0.50%). Volatile assets, thin pools, large trades, and congestion can need more; widening the setting is justified only when that extra execution risk is acceptable.
The bound is calculated from the quoted amount.
For a sell, calculate minimumOut = quotedOut × (1 − slippageBps / 10,000). If a quote returns 2,000 USDC and you set 30 bps, the minimum is 1,994 USDC. If the route can deliver less when the transaction executes, it reverts.
For a buy, calculate maximumIn = quotedIn × (1 + slippageBps / 10,000). A quote requiring 1,000 USDC at 30 bps permits up to 1,003 USDC. The ParaSwap SDK accepts slippage in basis points when building the transaction; its build parameters use slippage instead of a manually supplied destAmount for sells or srcAmount for buys. Check the quote side before applying a formula, and calculate using integer token units to avoid rounding the bound in your favor.
The EIP-20 token standard defines decimals as an optional display convention, so amounts passed to transaction builders are commonly integers in the token’s smallest units. Convert for display, but form the bound from the raw amount and round conservatively: down for a sell’s minimum output, up for a buy’s maximum input.
Refresh the route when the quote has gone stale.
Slippage does not make an old route current. The quote may reflect pool reserves and gas conditions from an earlier block; once the transaction is included, the router tests the bound against execution state. A wider tolerance may allow that old route to execute at a worse rate, while a narrow one may cause a revert.
ParaSwap makes the chosen tolerance part of the transaction’s execution guard, so rebuilding after a meaningful delay can be better than widening it. When using the ParaSwap API, pass the returned priceRoute through to transaction building as required, and fetch a fresh route if its block context or market conditions have moved. Recheck gas and allowance state as well: a price-bound revert is only one reason a transaction can fail.
One edge case is a token with transfer fees or unusual balance behavior. The amount the router receives or sends may differ from nominal transfer amounts, so an otherwise reasonable bound can still revert or produce a confusing estimate. For a token you have not traded before, verify that the route supports its transfer behavior before increasing tolerance to compensate.
Use the smallest limit that clears normal execution noise.
For frequent swaps, compare the quote with recent execution outcomes for the same pair, size, and chain. If transactions regularly revert just beyond 20 bps, try a modest increase and compare the extra successful fills with the worse executions it permits. Do not copy a tolerance from another pair: a route split across several pools can behave differently from one deep pool, even at the same notional.
Raising tolerance can also increase exposure to adverse execution, including sandwiching in mempool conditions where another trade can move the price before yours. A larger limit does not guarantee that this happens, but it gives the transaction more room to execute after the market moves against it. If the required bound becomes uncomfortable, reduce trade size or refresh the route instead of treating the percentage as a way to force a fill.
- Identify whether the swap is exact-input or exact-output.
- Set a basis-point limit from the trade’s size, route depth, and likely inclusion delay.
- Calculate the sell minimum or buy maximum from the fresh quote in raw token units.
- Rebuild the transaction after material quote movement; widen only when the added execution risk is acceptable.
Top comments (0)