> ## Documentation Index
> Fetch the complete documentation index at: https://creator-a1160a86.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Core concepts

Saros DLMM uses Liquidity Book. Liquidity Book core enables the creation
of unique and dynamic liquidity structures for a paired asset market,
as liquidity is pooled in constant price bins which are aggregated to
establish a market.

## Liquidity Book Design

### 1. Reserve Pricing

* Price P = ΔY/ΔX
* Represents value of token X in terms of token Y

### 2. Bin Liquidity

Each bin has Liquidity (L), always measured in quote asset (Y).

Liquidity is conserved as reserve composition changes.

```mermaid theme={null}
graph TD
    L[Liquidity L] --> X[X Reserves]
    L --> Y[Y Reserves]
```

### 3. Bin Composition

* Composition factor c = % of liquidity in Y
* c ∈ \[0,1]
* Bin fully described by (L, c)

> [!NOTE]
>
> **Understanding the Composition Factor**
>
> The composition factor (c) tells you how the liquidity in a bin is split between the two tokens:
>
> * When c = 0: The bin contains 100% X tokens and 0% Y tokens
> * When c = 0.5: The bin contains 50% X tokens and 50% Y tokens
> * When c = 1: The bin contains 0% X tokens and 100% Y tokens
>
> As trades happen, this composition changes (X is swapped for Y or vice versa), but the total liquidity value (L) remains constant. This factor is crucial because it determines what trades can be executed in each bin and how price movement occurs across the market.

### 4. Market Aggregation

All bins combine into the market curve:

* Bins \< market price → only Y
* Bins > market price → only X
* Market price = lowest-priced bin with X reserves

```mermaid theme={null}
graph LR
    Ybins[Y-only bins] --> Market
    Mixed[Active bins<br>mixed X/Y] --> Market
    Xbins[X-only bins] --> Market
```

### 5. Market Making

LPs can:

* Place liquidity around specific price bins
* Customize spreads and ranges
* Adjust bins independently

## Liquidity LifeCycle

### 1. Add / Remove Liquidity

* **Active bin** → must match composition, else auto-swap (with fee)
* **Inactive bin** → add only X or Y (not both)

### 2. Swaps

* Within bin: only composition changes, not price
* If exhausted → move to next bin

```mermaid theme={null}
sequenceDiagram
    Trader->>Bin1: Swap X for Y
    Bin1-->>Trader: Partial Fill
    Bin1->>Bin2: Forward Excess
    Bin2-->>Trader: Complete Fill
```

### 3. Fees

* **Base fee (fb)** – depends on bin step
* **Variable fee (fv)** – based on volatility
* **Protocol fee (fp)** – protocol share

```mermaid theme={null}
graph TD
    Swap[Swap Fees] --> fb[Base Fee]
    Swap --> fv[Variable Fee]
    Swap --> fp[Protocol Fee]
    fb --> LPs[Liquidity Providers]
    fv --> LPs
    fp --> Protocol
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.