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

# Launches

> The launch table: one row per token with its curve parameters, progress towards graduation, last price, volume, trade and holder counts.

`launch` is the table behind the launch cards and the token page. One row per launch, keyed by the launch token address, updated on every trade, graduation and holder change.

## Fields

| Field                           | Type        | Unit                  | Meaning                                                                                                   |
| ------------------------------- | ----------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
| `token`                         | hex         | address               | Launch token address. Primary key.                                                                        |
| `launchIndex`                   | bigint      |                       | Position in `LaunchFactory.getLaunch(index)`.                                                             |
| `curve`                         | hex         | address               | The launch's `BondingCurve` clone.                                                                        |
| `creator`                       | hex         | address               | Who called `createLaunch`.                                                                                |
| `code`                          | hex         | bytes32               | Currency code, hex encoded.                                                                               |
| `currency`                      | text        |                       | Decoded currency code, for example `"USD"` or `"INR"`.                                                    |
| `quoteAsset`                    | hex         | address               | The ERC-20 the curve is quoted in (the dollar, EURC, or a Windrose currency token).                       |
| `quoteDecimals`                 | int         |                       | Decimals of `quoteAsset`: 6 for the dollar and EURC, 18 for Windrose currencies.                          |
| `name`, `symbol`                | text        |                       | From `LaunchMetadata`. Empty until that event is indexed (same transaction as creation).                  |
| `metadataURI`                   | text        |                       | Usually a `data:application/json;base64,` URI holding `name`, `description` and a small `image` data URL. |
| `createdAt`                     | bigint      | unix seconds          |                                                                                                           |
| `createdBlock`, `createdTxHash` | bigint, hex |                       |                                                                                                           |
| `virtualQuote`                  | bigint      | quote units           | Virtual quote reserve, sized from 6,000 USD at the oracle rate at creation.                               |
| `virtualToken`                  | bigint      | 18 decimals           | Virtual token reserve (375,000,000 tokens by default).                                                    |
| `curveSupply`                   | bigint      | 18 decimals           | Tokens sold on the curve (750,000,000 by default).                                                        |
| `graduationQuote`               | bigint      | quote units           | Real quote that fills the curve (12,000 USD equivalent at creation).                                      |
| `tokensSold`                    | bigint      | 18 decimals           | Current curve progress.                                                                                   |
| `realQuote`                     | bigint      | quote units           | Quote held by the curve. `realQuote / graduationQuote` is the progress bar.                               |
| `ready`                         | boolean     |                       | Curve is full; trading on it is closed.                                                                   |
| `graduated`                     | boolean     |                       | `graduate()` has run and the pool exists.                                                                 |
| `graduatedAt`                   | bigint      | unix seconds          | `null` until graduated.                                                                                   |
| `poolId`                        | hex         | bytes32               | Uniswap v4 pool id, `null` until graduated.                                                               |
| `positionTokenId`               | bigint      |                       | The locked full-range position, `null` until graduated.                                                   |
| `lastPriceQuote`                | bigint      | quote per token, 1e18 | Spot price after the last indexed trade (the initial curve price before any trade).                       |
| `lastPriceUsd`                  | bigint      | USD per token, 1e18   | `null` when no rate for `code` has been indexed yet.                                                      |
| `lastTradeAt`                   | bigint      | unix seconds          | `null` before the first trade.                                                                            |
| `volumeQuote`                   | bigint      | quote units           | Sum of buy, sell and indexed swap quote amounts.                                                          |
| `tradeCount`                    | int         |                       | Number of `trade` rows.                                                                                   |
| `holderCount`                   | int         |                       | Addresses with a non-zero balance, excluding the curve, the PoolManager and the burn address.             |

Indexed for cheap filtering and ordering: `curve`, `creator`, `code`, `createdAt`, `volumeQuote`, `poolId`. The text column `currency` is not indexed but is fine at the current table size.

## Examples

Newest launches, cursor paginated, with the fields the app's cards need:

