Skip to content
docs

SlippageClass

SlippageClass = "stable" | "major" | "other"

Defined in: protocol-swap2-core/src/slippage.ts:20

Auto slippage — how far below the quoted output a swap may settle before it reverts or refunds. Slippage covers price movement between the quote and execution, so it is sized by what moves the price in that window:

  • the pair: stablecoin ↔ stablecoin barely moves, majors move a little, everything else more (the base);
  • the trade’s own price impact: a large order in a thin pool is more exposed to the next trade landing first;
  • time to settle: same-chain swaps land in seconds, cross-chain routes take minutes (ignored for stable ↔ stable, where the price does not drift);
  • recent volatility of the more volatile side, when the app knows it.

The sum is clamped to [minBps, maxBps]. A higher slippage is not free on a same-chain EVM swap: a sandwich bot can take up to all of it, so the bases stay small and room is added only where it is needed. Route policy lives in the app: it decides whether to use this, show it, and let the user override.