# How Bonding Curves Work

Streamlock uses an automated market maker (AMM) with a constant-product bonding curve to determine token prices.

***

## What is a Bonding Curve?

A bonding curve is a mathematical formula that automatically sets the price of a token based on its supply. Instead of relying on order books or market makers, the price is determined algorithmically.

**Key principle**: As more tokens are bought, the price goes up. As tokens are sold, the price goes down.

***

## The Constant Product Formula

Streamlock uses the `x * y = k` formula (also known as constant-product):

```
SOL_reserves × Token_reserves = constant
```

This means:

* When you buy tokens, you add SOL to the pool and remove tokens
* The constant (k) must stay the same
* This automatically increases the price per token

***

## Example

Imagine a pool starts with:

* 100 SOL
* 1,000,000 tokens
* k = 100 × 1,000,000 = 100,000,000

**You buy tokens with 10 SOL:**

1. Pool now has 110 SOL
2. To maintain k: 110 × new\_tokens = 100,000,000
3. New token amount: 909,091 tokens
4. You receive: 1,000,000 - 909,091 = **90,909 tokens**

The price per token increased because the same constant (k) now applies to more SOL and fewer tokens.

***

## Why This Matters for You

### Predictable Pricing

* No waiting for someone to fill your order
* Price is determined instantly by the formula
* Large buys/sells have more price impact (slippage)

### Always Liquid

* The pool always has both SOL and tokens
* You can always buy or sell (within limits)
* No need for counterparties

### Price Discovery

* The market naturally finds equilibrium
* High demand → price rises
* Low demand → price falls

***

## Slippage

When you trade, the price changes during your transaction. This difference between expected and actual price is called **slippage**.

* **Small trades**: Minimal slippage
* **Large trades**: Significant slippage

Streamlock shows you expected slippage before you confirm any trade.

***

## Throughput Caps

To prevent single actors from manipulating prices, Streamlock has **epoch-based throughput caps**:

| Action  | Cap per 5-minute window                 |
| ------- | --------------------------------------- |
| Buying  | 2% of total token supply                |
| Selling | 0.5% of initial SOL liquidity (default) |

If you exceed the cap, your transaction will be split or require waiting for the next epoch.

***

## How This Connects to Price Targets

The bonding curve determines the **current market price**. Your tokens unlock based on how this price compares to your **target price**.

```
Current Price (from bonding curve) → compared to → Target Price (your goal)
                                          ↓
                              Unlock percentage calculated
```

Learn more in [Target Price & Unlocks](https://streamlock.gitbook.io/streamlock-docs/core-concepts/target-price).
