# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://basedrate.gitbook.io/based-rate/protocol/stable-swap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
