StableSwap Deep Dive
Deep dive on StableSwap — how low-slippage stable swaps work, what minOut/deadlines protect, and why LP risk spikes on depegs
This page expands StableSwap concepts: where low slippage comes from, how minOut and deadlines protect you, and how stable‑pool LP risk behaves under stress.
Not investment advice — DEX swaps and LP positions carry depeg, slippage, and smart contract risk.
At a glance
StableSwap curves are designed to keep price impact low when assets stay near the same price.
As a pool becomes imbalanced, price impact increases quickly.
minOutis your explicit “worst acceptable outcome” guardrail.LP risk is not “small” just because assets are “stable”: depegs can concentrate the worse asset into LP positions.
Why StableSwap can have lower slippage (conceptual)
StableSwap pools are designed specifically for pairs where:
both assets are expected to be worth roughly the same (e.g., stable-to-stable), and
the pool can assume prices stay near 1:1 most of the time
Many implementations use an amplification parameter that makes the curve behave “more linear” around the balanced point.
Practical consequence:
small trades around the peg can have lower price impact than a constant‑product AMM
large trades, or trades when the pool is imbalanced, can still have significant slippage
minOut and slippage (worked example)
minOut and slippage (worked example)When you submit a swap, you typically include:
the input amount
a minimum acceptable output (
minOut)a deadline
If the swap would output less than minOut, the transaction reverts.
Example:
quote says you should receive
995token outyou set a slippage tolerance of
0.5%
A rough mental model is:
So minOut ≈ 995 × (1 - 0.005) ≈ 990.025.
This is a rough model. Exact quoting depends on pool math, fees, and route composition.
Deadlines and why they matter
A deadline limits how long your quote is allowed to be “valid.”
Without a deadline, a transaction can sit in the mempool and be mined later under worse conditions:
pool state changed
price moved
MEV/searcher activity increased
A short deadline reduces the window for stale execution, but it can increase reverts during congestion.
LP risk in stable pools (what changes during a depeg)
Stable pools behave very differently when one asset deviates from its peg.
If token A depegs downward:
arbitrage traders swap token B into the pool to buy token A cheaply
the pool becomes heavily weighted toward token A
LPs end up holding more token A and less token B
That is the mechanism behind “stablecoin LP losses under depeg”: the pool composition moves toward the weaker asset.
LP exposure under depeg — two numeric examples
Illustrative numbers — Real StableSwap math is not “constant product,” and real outcomes depend on pool parameters, fees, and trade paths. These examples show the directional effect: under depeg stress, LPs can end up holding mostly the weaker asset.
Example 1 — USDHN depegs down (LP ends up holding more USDHN)
Assume a pool starts balanced:
1,000,000USDHN and1,000,000USDTprices:
USDHN = $1.00,USDT = $1.00you own
10%of the pool
So your “starting” underlying exposure is:
100,000USDHN +100,000USDT (worth$200,000)
Now assume USDHN trades at $0.90 for a period and the pool becomes very imbalanced:
pool ends up at
1,800,000USDHN and200,000USDT (illustrative)
Your 10% share is now:
180,000USDHN +20,000USDT
USD value at the new prices:
180,000 × $0.90 + 20,000 × $1.00 = $182,000
Compare to “just holding” the original tokens:
100,000 × $0.90 + 100,000 × $1.00 = $190,000
The gap is the cost of being forced into more of the depegged asset as the pool rebalances.
Example 2 — USDHN depegs up (LP ends up holding less USDHN)
Assume the same starting pool and 10% share, but now USDHN trades at $1.05.
If the pool becomes imbalanced in the other direction (illustrative):
pool ends up at
200,000USDHN and1,800,000USDT
Your 10% share becomes:
20,000USDHN +180,000USDT
USD value:
20,000 × $1.05 + 180,000 × $1.00 = $201,000
Compare to “just holding” the original tokens:
100,000 × $1.05 + 100,000 × $1.00 = $205,000
Again, the pool pushes your holdings away from the asset the market is bidding up.
Practical checklist (swaps + LP)
Prefer deep liquidity pools and official routes.
Use realistic
minOutand short deadlines.Start with small sizes to validate routing and token behavior.
Only LP if you are comfortable holding either asset in the pool, especially under stress.
Next reads
Main guide: StableSwap DEX
Automation caveats: Zapper Guide
Full risk framing: Risk Disclosure
Last updated