```graphql theme={"system"}
query Launches($after: String) {
  launchs(orderBy: "createdAt", orderDirection: "desc", limit: 20, after: $after) {
    items {
      token curve creator currency quoteAsset quoteDecimals
      name symbol metadataURI createdAt
      virtualQuote graduationQuote tokensSold realQuote ready graduated poolId
      lastPriceQuote lastPriceUsd volumeQuote tradeCount holderCount
      currencyInfo { symbol lastRate }
    }
    pageInfo { hasNextPage endCursor }
    totalCount
  }
}
```

One launch by token address, with its currency and latest trades:

```graphql theme={"system"}
query Launch($token: String!) {
  launch(token: $token) {
    token curve creator currency quoteAsset quoteDecimals name symbol metadataURI createdAt
    virtualQuote virtualToken curveSupply graduationQuote tokensSold realQuote
    ready graduated graduatedAt poolId positionTokenId
    lastPriceQuote lastPriceUsd lastTradeAt volumeQuote tradeCount holderCount
    currencyInfo { symbol tier vault synth lastRate lastRateAt }
    trades(orderBy: "timestamp", orderDirection: "desc", limit: 10) {
      items { id type isBuy trader tokenAmount quoteAmount priceQuote priceUsd timestamp txHash }
    }
  }
}
```

Top launches by volume in one currency, curve phase only:

```graphql theme={"system"}
{
  launchs(where: { currency: "INR", graduated: false }, orderBy: "volumeQuote", orderDirection: "desc", limit: 10) {
    items { token symbol volumeQuote lastPriceQuote realQuote graduationQuote }
  }
}
```

By curve address, or everything one creator has launched:

```graphql theme={"system"}
{
  byCurve: launchs(where: { curve: "0x..." }) { items { token symbol } }
  byCreator: launchs(where: { creator: "0x..." }, orderBy: "createdAt", orderDirection: "desc") { items { token symbol createdAt } }
}
```

Several launches at once (the portfolio page does this for a wallet's holdings):

```graphql theme={"system"}
query ByTokens($tokens: [String!]!) {
  launchs(where: { token_in: $tokens }, limit: 100) {
    items { token symbol currency lastPriceQuote lastPriceUsd graduated }
  }
}
```

Launches that are ready but not yet graduated (anyone can call `graduate()` on these):

```graphql theme={"system"}
{
  launchs(where: { ready: true, graduated: false }) {
    items { token curve realQuote graduationQuote }
  }
}
```

With `curl`:

```bash theme={"system"}
curl -s https://api.windrose.market/graphql \
  -H 'content-type: application/json' \
  -d '{"query":"query($t:String!){ launch(token:$t){ symbol currency lastPriceQuote realQuote graduationQuote holderCount graduated } }","variables":{"t":"0x..."}}'
```

## Reading the numbers

* Progress towards graduation is `realQuote / graduationQuote`; both are quote units, so the ratio needs no scaling.
* The current curve price in the launch currency is `lastPriceQuote / 1e18`. In USD it is `lastPriceUsd / 1e18`, or `lastPriceQuote / currencyInfo.lastRate` if you want to apply a fresher rate yourself.
* Market value on the curve is `lastPriceQuote * tokensSold / 1e36` in the launch currency, or use the full supply of `1e27` for a fully diluted figure.
* After graduation on Robinhood Chain, `lastPriceQuote` is the price at graduation, because pool swaps are not indexed there. Read the pool through `StateView.getSlot0(poolId)` for a live price.

## Lookup tables

Two small tables map protocol addresses back to launches. They are mostly useful when you start from an on-chain event rather than from the API.

`curve` maps a bonding curve address to its launch token:

```graphql theme={"system"}
{ curve(address: "0x...") { address launch } }
```

`pool` maps a Uniswap v4 pool id to a graduated launch and records the token ordering, which you need to interpret `Swap` deltas and `sqrtPriceX96`:

```graphql theme={"system"}
{
  pool(poolId: "0x...") { poolId launch curve quoteAsset quoteDecimals tokenIsCurrency0 }
}
```

`tokenIsCurrency0` is true when the launch token's address is numerically lower than the quote asset's, which makes it `currency0` of the pool key.
