DEV Community

Mandie Brugman
Mandie Brugman

Posted on

Choosing a slippage limit for an Ethereum swap

Choose a slippage limit by deciding the lowest output you would accept, then translating that floor into a percentage of the quote. The limit protects an exact-input swap while its transaction waits to execute; it does not improve the quote or cap gas costs.

For the separate route-selection question, which Fermi swap route fits covers the choice in fuller detail. Here, the focus is the execution bound: Fermi is a way to swap tokens directly from a wallet through a decentralized service, and the same distinction between quoted output and minimum acceptable output matters when comparing swap methods.

The limit sets a floor on output

For an exact-input trade, a swap contract or its wrapper typically checks a minimum output, often called amountOutMinimum or minAmountOut. If execution would return less than that floor, the call reverts and the token exchange does not settle.

The floor is usually calculated from the quoted output, after the quote’s expected fees: minimum output = quoted output × (1 − tolerance). A 0.5% tolerance allows output to fall by at most 0.5% from that quote. For an exact-output trade, the parallel guard is a maximum input, usually the quoted input multiplied by (1 + tolerance).

This is separate from price impact. Price impact is the movement caused by the trade against available liquidity or inventory; slippage is the difference between the quote used to prepare the transaction and the execution conditions when it lands. Ethereum.org’s transaction documentation explains why: a broadcast transaction waits in a pool until a validator includes it, during which other transactions can change market conditions.

Choose a tolerance that matches the trade

Start with how much the execution price could move before inclusion, not with a desire to make a transaction succeed at any cost. As rough starting points, deep, stable pairs often use 0.1–0.5%; ordinary liquid trades may call for 0.5–1%; volatile or thinly traded assets may need more, but a larger bound gives execution more room to deliver a worse price.

Trade size matters because a large order can move through several price levels even when the market is quiet. A route with multiple pools or inventory sources can also accumulate quote changes across legs. Compare the quoted output and its implied price with an independent reference, then ask whether the proposed minimum still represents an acceptable trade.

A worked example makes the floor concrete

Suppose a quote for 1,000 USDC is 2,000 units of a token, and you choose 0.7% tolerance. The minimum is 2,000 × 0.993, or 1,986 tokens; execution can return between 1,986 and 2,000 under that bound, while a lower result reverts.

If the quote changes before inclusion to 1,980 tokens, the transaction should fail rather than silently accept the new price. Raising tolerance to 1.5% lowers the floor to 1,970, so it may execute, but the extra 16-token downside is the price of avoiding that revert. For a Fermi swap, judge the quoted output against this same minimum-return logic; a percentage without its resulting token floor is hard to evaluate.

Read a failure as information

A revert caused by the output floor means execution crossed the bound; it does not mean gas is refunded. A reverted on-chain transaction still consumes gas, so repeated attempts with a wider tolerance can cost more while accepting progressively worse execution. First refresh the quote and reassess its price and minimum output; widening the bound is sensible only if that lower output remains acceptable.

Token mechanics can create a further edge case: transfer-tax or rebasing behavior may make the amount received differ from the nominal amount a route expects, causing a valid-looking quote to fail or settle differently. Compatibility depends on the token and execution contract, so a larger tolerance does not reliably fix that mismatch.

Use the narrowest tolerance that covers plausible movement during confirmation while keeping the encoded minimum output above the price you are willing to accept.

Top comments (0)