> For the complete documentation index, see [llms.txt](https://voyage.gitbook.io/voyage/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://voyage.gitbook.io/voyage/staking-and-tokenomics/formulas.md).

# Formulas

Curve Finance utilizes a **StableSwap invariant** to facilitate efficient stablecoin trading with low slippage. The invariant ensures that the pool remains balanced.

**Formula:**

$$
A \cdot n \cdot \sum\_{i=1}^{n} x\_i + D = A \cdot D + \frac{D^{n+1}}{n^n \cdot \prod\_{i=1}^{n} x\_i}
$$

**Components**

* ***A*****:** Amplification coefficient, controlling the sensitivity of the invariant to price changes.
* ***n*****:** Number of tokens in the pool.
* ***x\_i*****:** Balance of the iᵗʰ asset in the pool.
* ***D*****:** Total supply of liquidity tokens, representing the combined assets in the pool.

Uniswap V2 operates on the **Constant Product Market Maker (CPMM)** model, ensuring that the product of the reserves of the two assets remains constant.

**Formula:**

$$
x \cdot y = k
$$

**Components**

* ***x*****:** Reserve of Token X in the liquidity pool.
* ***y*****:** Reserve of Token Y in the liquidity pool.
* ***k*****:** Constant product, remains unchanged before and after any trade.

Uniswap V3 introduces **Concentrated Liquidity**, allowing liquidity providers to allocate their capital within specific price ranges, enhancing capital efficiency.

**Formula**

The core formula related to liquidity in a given price range is:

$$
L = \frac{\sqrt{P\_{\text{high}}} \cdot \sqrt{P\_{\text{low}}}}{P\_{\text{high}} - P\_{\text{low}}}
$$

**Components**

* ***L*****:** Liquidity provided within the specified price range.
* ***P*****\_*****high*****:** Upper price bound of the liquidity range.
* ***P*****\_*****low​*****:** Lower price bound of the liquidity range.
