# Migrate

Collects all funds from curve to init a pool on CoolDEX after.

## Instruction INDEX

4

## Instruction

```rust
BondingCurveInstruction::Migrate {
    pda_token_nonce: u8,
}
```

## Parameters

| Parameter         | Type | Description                   |
| ----------------- | ---- | ----------------------------- |
| `pda_token_nonce` | `u8` | Nonce for the token owner PDA |

## Required Accounts

1. Token mint
2. Token program
3. Token owner PDA
4. Fee account (signer)
5. Token owner token account
6. Fee token account

## Function Logic

1. Verifies the fee account is the authorized admin
2. Verifies the PDA token owner matches the expected PDA for the token mint
3. Verifies that the token sale is finalized (status = 2)
4. Marks the token as migrated (status = 3)
5. Determines the amount of tokens in the bonding curve vault
6. Transfers all remaining tokens to the fee account
7. Closes the token account
8. Transfers the remaining SOL in the bonding curve (minus a small amount for rent) to the fee account

## Notes

* Migration can only be performed by the admin fee account
* The token must be in the finalized state (status = 2)
* All remaining tokens and SOL are extracted from the bonding curve
* After migration, the token can be listed on the CoolDEX with a liquidity pool
* The extracted tokens and SOL will be used to create the initial liquidity pool


---

# Agent Instructions: 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:

```
GET https://docs.something.cool/sc-bonding-curve/functions/migrate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
