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

# Liquidity

> Understanding LP tokens, pool reserves, and liquidity on the XYZ AMM

# Liquidity

Liquidity in the XYZ AMM comes from the tokens and XYZ deposited into each pool. When a token graduates from the launchpad, its bonding curve reserves automatically become the initial liquidity in the AMM pool.

## How Liquidity Is Created

Unlike traditional AMMs where users deposit liquidity manually, XYZ AMM pools are seeded automatically during [graduation](/launchpad/graduation):

1. Token reaches its dynamic XYZ graduation threshold on the launchpad
2. All XYZ reserves move to a new AMM pool as the XYZ side
3. All unsold tokens move to the pool as the token side
4. An LP token contract is created to track the pool shares

This ensures every graduated token starts with deep liquidity from day one.

## LP Tokens

Each AMM pool has an associated **LP (Liquidity Provider) token** -- a CW20 token that represents a proportional share of the pool's reserves.

| Property     | Details                                           |
| ------------ | ------------------------------------------------- |
| Standard     | CW20                                              |
| Represents   | Proportional share of both XYZ and token reserves |
| Value growth | Increases as swap fees accumulate in the pool     |

### How LP Value Grows

Every swap charges a fee (1% base + optional augmented fee). These fees stay in the pool, increasing both reserves. Since LP tokens represent a share of the pool, their backing value increases with every trade.

```
Pool at creation:      [threshold XYZ] + ~20,690,000 tokens
After trading volume:  reserves grow as fees accumulate
```

LP holders earn proportionally from all trading activity without taking any action.

## Pool Mechanics

The AMM uses the **constant product formula**:

```
xyz_reserve * token_reserve = k
```

When someone swaps XYZ for tokens:

* `xyz_reserve` increases (XYZ added to pool)
* `token_reserve` decreases (tokens removed from pool)
* `k` increases slightly (fees stay in the pool)

When someone swaps tokens for XYZ:

* `token_reserve` increases
* `xyz_reserve` decreases
* `k` increases slightly

## Querying Pool State

Check any pool's current reserves and price:

```json theme={null}
{ "pool": { "token_address": "<cw20_token_address>" } }
```

```typescript theme={null}
{
  token_address: string;
  xyz_reserve: string;      // XYZ in the pool (uxyz)
  token_reserve: string;    // Tokens in the pool
  lp_token_address: string; // LP token contract address
  lp_total_supply: string;  // Total LP tokens minted
  price: string;            // Current price (XYZ per token)
}
```

## Impermanent Loss

<Accordion title="What is impermanent loss?">
  Impermanent loss occurs when the price of tokens in a pool changes relative to when liquidity was provided. If you hold LP tokens and the price moves significantly in either direction, you may have less total value than if you had simply held the assets outside the pool.

  However, trading fees earned by the pool can offset impermanent loss. Pools with high trading volume relative to their size tend to earn enough fees to more than compensate.

  For XYZ AMM pools, initial liquidity comes from the graduation process rather than individual LPs, so impermanent loss primarily affects anyone who acquires LP tokens on the secondary market.
</Accordion>

## Augmented Fee

Newly graduated pools may have a temporary **augmented fee** (up to 5%) on top of the base 1% swap fee. This extra fee:

* Accelerates LP value growth during the initial trading period
* Auto-disables once the pool reaches a target total value
* Ensures fair price discovery for newly graduated tokens

Check the augmented fee status:

```json theme={null}
{ "augmented_fee_status": { "token_address": "<cw20_token_address>" } }
```

```typescript theme={null}
{
  active: boolean;                  // Whether the augmented fee is active
  augmented_fee_bps: number;        // Extra fee in basis points
  lp_target_uxyz: string;           // Pool value target
  current_pool_value_uxyz: string;  // Current pool value (2 * xyz_reserve)
  progress_percent: string;         // Progress toward target (e.g. "75.50")
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Swapping" icon="repeat" href="/amm/swapping">
    Trade tokens on the AMM
  </Card>

  <Card title="Launchpad" icon="rocket" href="/launchpad/overview">
    Where AMM liquidity originates
  </Card>
</CardGroup>
