*2.3. Combination of Constant Sum and Constant Product Markets*

In DeFi, there are assets that have the same value, for example, a different version of USD (USDC, USDT, etc.). Because the ratio between asset *x* and asset *y* in such pools is stable and close to 1, they are called *stableswap* pools. The pricing formula for stableswap pools was developed by the Curve team [32]. Essentially, this is a combination of the constant product market pricing formula *xy* = *k* and the linear invariant *x* + *y* = *C*. The rationale behind adding the linear invariant term to the constant product formula is to achieve the closer peg 1:1 and allow lower slippage for stableswap pools. When using only a linear invariant formula, tokens are always traded at 1:1 with zero slippage; however, this might lead to the depleting of the pool's one token. Using only a constant product formula leads to larger slippage and a less stable peg. Therefore, the combination of these two curves allows to keep the pool balanced while providing a more stable peg.

The final stableswap curve formula looks as in Equation (8). For the full explanation and derivation, refer to the paper [33].

$$2^2A(x+y) + D = 2^2AD + \frac{D^3}{2^2xy} \tag{8}$$

where *A* is the amplification factor for the linear invariant curve—the larger the *A*, the closer the curve to the linear. *D* is the total amount of tokens in the pool.

To calculate the price for the token, one needs to express the curve for *y* from Equation (8), and the derivative of that expression stands for the price. Stableswap AMM is widely used in many DEX pools that have the same price for both tokens.
