Coffer Docs
For Traders

Price Impact and Slippage

Understand curve impact, output protection, and SDK units

Price impact is the effect of your trade moving along the pricing curve. Slippage tolerance is how much worse than the quoted output you allow execution to be. Impact is already in the quote; tolerance sets the output minimum you sign.

A quote of 100 tokens with 1% tolerance gives a minimum of 99, before integer rounding. Below that minimum, the swap fails and its token movements roll back. Small tolerance does not remove impact already included in the quote.

Choosing an output minimum

Base the minimum on the amount credited to your token account after trading fees and any token transfer fee. This includes dynamic fees. A tighter minimum allows less deterioration but can produce more failed transactions as state changes.

For split routes, inspect the per-pool minima encoded in the instructions. Their sum determines the combined minimum when all legs succeed. Refresh the quote and simulate, but neither step reserves a price against intervening trades, liquidity changes, or authorised updates.

Why a larger trade moves the price more

Each additional unit trades against changing virtual balances. More input relative to that depth generally means more curve impact. Real reserves still limit what can be paid.

Weights also matter. Buying the 80% token produces less relative impact than buying the 20% token for the same fraction of the respective input virtual balance. This does not compare arbitrary equal dollar amounts. See Weights.

Increasing both virtual balances proportionally, with weights and real reserves fixed, increases depth at the same starting price. It reduces curve impact for a given small trade without increasing real payout capacity. See Virtual Liquidity.

How the curve comparison is calculated

Let V be virtual balances, w weights, and x input received by the pool after any input token transfer fee and the base fee. Ignoring integer rounding, dynamic fees, and the output token transfer fee:

spotOutput = x × (V_out × w_in) / (V_in × w_out)
curveOutput = V_out × (1 − (V_in / (V_in + x))^(w_in / w_out))
curveImpact = 1 − curveOutput / spotOutput

spotOutput extends the initial marginal price over the trade; curveOutput includes the price movement along the curve.

SDK units and displayed impact

For the SDK's supported extension profile, it compares spotOut based on input after base fees with amountOut after dynamic fees. Its priceImpactHbps therefore includes dynamic fees alongside curve impact, but does not measure base fees against gross input.

A token charging transfer fees requires a compatible quote implementation that also accounts for net input and net user receipts. An impact number from the narrower SDK profile is not a complete execution estimate for that token.

priceImpactHbps = floor(max(0, spotOut − amountOut) × 1,000,000 / spotOut)
minAmountOut = floor(amountOut × (1,000,000 − slippageHbps) / 1,000,000)

At zero spotOut, the SDK returns zero impact. SDK 10_000 hundredths of a basis point means 1%; the app uses ordinary basis points, where 100 means 1%. Convert units before passing UI values to SDK parameters. See Pricing Model for fixed-point rounding and decimals.

On this page