> For the complete documentation index, see [llms.txt](https://basedrate.gitbook.io/based-rate/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://basedrate.gitbook.io/based-rate/protocol/stable-swap.md).

# Stable Swap

Understanding Stable Swap.

## Stableswap Simplified

Stableswap is a smart trading system that helps keep stablecoin prices stable. It works like this:

1. **Stable Prices:** Stableswap maintains a 1:1 price ratio for stablecoins, like keeping $1 as $1. This ensures stability in prices.
2. **Smooth Trading:** It offers efficient and low-cost trading, making it easy for users to swap stablecoins.

**Benefits:**

* **Price Stability:** Stableswap keeps stablecoin prices steady, making them reliable for everyday use.
* **Low Costs:** It offers affordable trading, so users can swap stablecoins without high fees.
* **Efficiency:** Trading is fast and straightforward, making it user-friendly for everyone.
* **Liquidity:** Stableswap provides ample liquidity, ensuring there are enough stablecoins for trading.

In summary, Stableswap ensures stable prices, low fees, and easy trading for more stabled assets.

## A Technical Deep Dive

Stableswap, introduced by Michael Egorov, founder of Curve Finance in 2019, aims to create concentrated liquidity around a 1:1 price range for efficiency and low slippage. This differs from CP-AMM curves.

Imagine a liquidity pool always swapping at a constant, one-dollar rate: x + y = D (x, y: token amounts, D: constant) This is a CS-AMM (Constant-sum Automated Market Maker) curve, ensuring a 1:1 rate but faces issues when stablecoins become volatile.

Stableswap combines CS-AMM around 1:1 and CP-AMM beyond. The formula: χD(x + y) + xy = χD² + (D/2)² χ is a key factor; large χ near equilibrium mimics CS-AMM, while χ near zero resembles CP-AMM.

Stableswap defines χ as: χ = Axy / (D/2)² A is a constant, larger A near equilibrium, closer to CS-AMM; χ approaches 0 away from equilibrium.

The Stableswap formula: 4A(x+y) + D = 4AD + D³/(4xy)

It provides a flat region around equilibrium and CP-AMM shape beyond.

Stableswap offers higher depth around the center compared to CP-AMM. For A=2,000, it provides 168 times more liquidity at 1% depth.

Stableswap also offers thicker liquidity around the center (±27% with A=50) compared to CP-AMM. With A=2,000, it focuses on ±6.7%.

In summary, Stableswap maintains efficient 1:1 trading and provides thicker liquidity.
