Raydiumswap

Raydiumswap slippage: Quote Changes, Output Limits, and Failed Swaps

Raydiumswap slippage measures the change from quoted to executed output for the same input amount in a token swap. For an exact-input swap, the transaction enforces a minimum received amount based on its configured tolerance. Pool prices can change while the transaction waits, causing execution to fail when that minimum can’t be met. Unexpected output also needs a separate check of price impact, route liquidity, and any applicable token transfer fees.

Moving Pool Prices and Stale Quotes

Pool prices can move between quotation and execution because other swaps change reserves or liquidity along the selected route. Signing doesn’t reserve the quoted state. Wallet approval delays and competition for transaction inclusion leave room for intervening trades. Liquidity withdrawals can also reduce the output available for a particular amount, turning an acceptable estimate into execution below the transaction’s minimum.

Quote age alone doesn’t prove the cause. An older estimate can remain accurate in unchanged conditions; a recent estimate can become unsuitable quickly. A changed route or input amount also changes the comparison. The expected and observed quantities need to describe the same exchange.

Quoted Output and Minimum Received

Quoted output estimates what the selected input should buy, while minimum received defines the output floor that the transaction must satisfy.

The Bound Before Signing

The tolerance setting helps the transaction builder calculate that floor. A wider tolerance generally permits lower output for the same quote. The minimum is an acceptance condition, so meeting it doesn’t promise the full estimate. A swap can succeed below its quoted output when the applicable bound still holds.

The signed transaction contains the operative bound. An earlier screenshot can describe a different quote, especially after a refresh or amount change.

The Amount After Execution

Successful transaction details identify the output transfers and receiving accounts. For token-account output, compare the balance change using the correct mint and units. An intermediate routed transfer doesn’t necessarily represent final spendable output. Transaction-specific records separate the swap’s proceeds from unrelated wallet activity.

For an unchanged input, quoted output minus comparable received output measures the shortfall in output tokens. Dividing that difference by quoted output gives the relative shortfall. A favorable pool-price change can produce more output than the quote. The minimum doesn’t cap such an improvement.

Price Impact and Tradable Liquidity

Price impact describes how the swap itself moves through available liquidity, whereas quote-to-execution slippage reflects changes after the pricing estimate.

Constant-Product Reserves

Raydium’s constant-product market maker, or CPMM, calculates output from the trade amount and usable reserves, accounting for applicable fees. Larger input relative to reserves generally produces worse average execution. That effect belongs in the quote. A high-impact trade can execute close to its estimate if pool conditions stay stable. Comparing received output with a chart’s spot price mixes these different effects.

Concentrated Liquidity Across Price Ranges

Raydium’s concentrated liquidity market maker, or CLMM, trades through liquidity supplied within price ranges. Crossing initialized ticks can change active liquidity. Total deposited value includes liquidity provision outside the prices traversed by a swap, so it doesn’t describe depth along that path. Smaller input can reduce the trade’s price impact, while also changing its quoted output.

Route Depth and Intermediate Pools

Multi-pool routes depend on every participating pool’s liquidity and prices, so an intermediate change can affect final output. Earlier output supplies a later leg. A direct route avoids that dependency, although a deeper alternative route can quote more output. Hop count alone doesn’t identify better execution. Net quoted output and liquidity at the traded size matter together. A refreshed quote can select a different path.

How Much Slippage Tolerance Should I Allow?

Slippage tolerance should reflect the lowest output you can accept for the quoted input, alongside possible price movement before execution. Tight tolerance can reject swaps after modest adverse movement. Wider tolerance permits more deterioration; it doesn’t add liquidity or improve the quote. Choosing a percentage solely because an attempt failed can authorize a materially worse exchange.

A loose bound leaves more room for unfavorable transaction ordering, including sandwich attacks that place trades around a victim’s swap. The bound doesn’t establish why prices changed or guarantee protection from every ordering strategy. An unacceptable refreshed quote calls for different terms or a pause. Waiting avoids committing now, although later prices may improve or worsen.

Token Units and Net Received Amounts

Token quantities must use the same mint, decimal scale, and gross-or-net basis when comparing quoted and received output. Instructions use integer token base units; interfaces usually show decimal amounts. Display rounding can hide differences near a threshold. The mint’s decimal setting determines the conversion. Token names alone don’t establish identity, and changing currency valuations don’t measure delivered token quantities.

Eligible Token-2022 tokens can charge transfer fees when their mints enable that extension. A gross transfer amount can exceed the spendable amount credited to its recipient. Raydium’s CPMM exact-input instruction checks its minimum against output after any applicable output transfer fee. Subtracting a fee again from a quote that already includes it creates a false discrepancy.

