> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# DAMM v1 Formulas

> Mathematical formulas for the DAMM v1 constant-product AMM: price impact, liquidity provision, and fee calculations.

DAMM v1 is a traditional full-range liquidity AMM with multiple curve support.

# Constant Product Curve (xy = k)

The constant product formula maintains liquidity invariance through the following relationships:

## Invariant Formula

```math theme={"system"}
k = \text{token}_a \times \text{token}_b
```

## Liquidity Invariant (D)

```math theme={"system"}
D = \sqrt{\text{token}_a \times \text{token}_b}
```

## Stable Swap Curve (StableSwap)

Implements Curve Finance's StableSwap algorithm via Saber StableSwap.

## Core StableSwap Invariant

```math theme={"system"}
A \cdot n^n \cdot \sum_{i} x_i + D = A \cdot n^n \cdot D + \frac{D^{n+1}}{n^n \cdot \prod_{i} x_i}
```

**Where:**

* `A` = amplification coefficient
* `n` = number of tokens (2 for pairs)
* `x_i` = token amounts
* `D` = invariant

***

# Fee Calculation Formulas

## Trading Fees

### Base Trading Fee

```math theme={"system"}
\text{fee} = \frac{\text{token\_amount} \times \text{fee\_numerator}}{\text{fee\_denominator}}
```

**Where:**

* `fee_denominator` = 100,000
