> For the complete documentation index, see [llms.txt](https://docs.surged.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.surged.fun/integration/curve.md).

# The curve

Every launch begins as a bonding curve: one contract that is the only place the token trades until it graduates. It holds the whole supply and sells it, and it is the buyer of last resort when someone sells back. There is no order book and no liquidity provider. The price comes out of a formula.

## The warehouse

Think of the curve as a warehouse with two shelves: one of USDC and one of tokens. The product of the two shelves never changes on a trade, which is the constant-product rule Uniswap made familiar. Take tokens off one shelf and you must put enough USDC on the other to keep the product where it was. The fewer tokens are left, the more USDC each one costs.

The USDC shelf does not start empty, or the first token would be free. It starts with a **phantom reserve**: a number the contract pretends is there so the opening price is sensible. On Surged today that is 4,500 USDC against a supply of 1,000,000,000 tokens. Nobody deposited it and nobody can withdraw it. It only exists to set the opening price.

## What that means in numbers

For the launch configuration in use today:

|                 |                           |
| --------------- | ------------------------- |
| Supply          | 1,000,000,000 tokens      |
| Phantom reserve | 4,500 USDC                |
| Graduation at   | 12,000 USDC collected     |
| Trade fee       | 1%                        |
| Creator tax     | set per launch, up to 10% |

`GET /config` returns these live, and you should read them from there rather than copying the numbers: they are per launch configuration and can change for future launches.

## Pricing a trade yourself

The formula is in `@surged/sdk` and the package's tests compare it, trade by trade, against what the contracts compute for the same sequence. So you can price locally, with no RPC call:

```ts
import { curveStateFromApi, previewBuy } from '@surged/sdk'

const launch = await fetch(`${API}/launches/${token}`).then((r) => r.json())
const quote = previewBuy(curveStateFromApi(launch), 10n * 10n ** 18n, { currentBlock })
```

`previewBuy` returns what you spend, what you receive, and each charge separately. See [Quoting a trade](/integration/sdk/quoting.md).

## Chaining quotes

`applyBuy` and `applySell` return the state after a trade, so you can simulate a sequence without touching the chain. This is how the frontend prices a bundle of buys that all land in the same block:

```ts
import { applyBuy, previewBuy } from '@surged/sdk'

let state = curveStateFromApi(launch)
for (const amount of amounts) {
  const quote = previewBuy(state, amount, { currentBlock })
  state = applyBuy(state, quote)
}
```

## Reserved tokens

Not all of the supply is for sale. A slice is held back for the Uniswap pool the token graduates into, so the pool opens with real depth instead of whatever happens to be left. `sellableTokens(state)` tells you how many are still on sale; `reservedTokens` is the part that will never be sold on the curve.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.surged.fun/integration/curve.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