Native SOL output needs separate accounting when wrapped SOL is unwrapped through account closure. The native balance change can also include network fees and recovered account storage funds, so it isn’t necessarily the swap output alone.

Slippage Errors, Expiry, and Submission Status

Transaction status and the failing instruction distinguish a price-bound failure from expiry, submission trouble, or an unrelated account error.

An Output or Input Bound Failure

CPMM reports ExceededSlippage when its output minimum or input maximum isn’t met. CLMM distinguishes TooLittleOutputReceived from TooMuchInputPaid. Error names need the pool program’s context; a generic wallet failure message doesn’t establish a slippage cause. Simulation can report a bound failure before submission, while an included transaction can encounter a changed state during execution.

A failed instruction reverts the swap’s state changes within that Solana transaction. Separately completed setup transactions retain their own outcomes. Network fees can still apply to a transaction processed on-chain, even when its swap fails.

An Expired Blockhash

A transaction using a recent blockhash becomes ineligible for inclusion when that blockhash expires. Higher tolerance doesn’t renew it. Quote freshness and transaction validity are separate conditions: a valid transaction can carry an obsolete estimate, while a fresh quote can’t rescue expired transaction bytes.

A Signature Without Confirmation

A submission response can return a signature before execution is confirmed. The signature identifies the transaction without proving delivery. Before signing a replacement, confirm that the original swap failed or verify expiry with no earlier execution recorded in its transaction history. An unavailable or incomplete history lookup leaves the outcome unresolved. Finalized status still needs an error-free execution record. Creating replacements while the original remains unresolved can produce multiple successful exchanges.

Retry or Wait After a Minimum-Output Failure

A hypothetical exact-input swap fails after intervening trades reduce its available output below the original minimum. The input amount must stay fixed, and the exchange remains useful only at or above the required output floor.

Changing tolerance accepts a different output boundary. Keeping the original floor preserves the requirement while leaving the next execution dependent on future pool conditions.

Fixed Input Versus Fixed Output

Exact-input swaps constrain the starting token amount, while exact-output swaps target an output amount and enforce a maximum permitted input. Raydium’s CPMM and CLMM programs support both protections; availability depends on the selected interface and route. With exact output, an adverse price move can push required spending above the cap and reject execution.

Raydiumswap slippage: Fixed Input Versus Fixed Output - illustration

Open full-size image

With partial fills disabled, fixed input suits a defined spending amount with variable output at or above its floor. Exact output suits a defined receiving amount with variable spending at or below its ceiling. A CLMM swap with a nonzero sqrt_price_limit_x64 can stop at its price limit with input or target output remaining, provided the applicable amount bound is met. Choosing between them changes which side stays predictable; neither mode removes liquidity constraints.

Questions people ask about Raydiumswap slippage

Will Changing the Slippage Setting Alter a Swap I’ve Already Signed?

Changing an interface setting doesn’t alter the bound inside an already signed transaction. A different bound changes the transaction message and requires a new signature. The original transaction retains its existing terms if submitted, so its status still matters before a replacement swap is authorized.

How Are Basis Points Converted to a Slippage Percentage?

One basis point equals 0.01 percentage points, so divide a basis-point value by 100 to express it as a percentage. Raydium’s Trade API uses slippageBps for this setting. Confusing percentage input with basis points changes the requested tolerance, so integration code must use the units that its particular method expects.

Can Skipping Preflight Bypass a Raydium Slippage Limit?

Skipping preflight doesn’t bypass the slippage check that the pool program performs during execution. Preflight simulates the transaction before submission; disabling it removes that preliminary check. The on-chain instruction still rejects output below its applicable minimum or input above its applicable maximum, and a processed failed transaction can incur network fees.

Does a Successful Simulation Reserve the Quoted Pool Price?

A successful simulation doesn’t reserve liquidity or lock the pool price for the eventual swap. It evaluates execution against the state used for that simulation. Intervening trades or liquidity changes can produce a different state before inclusion, so a simulated success can still become an on-chain slippage failure.

When Can a CLMM Swap Leave Some Input Unspent?

For an exact-input CLMM swap, a nonzero sqrt_price_limit_x64 can leave input unspent at its price limit if the output minimum is met. With that parameter set to zero, the instruction requires the specified input to be consumed. Availability depends on the transaction builder and interface.

Are Priority Fees a Substitute for Slippage Protection?

Priority fees don’t replace the output minimum or input maximum in a swap instruction. They influence transaction scheduling, which can affect the delay between quoting and execution. They don’t improve pool liquidity or guarantee the quoted price, and faster inclusion remains compatible with an adverse price move.

- last updated