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

# Token Lifecycle

> The stages of a KasFun token from creation to DEX

## Overview

Every KasFun token goes through the following stages:

```mermaid theme={null}
graph LR
    A["Created<br/>Token deployed"] --> B["Trading<br/>Bonding Curve<br/>buy & sell"]
    B --> C["Fulfilled<br/>Waiting for<br/>DEX migration"]
    C --> D["Launched<br/>DEX Trading"]
    D --> E["CTO<br/>Community<br/>Governance"]
```

## Stages

### 1. Created

A token is deployed via `MemeFactory.createToken()`. At this point:

* Token ERC-20 contract is deployed
* 80% of supply is deposited into the bonding curve pool
* The token is immediately tradeable

```javascript theme={null}
const info = await factory.getTokenInfo(tokenAddress);
// info.fulfilled === false
// info.graduated === false
```

### 2. Trading (Bonding Curve)

Users buy and sell through `MemeFactory.buy()` and `MemeFactory.sell()`. The price follows a constant-product curve.

You can monitor progress:

```javascript theme={null}
// Returns 0-10000 (representing 0-100%)
const progress = await factory.getBondingCurveProgress(tokenAddress);
console.log(`${Number(progress) / 100}% funded`);
```

### 3. Fulfilled

When `kasReserves` reaches the `graduationThreshold`, the token becomes fulfilled:

```javascript theme={null}
const info = await factory.getTokenInfo(tokenAddress);
// info.fulfilled === true
// info.graduated === false
```

<Warning>
  Once fulfilled, **buy and sell on the bonding curve are disabled**. The token is waiting for liquidity migration.
</Warning>

### 4. Launched (Graduated)

Liquidity is migrated to Krokoswap DEX. The token is now tradeable on the open market.

```javascript theme={null}
const info = await factory.getTokenInfo(tokenAddress);
// info.fulfilled === true
// info.graduated === true
```

After graduation, **Community Governance (CTO)** becomes available — token holders can elect a Council and vote on proposals.

## Checking Token Status

```javascript theme={null}
const info = await factory.getTokenInfo(tokenAddress);

if (info.graduated) {
  console.log("Token has graduated - trade on DEX");
} else if (info.fulfilled) {
  console.log("Token is fulfilled - waiting for DEX migration");
} else {
  console.log("Token is trading on bonding curve");
}
```

## Events

Listen for lifecycle events emitted by MemeFactory:

| Event                                                  | When                 |
| ------------------------------------------------------ | -------------------- |
| `Created(token, creator, tokenId, pool, name, symbol)` | Token is created     |
| `Buy(token, buyer, kasAmount, tokenAmount, fee)`       | Someone buys tokens  |
| `Sell(token, seller, tokenAmount, kasAmount, fee)`     | Someone sells tokens |
