Constant-product pools price swaps by preserving a reserve product in a fee-free model. StableSwap adds amplification that makes the curve flatter near a reference ratio, so similarly valued assets can trade with less price impact. The flatter region has limits: larger imbalances change the price, and a lasting depeg can leave liquidity providers holding much more of the weakened asset.
The useful comparison holds the starting inventory constant, changes the invariant and measures the same trade. A small near-peg quote answers one question. The inventory accumulated when the external price changes answers another. Both matter before interpreting “stable” as a property of the assets or the execution price.
Start with the reference ratio
An automated market maker uses a mathematical relationship between reserves to determine available output. For a two-token, fee-free constant-product pool, that relationship is x × y = k. Adding X increases x; Y leaves until the product is restored. The marginal price of X, measured in Y, is y/x. These are the mechanics underlying the Uniswap v2 whitepaper, whose deployed design also adjusts the invariant for swap fees.
StableSwap was developed for assets expected to trade near a common value. It combines a flatter region near balance with increasing curvature as reserves become imbalanced. A constant-sum rule could exchange one normalized unit for another until one reserve ran out; StableSwap's curved outer region changes the exchange rate instead. The original StableSwap paper explains this construction.
“Normalized” is essential. One token unit need not equal one unit of another token. A receipt representing an increasing amount of an underlying asset may require a conversion rate. Curve's current documentation describes rate and vault asset types that adjust the reference ratio. Raw token counts alone can therefore misidentify balance. Curve's explanation of StableSwap assets and rates.
| Question | Constant-product model | StableSwap model |
|---|---|---|
| What shapes the quote? | Reserve product | Amplified invariant and normalized reserves |
| What happens near equal reserves? | Price moves with each finite trade | Price moves more slowly with sufficient amplification |
| What happens under large imbalance? | Output rate deteriorates continuously | The flatter region gives way to much steeper price changes |
| Does the formula establish redemption value? | No | No |
The last row prevents a common category error. An AMM can quote an exchange between tokens. That quote cannot establish whether either issuer, bridge or redemption mechanism will honor a claim.
Give both pools exactly the same starting assets
Consider a hypothetical pool with 1,000,000 X and 1,000,000 Y. Both are already expressed in comparable units, the initial marginal rate is 1 Y per X, and each is initially valued externally at $1. These are declared assumptions, not observations about named stablecoins.
Use continuous arithmetic with no swap fees, gas, transfer taxes, rounding, rate changes, deposits or withdrawals. Each trade-size comparison below restarts from this same state. It is not a sequence of trades.
For constant product, k is one trillion. After an input of q X, the new X reserve is x = 1,000,000 + q; the new Y reserve is y = k/x. Output is the original Y reserve minus y.
For StableSwap, use the original paper's two-coin equation. Let C represent four times the paper's amplification parameter A. The left side is C × (x + y) + D; the right side is C × D + D³/(4xy). Hold the two sides equal during a trade. At the balanced starting state, D is 2,000,000.
Set paper A to 100, so C is 400. Given the new x, solve for the positive y that satisfies the equation, then subtract it from 1,000,000. This explicitly defines the model; it does not prescribe a live pool's interface setting.
| X input | Constant-product Y output | StableSwap Y output, paper A = 100 | StableSwap average Y per X |
|---|---|---|---|
| 10,000 | 9,900.99 | 9,999.50 | 0.999950 |
| 100,000 | 90,909.09 | 99,949.78 | 0.999498 |
| 500,000 | 333,333.33 | 498,355.19 | 0.996710 |
| 1,000,000 | 500,000.00 | 952,437.54 | 0.952438 |
Identical starting balances produce very different outputs. This is why an asset total cannot stand in for a quote. The DEX TVL versus active liquidity guide reaches that issue through position ranges; here the difference comes from the invariant itself.
Rebuild the 100,000 X swap
Constant product ends with 1,100,000 X and approximately 909,090.91 Y. The trader receives 90,909.09 Y. Relative to the initial one-for-one rate, the average output shortfall is 1 − 90,909.09/100,000, or approximately 9.0909%.
The StableSwap solution ends with the same 1,100,000 X but approximately 900,050.22 Y. The trader receives 99,949.78 Y. The corresponding average shortfall is approximately 0.0502%.
These percentages measure the effect of this trade on output relative to the starting marginal rate. They exclude fees and do not describe a transaction's slippage tolerance. A tolerance is an acceptance limit set for execution; it does not flatten the curve.
The final marginal rate also differs from the average received across the whole trade. After this swap, the constant-product marginal rate is about 0.826446 Y per X, while the StableSwap rate is about 0.998986. The trader traversed a curve to reach that endpoint. Pricing the entire trade at either the starting or ending marginal rate would give the wrong output.
The larger rows show the limit of extrapolating the smallest quote. At a one-million-X input, StableSwap's average output is already about 4.7562% below one-for-one. Its flatter central region has not created unlimited inventory at a fixed price.
Amplification needs an equation convention
Reducing paper A from 100 to 10, with every other assumption unchanged, lowers the 100,000-X output to approximately 99,521.77 Y. The average shortfall rises to about 0.4782%. Amplification controls how much imbalance the model accommodates before its price changes substantially; it does not add tokens to the pool.
A displayed A value is not portable without checking its definition. For example, the observed Curve Stableswap-NG source uses an internal amplification value, an A_PRECISION scaling factor and a coefficient formed with the coin count. In a two-coin instance, internal amp = 20,000 with A_PRECISION = 100 gives C = 400 and public A = 200, matching paper A = 100 in continuous arithmetic. The public getter truncates precision, so use the precise internal value when checking a ramp. This is a notation check, not a live-pool setting recommendation. Curve Stableswap-NG pool source.
That distinction also separates mechanism research from execution. The arithmetic here deliberately follows the original two-coin equation. A quote for a deployed pool needs that pool's implementation, current parameters and actual token normalization.
Change the external price and inspect the inventory
Now take a separate hypothetical scenario. Restart each model at the original equal reserves, then suppose X's external price falls to 0.90 Y while Y retains its reference value. Assume that external price persists and fee-free arbitrage trades against each unchanged curve until its marginal output rate also reaches 0.90 Y per X.
For constant product, solve the reserve product together with y/x = 0.90. For StableSwap, first define T = D³/(4xy). With X entering and Y leaving, the positive marginal output rate is p = −dy/dx. Obtain p by dividing C + T/x by C + T/y. Solve the invariant with p set to 0.90. The results are rounded below.
| Model at marginal rate 0.90 Y/X | Ending X reserve | Ending Y reserve | Y removed from initial reserve |
|---|---|---|---|
| Constant product | 1,054,092.55 | 948,683.30 | 51,316.70 |
| StableSwap, paper A = 10 | 1,578,573.76 | 442,935.84 | 557,064.16 |
| StableSwap, paper A = 100 | 1,864,756.70 | 148,321.07 | 851,678.93 |
The high-amplification model exchanges far more Y for X before its marginal price reaches the new external ratio. That is the inventory consequence of being willing to offer rates near the old ratio over a wider region. The mechanism that helped an ordinary near-peg swap now leaves the pool with much more X.
This is a mechanical endpoint, not a forecast of how quickly traders respond or a prediction of recovery. Actual fees create an arbitrage band; withdrawals, parameter changes and further price moves alter the path. Curve's amplification discussion explicitly connects tighter near-peg liquidity with sharper deterioration away from the peg.
Do not turn the reserve table into an LP return without adding valuation and the correct benchmark. The impermanent loss versus holding example explains that separate comparison. A friendly swap quote does not establish a favorable return for the capital providing it.
Convert the comparison into a quote worksheet
For an actual intended swap, retain the following evidence together. Leave a field unresolved when the information is unavailable; substituting a guessed default can make a precise calculation wrong.
| Evidence | Validation step |
|---|---|
| Chain, pool address and implementation | Identify the exact curve and contract being quoted |
| Block reference and observation time | Keep reserves, rates and parameters on the same state |
| Token contracts, decimals and conversion rates | Confirm which quantities are raw tokens and which are normalized |
| Amplification definition and current value | Reconstruct the equation's coefficient, including precision scaling |
| Trade direction and gross input | Quote the actual instruction at several relevant sizes |
| Output after swap fees; network cost in its own denomination | Retain token output and gas cost separately; state a conversion rate for any combined comparison |
| External reference ratio and redemption evidence | Test whether “near peg” remains an appropriate premise |
Curve's Stableswap-NG integration documentation provides one implementation example: get_dy estimates output for a defined input, while swaps accept a minimum output. NG also uses state-dependent fees, so applying one assumed fixed deduction to every row above would not reproduce all NG quotes. Curve's integration and quoting documentation.
Use an external reference appropriate to the asset claim. A pool's own current price is produced by its reserves; it cannot independently validate the value of those same reserves. The TWAP oracle versus spot price guide explains how averaging changes that measurement without guaranteeing an asset's peg.
Where the assets are staking receipts, distinguish what each token represents before comparing normalized balances. Liquid restaking versus liquid staking tokens examines the additional claim layers. A shared underlying denomination does not make two redemption processes interchangeable.
Finally, refresh the quote before execution and check its direction. An imbalanced pool can offer quite different outcomes when buying the depleted asset versus returning it. Preserve the recipient's minimum acceptable output alongside the quote. Choose that limit from the amount the transaction must deliver, with fees and costs visible, rather than from the word “stable” in the pool's name.
