# Introduction

Stableswap is a type of amm algorithm that offers low slippage trading for two assets that are **highly correlated** in nature. For exmaple, it is very suitable for pairs like `USDC<>FUSD` and `stFlow<>Flow`.&#x20;

The algorithm we're using is solidly stableswap algorithm, a CFMM with the invariant:

$$
x^3 y + x y^3 >= K
$$

It's simple and elegant, doesn't consume a lot of onchain computation units comparing with other complex stableswap algorithms, yet it provides a much smaller slippage than the cpamm dex, and  enables more capital efficiency with the same amount of liquidity.&#x20;

<figure><img src="https://3251356001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOYVGTCPlwadp5cBBtffl%2Fuploads%2FAmGl3zaji3o4OSZEytUZ%2Fcurves.jpg?alt=media&#x26;token=14e7a635-ebf1-441e-8632-a8cb59ca1384" alt=""><figcaption></figcaption></figure>

The original solidly stableswap curve works well for "hard" pegged assets, for example, stablecoins USDC/USDT/FUSD, or different version of bridged BTC like ceWBTC/whWBTC et al., but it's still subject to arbitrages for liquid staking assets (`stFlow`) - as stFlow's value (against flow) increases over time due to the auto-compounding of staking rewards.&#x20;

To make it more suitable for liquid staking pairs, we've extended the original solidly stableswap algorithm further, which we call it "weighted-solidly-stableswap-curve", i.e.:.

$$
(px)^3y +(px)y^3 >= K; s.t.: p = stFlow/Flow
$$

Where `p` is the weight and taken from Liquid Staking smart contracts directly. After each epoch advancement, it'll increase value and then the bonding curve will be adjusted a little bit automatically.

<figure><img src="https://3251356001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOYVGTCPlwadp5cBBtffl%2Fuploads%2FuHHpfGL58nPrEPfsNwe4%2Fimage.png?alt=media&#x26;token=18de9d9b-c145-4a19-a7a3-c69f943bac25" alt=""><figcaption></figcaption></figure>
