# Raydium Launchpad decoder (Carbon 2.0)

> Decode Raydium Launchpad instructions, accounts and events in Rust with the carbon-raydium-launchpad-decoder crate.

`carbon-raydium-launchpad-decoder` decodes the instructions, accounts and events of the Raydium Launchpad program (`LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj`): 25 instructions, 5 account types, 4 events. It is generated with Codama from the program's IDL; see [decoders](https://carbon.sevenlabs.org/concepts/decoders.md) for how decoders plug into a pipeline.

|                  |                                                                                                                             |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Crate            | [`carbon-raydium-launchpad-decoder`](https://crates.io/crates/carbon-raydium-launchpad-decoder/2.0.0) 2.0.0                 |
| Install          | `cargo add carbon-raydium-launchpad-decoder@2.0.0`                                                                          |
| Program ID       | `LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj` (`carbon_raydium_launchpad_decoder::PROGRAM_ID`)                              |
| Category         | [Launchpads](https://carbon.sevenlabs.org/decoders/launchpads.md)                                                           |
| Decoder          | `carbon_raydium_launchpad_decoder::RaydiumLaunchpadDecoder`                                                                 |
| Instruction enum | `instructions::RaydiumLaunchpadInstruction`                                                                                 |
| Account enum     | `accounts::RaydiumLaunchpadAccount`                                                                                         |
| Event enum       | `instructions::CpiEvent`                                                                                                    |
| Features         | `serde`, `postgres`, `graphql` (none enabled by default)                                                                    |
| API docs         | [docs.rs/carbon-raydium-launchpad-decoder/2.0.0](https://docs.rs/carbon-raydium-launchpad-decoder/2.0.0)                    |
| Source           | [decoders/raydium-launchpad-decoder](https://github.com/sevenlabs-hq/carbon/tree/v2.0.0/decoders/raydium-launchpad-decoder) |

Other launchpad decoders: [Boop](https://carbon.sevenlabs.org/decoders/boop.md), [Meteora DBC](https://carbon.sevenlabs.org/decoders/meteora-dbc.md), [Moonshot](https://carbon.sevenlabs.org/decoders/moonshot.md), [Pump.fun](https://carbon.sevenlabs.org/decoders/pumpfun.md), [Vertigo](https://carbon.sevenlabs.org/decoders/vertigo.md), [Virtuals](https://carbon.sevenlabs.org/decoders/virtuals.md), [Wavebreak](https://carbon.sevenlabs.org/decoders/wavebreak.md). To decode several in one pipeline, see [launchpad decoders](https://carbon.sevenlabs.org/decoders/launchpads.md).

The `serde` feature derives `Serialize`/`Deserialize` on every type, `postgres` adds tables and processors for [Postgres](https://carbon.sevenlabs.org/guides/postgres.md), and `graphql` adds a schema for the [GraphQL server](https://carbon.sevenlabs.org/guides/graphql.md).

## Usage

This program crawls recent Raydium Launchpad transactions from the public RPC and prints every decoded `BuyExactIn` instruction. Add the dependencies:

```sh
cargo add carbon-core@2.0.0 carbon-raydium-launchpad-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/full
```

`src/main.rs`:

```rust
use {
    carbon_core::{
        error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_raydium_launchpad_decoder::{
        instructions::RaydiumLaunchpadInstruction, RaydiumLaunchpadDecoder, PROGRAM_ID,
    },
    carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Fetches the program's recent transactions over JSON-RPC, newest first.
    let datasource = RpcTransactionCrawler::new(
        "https://api.mainnet-beta.solana.com".to_string(),
        PROGRAM_ID,
        ConnectionConfig::default(),
        Filters::new(None, None, None),
        None,
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .instruction(RaydiumLaunchpadDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, RaydiumLaunchpadInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, RaydiumLaunchpadInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let RaydiumLaunchpadInstruction::BuyExactIn { data, accounts, .. } = input.decoded_instruction {
            println!("buy_exact_in {signature}: {data:?} payer={}", accounts.payer);
        }
        Ok(())
    }
}
```

```sh
RUST_LOG=info cargo run
```

Each `BuyExactIn` instruction prints one line with the transaction signature and the decoded `BuyExactIn` data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See [stream with RPC](https://carbon.sevenlabs.org/guides/stream-with-rpc.md) for the crawler options.

Events published with Anchor's `emit_cpi!` arrive as the `CpiEvent` instruction. Match them with `RaydiumLaunchpadInstruction::CpiEvent { data: CpiEvent::ClaimVestedEvent(event), .. }` (import `instructions::CpiEvent`); see [Events](#events). If `CpiEvent` never arrives, the program logs its events with `emit!` instead: decode them with [`decode_log_events`](https://carbon.sevenlabs.org/concepts/instructions.md#log-events).

### Decode accounts

The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with `programSubscribe` on the public WebSocket endpoint and prints every decoded `PoolState` account as it changes. Add the datasource and the Solana RPC types it takes:

```sh
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2
```

`src/main.rs`:

```rust
use {
    carbon_core::{
        account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_raydium_launchpad_decoder::{
        accounts::RaydiumLaunchpadAccount, RaydiumLaunchpadDecoder, PROGRAM_ID,
    },
    carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
    solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Streams every change to an account owned by the program (programSubscribe).
    let config = RpcProgramAccountsConfig {
        account_config: RpcAccountInfoConfig {
            encoding: Some(UiAccountEncoding::Base64),
            ..Default::default()
        },
        ..Default::default()
    };
    let datasource = RpcProgramSubscribe::new(
        "wss://api.mainnet-beta.solana.com".to_string(),
        Filters::new(PROGRAM_ID, Some(config)),
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .account(RaydiumLaunchpadDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

impl Processor<AccountProcessorInputType<'_, RaydiumLaunchpadAccount>> for AccountLogger {
    async fn process(
        &mut self,
        input: &AccountProcessorInputType<'_, RaydiumLaunchpadAccount>,
    ) -> CarbonResult<()> {
        if let RaydiumLaunchpadAccount::PoolState(pool_state) = &input.decoded_account.data {
            println!("pool_state {}: {pool_state:?}", input.metadata.pubkey);
        }
        Ok(())
    }
}
```

```sh
RUST_LOG=info cargo run
```

Each update to a `PoolState` account prints its address and decoded fields; the program runs until you stop it. Cargo resolves `solana-client` to 4.2.2, the exact version the datasource pins, so both use the same `RpcProgramAccountsConfig` type. To load every existing account once instead of streaming changes, see [load account state](https://carbon.sevenlabs.org/guides/load-account-state.md).

## Instructions

Variants of `RaydiumLaunchpadInstruction`. Each is `RaydiumLaunchpadInstruction::<Variant> { program_id, data, accounts }`, where `data` and `accounts` are the types listed under the variant, exported from `carbon_raydium_launchpad_decoder::instructions`. Discriminators are the leading bytes of the instruction data, in hex.

**How an instruction decodes.** The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:

1. The instruction's program ID is `LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj`.
2. The data starts with the variant's discriminator, and the rest deserializes into its data type.
3. The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).

**Accounts.** They are matched by position, in the order listed. An account marked _optional_ is `None` only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for `Some(PROGRAM_ID)` too. Accounts after the listed ones are in `accounts.remaining` as `AccountMeta`s. The decoder doesn't record whether an account signed or was writable: read that from `input.raw_instruction.accounts[i].is_signer` and `.is_writable`, which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.

### `BuyExactIn`

> _From the program's IDL:_
>
> Use the given amount of quote tokens to purchase base tokens.
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_in` - Amount of quote token to purchase
> - `minimum_amount_out` - Minimum amount of base token to receive (slippage
>   protection)
> - `share_fee_rate` - Fee rate for the share

Discriminator `faea0d7bd59c13ec` · data `BuyExactIn` · accounts `BuyExactInInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `amount_in`          | `u64` |
| `minimum_amount_out` | `u64` |
| `share_fee_rate`     | `u64` |

Required accounts: 15; extras go to `remaining`.

Fields of `BuyExactInInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `authority`           | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `pool_state`          | `Pubkey`           |
| 5   | `user_base_token`     | `Pubkey`           |
| 6   | `user_quote_token`    | `Pubkey`           |
| 7   | `base_vault`          | `Pubkey`           |
| 8   | `quote_vault`         | `Pubkey`           |
| 9   | `base_token_mint`     | `Pubkey`           |
| 10  | `quote_token_mint`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `event_authority`     | `Pubkey`           |
| 14  | `program`             | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `BuyExactOut`

> _From the program's IDL:_
>
> Use quote tokens to purchase the given amount of base tokens.
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_out` - Amount of base token to receive
> - `maximum_amount_in` - Maximum amount of quote token to purchase (slippage
>   protection)
> - `share_fee_rate` - Fee rate for the share

Discriminator `18d3742869039938` · data `BuyExactOut` · accounts `BuyExactOutInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `amount_out`        | `u64` |
| `maximum_amount_in` | `u64` |
| `share_fee_rate`    | `u64` |

Required accounts: 15; extras go to `remaining`.

Fields of `BuyExactOutInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `authority`           | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `pool_state`          | `Pubkey`           |
| 5   | `user_base_token`     | `Pubkey`           |
| 6   | `user_quote_token`    | `Pubkey`           |
| 7   | `base_vault`          | `Pubkey`           |
| 8   | `quote_vault`         | `Pubkey`           |
| 9   | `base_token_mint`     | `Pubkey`           |
| 10  | `quote_token_mint`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `event_authority`     | `Pubkey`           |
| 14  | `program`             | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `ClaimCreatorFee`

> _From the program's IDL:_
>
> Claim the fee from the exclusive creator fee vault.
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `1a618acb84ab8dfc` · data `ClaimCreatorFee` · accounts `ClaimCreatorFeeInstructionAccounts`.

No data fields.

Required accounts: 8; extras go to `remaining`.

Fields of `ClaimCreatorFeeInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `creator`                  | `Pubkey`           |
| 1  | `fee_vault_authority`      | `Pubkey`           |
| 2  | `creator_fee_vault`        | `Pubkey`           |
| 3  | `recipient_token_account`  | `Pubkey`           |
| 4  | `quote_mint`               | `Pubkey`           |
| 5  | `token_program`            | `Pubkey`           |
| 6  | `system_program`           | `Pubkey`           |
| 7  | `associated_token_program` | `Pubkey`           |
| 8… | `remaining`                | `Vec<AccountMeta>` |

### `ClaimPlatformFee`

> _From the program's IDL:_
>
> Claim platform fee
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `9c27d0874ced3d48` · data `ClaimPlatformFee` · accounts `ClaimPlatformFeeInstructionAccounts`.

No data fields.

Required accounts: 10; extras go to `remaining`.

Fields of `ClaimPlatformFeeInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `platform_fee_wallet`      | `Pubkey`           |
| 1   | `authority`                | `Pubkey`           |
| 2   | `pool_state`               | `Pubkey`           |
| 3   | `platform_config`          | `Pubkey`           |
| 4   | `quote_vault`              | `Pubkey`           |
| 5   | `recipient_token_account`  | `Pubkey`           |
| 6   | `quote_mint`               | `Pubkey`           |
| 7   | `token_program`            | `Pubkey`           |
| 8   | `system_program`           | `Pubkey`           |
| 9   | `associated_token_program` | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `ClaimPlatformFeeFromVault`

> _From the program's IDL:_
>
> Claim the fee from the exclusive platform fee vault.
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `75f1c6a8f8da501d` · data `ClaimPlatformFeeFromVault` · accounts `ClaimPlatformFeeFromVaultInstructionAccounts`.

No data fields.

Required accounts: 9; extras go to `remaining`.

Fields of `ClaimPlatformFeeFromVaultInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `platform_fee_wallet`      | `Pubkey`           |
| 1  | `fee_vault_authority`      | `Pubkey`           |
| 2  | `platform_config`          | `Pubkey`           |
| 3  | `platform_fee_vault`       | `Pubkey`           |
| 4  | `recipient_token_account`  | `Pubkey`           |
| 5  | `quote_mint`               | `Pubkey`           |
| 6  | `token_program`            | `Pubkey`           |
| 7  | `system_program`           | `Pubkey`           |
| 8  | `associated_token_program` | `Pubkey`           |
| 9… | `remaining`                | `Vec<AccountMeta>` |

### `ClaimVestedToken`

> _From the program's IDL:_
>
> Claim vested token
>
> **Arguments**

Discriminator `3121681ebd9d4f23` · data `ClaimVestedToken` · accounts `ClaimVestedTokenInstructionAccounts`.

No data fields.

Required accounts: 10; extras go to `remaining`.

Fields of `ClaimVestedTokenInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `beneficiary`              | `Pubkey`           |
| 1   | `authority`                | `Pubkey`           |
| 2   | `pool_state`               | `Pubkey`           |
| 3   | `vesting_record`           | `Pubkey`           |
| 4   | `base_vault`               | `Pubkey`           |
| 5   | `user_base_token`          | `Pubkey`           |
| 6   | `base_token_mint`          | `Pubkey`           |
| 7   | `base_token_program`       | `Pubkey`           |
| 8   | `system_program`           | `Pubkey`           |
| 9   | `associated_token_program` | `Pubkey`           |
| 10… | `remaining`                | `Vec<AccountMeta>` |

### `ClosePlatformGlobalAccess`

> _From the program's IDL:_
>
> Close a platform's permission to use a global config.

Discriminator `7bb4b8816fb9bb3b` · data `ClosePlatformGlobalAccess` · accounts `ClosePlatformGlobalAccessInstructionAccounts`.

No data fields.

Required accounts: 4; extras go to `remaining`.

Fields of `ClosePlatformGlobalAccessInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `owner`                  | `Pubkey`           |
| 1  | `global_config`          | `Pubkey`           |
| 2  | `platform_config`        | `Pubkey`           |
| 3  | `platform_global_access` | `Pubkey`           |
| 4… | `remaining`              | `Vec<AccountMeta>` |

### `CollectFee`

> _From the program's IDL:_
>
> Collects accumulated fees from the pool
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `3cadf767045d8230` · data `CollectFee` · accounts `CollectFeeInstructionAccounts`.

No data fields.

Required accounts: 8; extras go to `remaining`.

Fields of `CollectFeeInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `owner`                   | `Pubkey`           |
| 1  | `authority`               | `Pubkey`           |
| 2  | `pool_state`              | `Pubkey`           |
| 3  | `global_config`           | `Pubkey`           |
| 4  | `quote_vault`             | `Pubkey`           |
| 5  | `quote_mint`              | `Pubkey`           |
| 6  | `recipient_token_account` | `Pubkey`           |
| 7  | `token_program`           | `Pubkey`           |
| 8… | `remaining`               | `Vec<AccountMeta>` |

### `CollectMigrateFee`

> _From the program's IDL:_
>
> Collects  migrate fees from the pool
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `ffba96dfeb76c9ba` · data `CollectMigrateFee` · accounts `CollectMigrateFeeInstructionAccounts`.

No data fields.

Required accounts: 8; extras go to `remaining`.

Fields of `CollectMigrateFeeInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `owner`                   | `Pubkey`           |
| 1  | `authority`               | `Pubkey`           |
| 2  | `pool_state`              | `Pubkey`           |
| 3  | `global_config`           | `Pubkey`           |
| 4  | `quote_vault`             | `Pubkey`           |
| 5  | `quote_mint`              | `Pubkey`           |
| 6  | `recipient_token_account` | `Pubkey`           |
| 7  | `token_program`           | `Pubkey`           |
| 8… | `remaining`               | `Vec<AccountMeta>` |

### `CreateConfig`

> _From the program's IDL:_
>
> Creates a new configuration
>
> **Arguments**
>
> - `ctx` - The accounts needed by instruction
> - `curve_type` - The type of bonding curve (0: ConstantProduct)
> - `index` - The index of config, there may be multiple config with the same
>   curve type.
> - `trade_fee_rate` - Trade fee rate, must be less than\
>   RATE_DENOMINATOR_VALUE

Discriminator `c9cff3724b6f2fbd` · data `CreateConfig` · accounts `CreateConfigInstructionAccounts`.

| Field            | Type  |
| ---------------- | ----- |
| `curve_type`     | `u8`  |
| `index`          | `u16` |
| `migrate_fee`    | `u64` |
| `trade_fee_rate` | `u64` |

Required accounts: 8; extras go to `remaining`.

Fields of `CreateConfigInstructionAccounts`, in account order:

| #  | Field                      | Type               |
| -- | -------------------------- | ------------------ |
| 0  | `owner`                    | `Pubkey`           |
| 1  | `global_config`            | `Pubkey`           |
| 2  | `quote_token_mint`         | `Pubkey`           |
| 3  | `protocol_fee_owner`       | `Pubkey`           |
| 4  | `migrate_fee_owner`        | `Pubkey`           |
| 5  | `migrate_to_amm_wallet`    | `Pubkey`           |
| 6  | `migrate_to_cpswap_wallet` | `Pubkey`           |
| 7  | `system_program`           | `Pubkey`           |
| 8… | `remaining`                | `Vec<AccountMeta>` |

### `CreatePlatformConfig`

> _From the program's IDL:_
>
> Create platform config account
>
> **Arguments**
>
> - `ctx` - The context of accounts
>
> **Fields**
>
> - `fee_rate` - Fee rate of the platform
> - `name` - Name of the platform
> - `web` - Website of the platform
> - `img` - Image link of the platform

Discriminator `b05ac4affd71dc14` · data `CreatePlatformConfig` · accounts `CreatePlatformConfigInstructionAccounts`.

| Field             | Type                                |
| ----------------- | ----------------------------------- |
| `platform_params` | [`PlatformParams`](#platformparams) |

Required accounts: 8; extras go to `remaining`.

Fields of `CreatePlatformConfigInstructionAccounts`, in account order:

| #  | Field                              | Type               |
| -- | ---------------------------------- | ------------------ |
| 0  | `platform_admin`                   | `Pubkey`           |
| 1  | `platform_fee_wallet`              | `Pubkey`           |
| 2  | `platform_nft_wallet`              | `Pubkey`           |
| 3  | `platform_config`                  | `Pubkey`           |
| 4  | `cpswap_config`                    | `Pubkey`           |
| 5  | `system_program`                   | `Pubkey`           |
| 6  | `transfer_fee_extension_authority` | `Pubkey`           |
| 7  | `platform_vesting_wallet`          | `Pubkey`           |
| 8… | `remaining`                        | `Vec<AccountMeta>` |

### `CreatePlatformGlobalAccess`

> _From the program's IDL:_
>
> Create a platform permission to use a global config when authorization is enabled.

Discriminator `a25b92c75d85eaed` · data `CreatePlatformGlobalAccess` · accounts `CreatePlatformGlobalAccessInstructionAccounts`.

No data fields.

Required accounts: 5; extras go to `remaining`.

Fields of `CreatePlatformGlobalAccessInstructionAccounts`, in account order:

| #  | Field                    | Type               |
| -- | ------------------------ | ------------------ |
| 0  | `owner`                  | `Pubkey`           |
| 1  | `global_config`          | `Pubkey`           |
| 2  | `platform_config`        | `Pubkey`           |
| 3  | `platform_global_access` | `Pubkey`           |
| 4  | `system_program`         | `Pubkey`           |
| 5… | `remaining`              | `Vec<AccountMeta>` |

### `CreatePlatformVestingAccount`

> _From the program's IDL:_
>
> Create vesting account
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `share` - The share amount of base token to be vested

Discriminator `9247ad4562130f6a` · data `CreatePlatformVestingAccount` · accounts `CreatePlatformVestingAccountInstructionAccounts`.

No data fields.

Required accounts: 6; extras go to `remaining`.

Fields of `CreatePlatformVestingAccountInstructionAccounts`, in account order:

| #  | Field                     | Type               |
| -- | ------------------------- | ------------------ |
| 0  | `platform_vesting_wallet` | `Pubkey`           |
| 1  | `beneficiary`             | `Pubkey`           |
| 2  | `platform_config`         | `Pubkey`           |
| 3  | `pool_state`              | `Pubkey`           |
| 4  | `platform_vesting_record` | `Pubkey`           |
| 5  | `system_program`          | `Pubkey`           |
| 6… | `remaining`               | `Vec<AccountMeta>` |

### `CreateVestingAccount`

> _From the program's IDL:_
>
> Create vesting account
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `share` - The share amount of base token to be vested

Discriminator `81b2020dd9ace6da` · data `CreateVestingAccount` · accounts `CreateVestingAccountInstructionAccounts`.

| Field          | Type  |
| -------------- | ----- |
| `share_amount` | `u64` |

Required accounts: 5; extras go to `remaining`.

Fields of `CreateVestingAccountInstructionAccounts`, in account order:

| #  | Field            | Type               |
| -- | ---------------- | ------------------ |
| 0  | `creator`        | `Pubkey`           |
| 1  | `beneficiary`    | `Pubkey`           |
| 2  | `pool_state`     | `Pubkey`           |
| 3  | `vesting_record` | `Pubkey`           |
| 4  | `system_program` | `Pubkey`           |
| 5… | `remaining`      | `Vec<AccountMeta>` |

### `Initialize`

> _From the program's IDL:_
>
> Initializes a new trading pool
>
> **Arguments**
>
> - `ctx` - The context of accounts containing pool and token information

Discriminator `afaf6d1f0d989bed` · data `Initialize` · accounts `InitializeInstructionAccounts`.

| Field             | Type                              |
| ----------------- | --------------------------------- |
| `base_mint_param` | [`MintParams`](#mintparams)       |
| `curve_param`     | [`CurveParams`](#curveparams)     |
| `vesting_param`   | [`VestingParams`](#vestingparams) |

Required accounts: 18; extras go to `remaining`.

Fields of `InitializeInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `creator`             | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `authority`           | `Pubkey`           |
| 5   | `pool_state`          | `Pubkey`           |
| 6   | `base_mint`           | `Pubkey`           |
| 7   | `quote_mint`          | `Pubkey`           |
| 8   | `base_vault`          | `Pubkey`           |
| 9   | `quote_vault`         | `Pubkey`           |
| 10  | `metadata_account`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `metadata_program`    | `Pubkey`           |
| 14  | `system_program`      | `Pubkey`           |
| 15  | `rent_program`        | `Pubkey`           |
| 16  | `event_authority`     | `Pubkey`           |
| 17  | `program`             | `Pubkey`           |
| 18… | `remaining`           | `Vec<AccountMeta>` |

### `InitializeV2`

> _From the program's IDL:_
>
> Initializes a new trading pool
>
> **Arguments**
>
> - `ctx` - The context of accounts containing pool and token information

Discriminator `4399af27da102620` · data `InitializeV2` · accounts `InitializeV2InstructionAccounts`.

| Field             | Type                                  |
| ----------------- | ------------------------------------- |
| `base_mint_param` | [`MintParams`](#mintparams)           |
| `curve_param`     | [`CurveParams`](#curveparams)         |
| `vesting_param`   | [`VestingParams`](#vestingparams)     |
| `amm_fee_on`      | [`AmmCreatorFeeOn`](#ammcreatorfeeon) |

Required accounts: 18; extras go to `remaining`.

Fields of `InitializeV2InstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `creator`             | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `authority`           | `Pubkey`           |
| 5   | `pool_state`          | `Pubkey`           |
| 6   | `base_mint`           | `Pubkey`           |
| 7   | `quote_mint`          | `Pubkey`           |
| 8   | `base_vault`          | `Pubkey`           |
| 9   | `quote_vault`         | `Pubkey`           |
| 10  | `metadata_account`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `metadata_program`    | `Pubkey`           |
| 14  | `system_program`      | `Pubkey`           |
| 15  | `rent_program`        | `Pubkey`           |
| 16  | `event_authority`     | `Pubkey`           |
| 17  | `program`             | `Pubkey`           |
| 18… | `remaining`           | `Vec<AccountMeta>` |

### `InitializeWithToken2022`

> _From the program's IDL:_
>
> Initializes a new trading pool with base token belongs to spl-token-2022, pool created by this instruction must be migrated to cpswap after fundraising ends, i.e., curve_param.migrate_type = 1 # Arguments
>
> - `ctx` - The context of accounts containing pool and token information

Discriminator `25be7ede2c9aab11` · data `InitializeWithToken2022` · accounts `InitializeWithToken2022InstructionAccounts`.

| Field                          | Type                                                                |
| ------------------------------ | ------------------------------------------------------------------- |
| `base_mint_param`              | [`MintParams`](#mintparams)                                         |
| `curve_param`                  | [`CurveParams`](#curveparams)                                       |
| `vesting_param`                | [`VestingParams`](#vestingparams)                                   |
| `amm_fee_on`                   | [`AmmCreatorFeeOn`](#ammcreatorfeeon)                               |
| `transfer_fee_extension_param` | [`Option<TransferFeeExtensionParams>`](#transferfeeextensionparams) |

Required accounts: 15; extras go to `remaining`.

Fields of `InitializeWithToken2022InstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `creator`             | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `authority`           | `Pubkey`           |
| 5   | `pool_state`          | `Pubkey`           |
| 6   | `base_mint`           | `Pubkey`           |
| 7   | `quote_mint`          | `Pubkey`           |
| 8   | `base_vault`          | `Pubkey`           |
| 9   | `quote_vault`         | `Pubkey`           |
| 10  | `base_token_program`  | `Pubkey`           |
| 11  | `quote_token_program` | `Pubkey`           |
| 12  | `system_program`      | `Pubkey`           |
| 13  | `event_authority`     | `Pubkey`           |
| 14  | `program`             | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `MigrateToAmm`

> _From the program's IDL:_
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `cf52c091fecf91df` · data `MigrateToAmm` · accounts `MigrateToAmmInstructionAccounts`.

| Field                       | Type  |
| --------------------------- | ----- |
| `base_lot_size`             | `u64` |
| `quote_lot_size`            | `u64` |
| `market_vault_signer_nonce` | `u8`  |

Required accounts: 32; extras go to `remaining`.

Fields of `MigrateToAmmInstructionAccounts`, in account order:

| #   | Field                        | Type               |
| --- | ---------------------------- | ------------------ |
| 0   | `payer`                      | `Pubkey`           |
| 1   | `base_mint`                  | `Pubkey`           |
| 2   | `quote_mint`                 | `Pubkey`           |
| 3   | `openbook_program`           | `Pubkey`           |
| 4   | `market`                     | `Pubkey`           |
| 5   | `request_queue`              | `Pubkey`           |
| 6   | `event_queue`                | `Pubkey`           |
| 7   | `bids`                       | `Pubkey`           |
| 8   | `asks`                       | `Pubkey`           |
| 9   | `market_vault_signer`        | `Pubkey`           |
| 10  | `market_base_vault`          | `Pubkey`           |
| 11  | `market_quote_vault`         | `Pubkey`           |
| 12  | `amm_program`                | `Pubkey`           |
| 13  | `amm_pool`                   | `Pubkey`           |
| 14  | `amm_authority`              | `Pubkey`           |
| 15  | `amm_open_orders`            | `Pubkey`           |
| 16  | `amm_lp_mint`                | `Pubkey`           |
| 17  | `amm_base_vault`             | `Pubkey`           |
| 18  | `amm_quote_vault`            | `Pubkey`           |
| 19  | `amm_target_orders`          | `Pubkey`           |
| 20  | `amm_config`                 | `Pubkey`           |
| 21  | `amm_create_fee_destination` | `Pubkey`           |
| 22  | `authority`                  | `Pubkey`           |
| 23  | `pool_state`                 | `Pubkey`           |
| 24  | `global_config`              | `Pubkey`           |
| 25  | `base_vault`                 | `Pubkey`           |
| 26  | `quote_vault`                | `Pubkey`           |
| 27  | `pool_lp_token`              | `Pubkey`           |
| 28  | `spl_token_program`          | `Pubkey`           |
| 29  | `associated_token_program`   | `Pubkey`           |
| 30  | `system_program`             | `Pubkey`           |
| 31  | `rent_program`               | `Pubkey`           |
| 32… | `remaining`                  | `Vec<AccountMeta>` |

### `MigrateToCpswap`

> _From the program's IDL:_
>
> **Arguments**
>
> - `ctx` - The context of accounts

Discriminator `885cc8671cda908c` · data `MigrateToCpswap` · accounts `MigrateToCpswapInstructionAccounts`.

No data fields.

Required accounts: 28; extras go to `remaining`.

Fields of `MigrateToCpswapInstructionAccounts`, in account order:

| #   | Field                      | Type               |
| --- | -------------------------- | ------------------ |
| 0   | `payer`                    | `Pubkey`           |
| 1   | `base_mint`                | `Pubkey`           |
| 2   | `quote_mint`               | `Pubkey`           |
| 3   | `platform_config`          | `Pubkey`           |
| 4   | `cpswap_program`           | `Pubkey`           |
| 5   | `cpswap_pool`              | `Pubkey`           |
| 6   | `cpswap_authority`         | `Pubkey`           |
| 7   | `cpswap_lp_mint`           | `Pubkey`           |
| 8   | `cpswap_base_vault`        | `Pubkey`           |
| 9   | `cpswap_quote_vault`       | `Pubkey`           |
| 10  | `cpswap_config`            | `Pubkey`           |
| 11  | `cpswap_create_pool_fee`   | `Pubkey`           |
| 12  | `cpswap_observation`       | `Pubkey`           |
| 13  | `lock_program`             | `Pubkey`           |
| 14  | `lock_authority`           | `Pubkey`           |
| 15  | `lock_lp_vault`            | `Pubkey`           |
| 16  | `authority`                | `Pubkey`           |
| 17  | `pool_state`               | `Pubkey`           |
| 18  | `global_config`            | `Pubkey`           |
| 19  | `base_vault`               | `Pubkey`           |
| 20  | `quote_vault`              | `Pubkey`           |
| 21  | `pool_lp_token`            | `Pubkey`           |
| 22  | `base_token_program`       | `Pubkey`           |
| 23  | `quote_token_program`      | `Pubkey`           |
| 24  | `associated_token_program` | `Pubkey`           |
| 25  | `system_program`           | `Pubkey`           |
| 26  | `rent_program`             | `Pubkey`           |
| 27  | `metadata_program`         | `Pubkey`           |
| 28… | `remaining`                | `Vec<AccountMeta>` |

### `RemovePlatformCurveParam`

> _From the program's IDL:_
>
> Remove platform launch param
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `index` - The index of the curve param to remove

Discriminator `1b1e3ea95de01891` · data `RemovePlatformCurveParam` · accounts `RemovePlatformCurveParamInstructionAccounts`.

| Field   | Type |
| ------- | ---- |
| `index` | `u8` |

Required accounts: 2; extras go to `remaining`.

Fields of `RemovePlatformCurveParamInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `platform_admin`  | `Pubkey`           |
| 1  | `platform_config` | `Pubkey`           |
| 2… | `remaining`       | `Vec<AccountMeta>` |

### `SellExactIn`

> _From the program's IDL:_
>
> Use the given amount of base tokens to sell for quote tokens.
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_in` - Amount of base token to sell
> - `minimum_amount_out` - Minimum amount of quote token to receive (slippage
>   protection)
> - `share_fee_rate` - Fee rate for the share

Discriminator `9527de9bd37c981a` · data `SellExactIn` · accounts `SellExactInInstructionAccounts`.

| Field                | Type  |
| -------------------- | ----- |
| `amount_in`          | `u64` |
| `minimum_amount_out` | `u64` |
| `share_fee_rate`     | `u64` |

Required accounts: 15; extras go to `remaining`.

Fields of `SellExactInInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `authority`           | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `pool_state`          | `Pubkey`           |
| 5   | `user_base_token`     | `Pubkey`           |
| 6   | `user_quote_token`    | `Pubkey`           |
| 7   | `base_vault`          | `Pubkey`           |
| 8   | `quote_vault`         | `Pubkey`           |
| 9   | `base_token_mint`     | `Pubkey`           |
| 10  | `quote_token_mint`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `event_authority`     | `Pubkey`           |
| 14  | `program`             | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `SellExactOut`

> _From the program's IDL:_
>
> Sell base tokens for the given amount of quote tokens.
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `amount_out` - Amount of quote token to receive
> - `maximum_amount_in` - Maximum amount of base token to purchase (slippage
>   protection)
> - `share_fee_rate` - Fee rate for the share

Discriminator `5fc8472208090ba6` · data `SellExactOut` · accounts `SellExactOutInstructionAccounts`.

| Field               | Type  |
| ------------------- | ----- |
| `amount_out`        | `u64` |
| `maximum_amount_in` | `u64` |
| `share_fee_rate`    | `u64` |

Required accounts: 15; extras go to `remaining`.

Fields of `SellExactOutInstructionAccounts`, in account order:

| #   | Field                 | Type               |
| --- | --------------------- | ------------------ |
| 0   | `payer`               | `Pubkey`           |
| 1   | `authority`           | `Pubkey`           |
| 2   | `global_config`       | `Pubkey`           |
| 3   | `platform_config`     | `Pubkey`           |
| 4   | `pool_state`          | `Pubkey`           |
| 5   | `user_base_token`     | `Pubkey`           |
| 6   | `user_quote_token`    | `Pubkey`           |
| 7   | `base_vault`          | `Pubkey`           |
| 8   | `quote_vault`         | `Pubkey`           |
| 9   | `base_token_mint`     | `Pubkey`           |
| 10  | `quote_token_mint`    | `Pubkey`           |
| 11  | `base_token_program`  | `Pubkey`           |
| 12  | `quote_token_program` | `Pubkey`           |
| 13  | `event_authority`     | `Pubkey`           |
| 14  | `program`             | `Pubkey`           |
| 15… | `remaining`           | `Vec<AccountMeta>` |

### `UpdateConfig`

> _From the program's IDL:_
>
> Updates configuration parameters
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `param` - Parameter to update:
>
> * 0: Update trade_fee_rate
> * 1: Update fee owner
> * 12: Toggle whether explicit platform authorization is required
>
> - `value` - New value for the selected parameter

Discriminator `1d9efcbf0a53db63` · data `UpdateConfig` · accounts `UpdateConfigInstructionAccounts`.

| Field   | Type  |
| ------- | ----- |
| `param` | `u8`  |
| `value` | `u64` |

Required accounts: 2; extras go to `remaining`.

Fields of `UpdateConfigInstructionAccounts`, in account order:

| #  | Field           | Type               |
| -- | --------------- | ------------------ |
| 0  | `owner`         | `Pubkey`           |
| 1  | `global_config` | `Pubkey`           |
| 2… | `remaining`     | `Vec<AccountMeta>` |

### `UpdatePlatformConfig`

> _From the program's IDL:_
>
> Update platform config
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `param` - Parameter to update

Discriminator `c33c4c81922d438f` · data `UpdatePlatformConfig` · accounts `UpdatePlatformConfigInstructionAccounts`.

| Field   | Type                                          |
| ------- | --------------------------------------------- |
| `param` | [`PlatformConfigParam`](#platformconfigparam) |

Required accounts: 2; extras go to `remaining`.

Fields of `UpdatePlatformConfigInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `platform_admin`  | `Pubkey`           |
| 1  | `platform_config` | `Pubkey`           |
| 2… | `remaining`       | `Vec<AccountMeta>` |

### `UpdatePlatformCurveParam`

> _From the program's IDL:_
>
> Update platform launch param
>
> **Arguments**
>
> - `ctx` - The context of accounts
> - `bonding_curve_param` - Parameter to update

Discriminator `8a908afadc800439` · data `UpdatePlatformCurveParam` · accounts `UpdatePlatformCurveParamInstructionAccounts`.

| Field                 | Type                                      |
| --------------------- | ----------------------------------------- |
| `index`               | `u8`                                      |
| `bonding_curve_param` | [`BondingCurveParam`](#bondingcurveparam) |

Required accounts: 4; extras go to `remaining`.

Fields of `UpdatePlatformCurveParamInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `platform_admin`  | `Pubkey`           |
| 1  | `platform_config` | `Pubkey`           |
| 2  | `global_config`   | `Pubkey`           |
| 3  | `system_program`  | `Pubkey`           |
| 4… | `remaining`       | `Vec<AccountMeta>` |

### `CpiEvent`

Anchor self-CPI that carries one of the program's [events](#events). `data` is the `CpiEvent` enum.

Discriminator `e445a52e51cb9a1d` · data `CpiEvent` · accounts `CpiEventInstructionAccounts`.

Required accounts: 2; extras go to `remaining`.

Fields of `CpiEventInstructionAccounts`, in account order:

| #  | Field             | Type               |
| -- | ----------------- | ------------------ |
| 0  | `program`         | `Pubkey`           |
| 1  | `event_authority` | `Pubkey`           |
| 2… | `remaining`       | `Vec<AccountMeta>` |

## Accounts

Variants of `RaydiumLaunchpadAccount`. Each wraps a boxed struct from `carbon_raydium_launchpad_decoder::accounts::<module>`. `decode_account` only considers accounts owned by `PROGRAM_ID` and returns the first variant that matches.

### `GlobalConfig`

Discriminator `95089ccaa0fcb0d9` · `accounts::global_config::GlobalConfig`.

| Field                      | Type        | Description                                                                      |
| -------------------------- | ----------- | -------------------------------------------------------------------------------- |
| `epoch`                    | `u64`       | Account update epoch                                                             |
| `curve_type`               | `u8`        | 0: Constant Product Curve 1: Fixed Price Curve 2: Linear Price Curve             |
| `index`                    | `u16`       | Config index                                                                     |
| `migrate_fee`              | `u64`       | The fee of migrate to amm                                                        |
| `trade_fee_rate`           | `u64`       | The trade fee rate, denominated in hundredths of a bip (10^-6)                   |
| `max_share_fee_rate`       | `u64`       | The maximum share fee rate, denominated in hundredths of a bip (10^-6)           |
| `min_base_supply`          | `u64`       | The minimum base supply, the value without decimals                              |
| `max_lock_rate`            | `u64`       | The maximum lock rate, denominated in hundredths of a bip (10^-6)                |
| `min_base_sell_rate`       | `u64`       | The minimum base sell rate, denominated in hundredths of a bip (10^-6)           |
| `min_base_migrate_rate`    | `u64`       | The minimum base migrate rate, denominated in hundredths of a bip (10^-6)        |
| `min_quote_fund_raising`   | `u64`       | The minimum quote fund raising, the value with decimals                          |
| `quote_mint`               | `Pubkey`    | Mint information for quote token                                                 |
| `protocol_fee_owner`       | `Pubkey`    | Protocol Fee owner                                                               |
| `migrate_fee_owner`        | `Pubkey`    | Migrate Fee owner                                                                |
| `migrate_to_amm_wallet`    | `Pubkey`    | Migrate to amm control wallet                                                    |
| `migrate_to_cpswap_wallet` | `Pubkey`    | Migrate to cpswap wallet                                                         |
| `requires_platform_auth`   | `u8`        | Whether a platform must be explicitly authorized before using this global config |
| `padding_alignment`        | `[u8; 7]`   | padding alignment                                                                |
| `padding`                  | `[u64; 15]` | padding for future updates                                                       |

### `PlatformConfig`

Discriminator `a04e8000f853e6a0` · `accounts::platform_config::PlatformConfig`.

| Field                         | Type                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `epoch`                       | `u64`                                            | The epoch for update interval                                                                                                                                                                                                                                                                                                                                                                                        |
| `platform_fee_wallet`         | `Pubkey`                                         | The platform fee wallet                                                                                                                                                                                                                                                                                                                                                                                              |
| `platform_nft_wallet`         | `Pubkey`                                         | The platform nft wallet to receive the platform NFT after migration if platform_scale is not 0(Only support MigrateType::CPSWAP)                                                                                                                                                                                                                                                                                     |
| `platform_scale`              | `u64`                                            | Scale of the platform liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)                                                                                                                                                                                                                                                                                                         |
| `creator_scale`               | `u64`                                            | Scale of the token creator liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)                                                                                                                                                                                                                                                                                                    |
| `burn_scale`                  | `u64`                                            | Scale of liquidity directly to burn                                                                                                                                                                                                                                                                                                                                                                                  |
| `fee_rate`                    | `u64`                                            | The platform fee rate                                                                                                                                                                                                                                                                                                                                                                                                |
| `name`                        | `[u8; 64]`                                       | The platform name                                                                                                                                                                                                                                                                                                                                                                                                    |
| `web`                         | `[u8; 256]`                                      | The platform website                                                                                                                                                                                                                                                                                                                                                                                                 |
| `img`                         | `[u8; 256]`                                      | The platform img link                                                                                                                                                                                                                                                                                                                                                                                                |
| `cpswap_config`               | `Pubkey`                                         | The platform specifies the trade fee rate after migration to cp swap                                                                                                                                                                                                                                                                                                                                                 |
| `creator_fee_rate`            | `u64`                                            | Creator fee rate                                                                                                                                                                                                                                                                                                                                                                                                     |
| `transfer_fee_extension_auth` | `Pubkey`                                         | If the base token belongs to token2022, then you can choose to support the transferfeeConfig extension, which includes permissions such as `transfer_fee_config_authority` and `withdraw_withheld_authority`. When initializing mint, `withdraw_withheld_authority` and `transfer_fee_config_authority` both belongs to the contract. Once the token is migrated to AMM, the authorities will be reset to this value |
| `platform_vesting_wallet`     | `Pubkey`                                         |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `platform_vesting_scale`      | `u64`                                            |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `platform_cp_creator`         | `Pubkey`                                         | If a valid platform_cp_creator is configured for the platform, it will be used as the creator for the AMM pool during migration to cpswap pool.                                                                                                                                                                                                                                                                      |
| `padding`                     | `[u8; 108]`                                      | padding for future updates                                                                                                                                                                                                                                                                                                                                                                                           |
| `curve_params`                | [`Vec<PlatformCurveParam>`](#platformcurveparam) | The parameters for launching the pool                                                                                                                                                                                                                                                                                                                                                                                |

### `PlatformGlobalAccess`

Discriminator `ae9384f089dbf310` · `accounts::platform_global_access::PlatformGlobalAccess`.

| Field             | Type       | Description                |
| ----------------- | ---------- | -------------------------- |
| `bump`            | `u8`       |                            |
| `global_config`   | `Pubkey`   |                            |
| `platform_config` | `Pubkey`   |                            |
| `padding`         | `[u64; 8]` | padding for future updates |

### `PoolState`

Discriminator `f7ede3f5d7c3de46` · `accounts::pool_state::PoolState`.

| Field                      | Type                                  | Description                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `epoch`                    | `u64`                                 | Account update epoch                                                                                                                                                                                                                                                                                                                                                                   |
| `auth_bump`                | `u8`                                  | Bump seed used for PDA address derivation                                                                                                                                                                                                                                                                                                                                              |
| `status`                   | `u8`                                  | Current status of the pool \* 0: Pool is funding \* 1: Pool funding is end, waiting for migration \* 2: Pool migration is done                                                                                                                                                                                                                                                         |
| `base_decimals`            | `u8`                                  | Decimals of the pool base token                                                                                                                                                                                                                                                                                                                                                        |
| `quote_decimals`           | `u8`                                  | Decimals of the pool quote token                                                                                                                                                                                                                                                                                                                                                       |
| `migrate_type`             | `u8`                                  | Migrate to AMM or CpSwap, 0: amm， 1: cpswap                                                                                                                                                                                                                                                                                                                                            |
| `supply`                   | `u64`                                 | Supply of the pool base token                                                                                                                                                                                                                                                                                                                                                          |
| `total_base_sell`          | `u64`                                 | Total sell amount of the base token                                                                                                                                                                                                                                                                                                                                                    |
| `virtual_base`             | `u64`                                 | For different curves, virtual_base and virtual_quote have different meanings For constant product curve, virtual_base and virtual_quote are virtual liquidity, virtual_quote/virtual_base is the initial price For linear price curve, virtual_base is the price slope parameter a, virtual_quote has no effect For fixed price curve, virtual_quote/virtual_base is the initial price |
| `virtual_quote`            | `u64`                                 |                                                                                                                                                                                                                                                                                                                                                                                        |
| `real_base`                | `u64`                                 | Actual base token amount in the pool Represents the real tokens available for trading                                                                                                                                                                                                                                                                                                  |
| `real_quote`               | `u64`                                 | Actual quote token amount in the pool Represents the real tokens available for trading                                                                                                                                                                                                                                                                                                 |
| `total_quote_fund_raising` | `u64`                                 | The total quote fund raising of the pool                                                                                                                                                                                                                                                                                                                                               |
| `quote_protocol_fee`       | `u64`                                 | Accumulated trading fees in quote tokens Can be collected by the protocol fee owner                                                                                                                                                                                                                                                                                                    |
| `platform_fee`             | `u64`                                 | Accumulated platform fees in quote tokens Can be collected by the platform wallet stored in platform config                                                                                                                                                                                                                                                                            |
| `migrate_fee`              | `u64`                                 | The fee of migrate to amm                                                                                                                                                                                                                                                                                                                                                              |
| `vesting_schedule`         | [`VestingSchedule`](#vestingschedule) | Vesting schedule for the base token                                                                                                                                                                                                                                                                                                                                                    |
| `global_config`            | `Pubkey`                              | Public key of the global configuration account Contains protocol-wide settings this pool adheres to                                                                                                                                                                                                                                                                                    |
| `platform_config`          | `Pubkey`                              | Public key of the platform configuration account Contains platform-wide settings this pool adheres to                                                                                                                                                                                                                                                                                  |
| `base_mint`                | `Pubkey`                              | Public key of the base mint address                                                                                                                                                                                                                                                                                                                                                    |
| `quote_mint`               | `Pubkey`                              | Public key of the quote mint address                                                                                                                                                                                                                                                                                                                                                   |
| `base_vault`               | `Pubkey`                              | Public key of the base token vault Holds the actual base tokens owned by the pool                                                                                                                                                                                                                                                                                                      |
| `quote_vault`              | `Pubkey`                              | Public key of the quote token vault Holds the actual quote tokens owned by the pool                                                                                                                                                                                                                                                                                                    |
| `creator`                  | `Pubkey`                              | The creator of base token                                                                                                                                                                                                                                                                                                                                                              |
| `token_program_flag`       | `u8`                                  | token program bits bit0: base token program flag 0: spl_token_program 1: token_program_2022 bit1: quote token program flag 0: spl_token_program 1: token_program_2022                                                                                                                                                                                                                  |
| `amm_creator_fee_on`       | [`AmmCreatorFeeOn`](#ammcreatorfeeon) | migrate to cpmm, creator fee on quote token or both token                                                                                                                                                                                                                                                                                                                              |
| `platform_vesting_share`   | `u64`                                 | platform vesting token amount                                                                                                                                                                                                                                                                                                                                                          |
| `padding`                  | `[u8; 54]`                            | padding for future updates                                                                                                                                                                                                                                                                                                                                                             |

### `VestingRecord`

Discriminator `6af3ddcde67e5553` · `accounts::vesting_record::VestingRecord`.

| Field                | Type       | Description                                |
| -------------------- | ---------- | ------------------------------------------ |
| `epoch`              | `u64`      | Account update epoch                       |
| `pool`               | `Pubkey`   | The pool state account                     |
| `beneficiary`        | `Pubkey`   | The beneficiary of the vesting account     |
| `claimed_amount`     | `u64`      | The amount of tokens claimed               |
| `token_share_amount` | `u64`      | The share amount of the token to be vested |
| `padding`            | `[u64; 8]` | padding for future updates                 |

## Events

Variants of `instructions::CpiEvent`, decoded from the `CpiEvent` instruction. Each wraps a struct from `carbon_raydium_launchpad_decoder::events::<module>`. The discriminator is the 8-byte event discriminator that follows the `e445a52e51cb9a1d` CPI-event tag.

### `ClaimVestedEvent`

Discriminator `15c2725778d3e220` · `events::claim_vested_event::ClaimVestedEventEvent`.

| Field          | Type     |
| -------------- | -------- |
| `pool_state`   | `Pubkey` |
| `beneficiary`  | `Pubkey` |
| `claim_amount` | `u64`    |

### `CreateVestingEvent`

Discriminator `96980bb334d2bf7d` · `events::create_vesting_event::CreateVestingEventEvent`.

| Field          | Type     |
| -------------- | -------- |
| `pool_state`   | `Pubkey` |
| `beneficiary`  | `Pubkey` |
| `share_amount` | `u64`    |

### `PoolCreateEvent`

Discriminator `97d7e20976a173ae` · `events::pool_create_event::PoolCreateEventEvent`.

| Field             | Type                                  |
| ----------------- | ------------------------------------- |
| `pool_state`      | `Pubkey`                              |
| `creator`         | `Pubkey`                              |
| `config`          | `Pubkey`                              |
| `base_mint_param` | [`MintParams`](#mintparams)           |
| `curve_param`     | [`CurveParams`](#curveparams)         |
| `vesting_param`   | [`VestingParams`](#vestingparams)     |
| `amm_fee_on`      | [`AmmCreatorFeeOn`](#ammcreatorfeeon) |

### `TradeEvent`

Discriminator `bddb7fd34ee661ee` · `events::trade_event::TradeEventEvent`.

| Field               | Type                                |
| ------------------- | ----------------------------------- |
| `pool_state`        | `Pubkey`                            |
| `total_base_sell`   | `u64`                               |
| `virtual_base`      | `u64`                               |
| `virtual_quote`     | `u64`                               |
| `real_base_before`  | `u64`                               |
| `real_quote_before` | `u64`                               |
| `real_base_after`   | `u64`                               |
| `real_quote_after`  | `u64`                               |
| `amount_in`         | `u64`                               |
| `amount_out`        | `u64`                               |
| `protocol_fee`      | `u64`                               |
| `platform_fee`      | `u64`                               |
| `creator_fee`       | `u64`                               |
| `share_fee`         | `u64`                               |
| `trade_direction`   | [`TradeDirection`](#tradedirection) |
| `pool_status`       | [`PoolStatus`](#poolstatus)         |
| `exact_in`          | `bool`                              |

## Types

Types used by the instructions, accounts and events above, exported from `carbon_raydium_launchpad_decoder::types`.

### `AmmCreatorFeeOn`

> _From the program's IDL:_
>
> migrate to cpmm, creator fee on quote token or both token

Enum `types::AmmCreatorFeeOn`.

| Variant      |
| ------------ |
| `QuoteToken` |
| `BothToken`  |

### `BondingCurveParam`

Struct `types::BondingCurveParam`.

| Field                      | Type  | Description                                                                                            |
| -------------------------- | ----- | ------------------------------------------------------------------------------------------------------ |
| `migrate_type`             | `u8`  | Migrate to AMM or CpSwap, 0: amm， 1: cpswap， Neither 0 nor 1: invalid                                  |
| `migrate_cpmm_fee_on`      | `u8`  | The migrate fee on, 0 means fee on the quote token, 1 means fee on both token Neither 0 nor 1: invalid |
| `supply`                   | `u64` | The supply of the token, 0: invalid                                                                    |
| `total_base_sell`          | `u64` | The total base sell of the token 0: invalid                                                            |
| `total_quote_fund_raising` | `u64` | The total quote fund raising of the token 0: invalid                                                   |
| `total_locked_amount`      | `u64` | total amount of tokens to be unlocked u64::MAX: invalid                                                |
| `cliff_period`             | `u64` | Waiting time in seconds before unlocking after fundraising ends u64::MAX: invalid                      |
| `unlock_period`            | `u64` | Unlocking period in seconds u64::MAX: invalid                                                          |

### `ClaimVestedEvent`

> _From the program's IDL:_
>
> Emitted when vesting token claimed by beneficiary

Struct `types::ClaimVestedEvent`. Same fields as the [`ClaimVestedEvent`](#claimvestedevent) event.

### `ConstantCurve`

Struct `types::ConstantCurve`.

| Field                      | Type  |
| -------------------------- | ----- |
| `supply`                   | `u64` |
| `total_base_sell`          | `u64` |
| `total_quote_fund_raising` | `u64` |
| `migrate_type`             | `u8`  |

### `CreateVestingEvent`

> _From the program's IDL:_
>
> Emitted when vest_account created

Struct `types::CreateVestingEvent`. Same fields as the [`CreateVestingEvent`](#createvestingevent) event.

### `CurveParams`

Enum `types::CurveParams`.

| Variant    | Fields                                    |
| ---------- | ----------------------------------------- |
| `Constant` | `data`: [`ConstantCurve`](#constantcurve) |
| `Fixed`    | `data`: [`FixedCurve`](#fixedcurve)       |
| `Linear`   | `data`: [`LinearCurve`](#linearcurve)     |

### `FixedCurve`

Struct `types::FixedCurve`.

| Field                      | Type  |
| -------------------------- | ----- |
| `supply`                   | `u64` |
| `total_quote_fund_raising` | `u64` |
| `migrate_type`             | `u8`  |

### `LinearCurve`

Struct `types::LinearCurve`.

| Field                      | Type  |
| -------------------------- | ----- |
| `supply`                   | `u64` |
| `total_quote_fund_raising` | `u64` |
| `migrate_type`             | `u8`  |

### `MigrateNftInfo`

> _From the program's IDL:_
>
> Represents the parameters for initializing a platform config account(Only support MigrateType::CPSWAP) # Fields
>
> - `platform_scale` - Scale of the platform liquidity quantity rights will be converted into NFT
> - `creator_scale` - Scale of the token creator liquidity quantity rights will be converted into NFT
> - `burn_scale` - Scale of liquidity directly to burn
> - platform_scale + creator_scale + burn_scale = RATE_DENOMINATOR_VALUE

Struct `types::MigrateNftInfo`.

| Field            | Type  |
| ---------------- | ----- |
| `platform_scale` | `u64` |
| `creator_scale`  | `u64` |
| `burn_scale`     | `u64` |

### `MintParams`

> _From the program's IDL:_
>
> Represents the parameters for initializing a new token mint
>
> **Fields**
>
> - `decimals` - Number of decimal places for the token
> - `name` - Name of the token
> - `symbol` - Symbol/ticker of the token
> - `uri` - URI pointing to token metadata

Struct `types::MintParams`.

| Field      | Type     |
| ---------- | -------- |
| `decimals` | `u8`     |
| `name`     | `String` |
| `symbol`   | `String` |
| `uri`      | `String` |

### `PlatformConfigInfo`

Struct `types::PlatformConfigInfo`.

| Field                         | Type                                |
| ----------------------------- | ----------------------------------- |
| `fee_wallet`                  | `Pubkey`                            |
| `nft_wallet`                  | `Pubkey`                            |
| `migrate_nft_info`            | [`MigrateNftInfo`](#migratenftinfo) |
| `fee_rate`                    | `u64`                               |
| `name`                        | `String`                            |
| `web`                         | `String`                            |
| `img`                         | `String`                            |
| `transfer_fee_extension_auth` | `Pubkey`                            |
| `creator_fee_rate`            | `u64`                               |
| `platform_vesting_scale`      | `u64`                               |
| `vesting_wallet`              | `Pubkey`                            |

### `PlatformConfigParam`

Enum `types::PlatformConfigParam`.

| Variant                | Fields                                      |
| ---------------------- | ------------------------------------------- |
| `FeeWallet`            | `Pubkey`                                    |
| `NFTWallet`            | `Pubkey`                                    |
| `MigrateNftInfo`       | [`MigrateNftInfo`](#migratenftinfo)         |
| `FeeRate`              | `u64`                                       |
| `Name`                 | `String`                                    |
| `Web`                  | `String`                                    |
| `Img`                  | `String`                                    |
| `CpSwapConfig`         |                                             |
| `AllInfo`              | [`PlatformConfigInfo`](#platformconfiginfo) |
| `VestingWallet`        | `Pubkey`                                    |
| `PlatformVestingScale` | `u64`                                       |
| `PlatformCPCreator`    | `Pubkey`                                    |

### `PlatformCurveParam`

Struct `types::PlatformCurveParam`.

| Field                 | Type                                      | Description                                       |
| --------------------- | ----------------------------------------- | ------------------------------------------------- |
| `epoch`               | `u64`                                     | The epoch for update interval, 0 means not update |
| `index`               | `u8`                                      | The curve params index                            |
| `global_config`       | `Pubkey`                                  | The global config address                         |
| `bonding_curve_param` | [`BondingCurveParam`](#bondingcurveparam) | bonding curve param                               |
| `padding`             | `[u64; 50]`                               | padding for future updates                        |

### `PlatformParams`

> _From the program's IDL:_
>
> Represents the parameters for initializing a platform config account
>
> **Fields**
>
> - `migrate_nft_info` - The platform configures liquidity info during
>   migration(Only support MigrateType::CPSWAP)
> - `fee_rate` - Fee rate of the platform
> - `name` - Name of the platform
> - `web` - Website of the platform
> - `img` - Image link of the platform
>
> /// \* `creator_fee_rate` - The fee rate charged by the creator for each transaction.

Struct `types::PlatformParams`.

| Field                    | Type                                |
| ------------------------ | ----------------------------------- |
| `migrate_nft_info`       | [`MigrateNftInfo`](#migratenftinfo) |
| `fee_rate`               | `u64`                               |
| `name`                   | `String`                            |
| `web`                    | `String`                            |
| `img`                    | `String`                            |
| `creator_fee_rate`       | `u64`                               |
| `platform_vesting_scale` | `u64`                               |

### `PoolCreateEvent`

> _From the program's IDL:_
>
> Emitted when pool created

Struct `types::PoolCreateEvent`. Same fields as the [`PoolCreateEvent`](#poolcreateevent) event.

### `PoolStatus`

> _From the program's IDL:_
>
> Represents the different states a pool can be in
>
> - Fund - Initial state where pool is accepting funds
> - Migrate - Pool funding has ended and waiting for migration
> - Trade - Pool migration is complete and amm trading is enabled

Enum `types::PoolStatus`.

| Variant   |
| --------- |
| `Fund`    |
| `Migrate` |
| `Trade`   |

### `TradeDirection`

> _From the program's IDL:_
>
> Specifies the direction of a trade in the bonding curve\
> This is important because curves can treat tokens differently through weights or offsets

Enum `types::TradeDirection`.

| Variant |
| ------- |
| `Buy`   |
| `Sell`  |

### `TradeEvent`

> _From the program's IDL:_
>
> Emitted when trade process

Struct `types::TradeEvent`. Same fields as the [`TradeEvent`](#tradeevent) event.

### `TransferFeeExtensionParams`

Struct `types::TransferFeeExtensionParams`.

| Field                       | Type  | Description                                                                                      |
| --------------------------- | ----- | ------------------------------------------------------------------------------------------------ |
| `transfer_fee_basis_points` | `u16` | denominator is 10000, currently, this value cannot exceed 5%, which is 500.                      |
| `maximum_fee`               | `u64` | Maximum fee on each transfers, the value must exceed supply \* transfer_fee_basis_points / 10000 |

### `VestingParams`

Struct `types::VestingParams`.

| Field                 | Type  |
| --------------------- | ----- |
| `total_locked_amount` | `u64` |
| `cliff_period`        | `u64` |
| `unlock_period`       | `u64` |

### `VestingSchedule`

Struct `types::VestingSchedule`.

| Field                    | Type  | Description                                                                          |
| ------------------------ | ----- | ------------------------------------------------------------------------------------ |
| `total_locked_amount`    | `u64` |                                                                                      |
| `cliff_period`           | `u64` |                                                                                      |
| `unlock_period`          | `u64` |                                                                                      |
| `start_time`             | `u64` |                                                                                      |
| `allocated_share_amount` | `u64` | Total allocated share amount of the base token, not greater than total_locked_amount |

---

Carbon 2.0.0 documentation · Web: https://carbon.sevenlabs.org/decoders/raydium-launchpad · Last updated 2026-11-09 · Index of all pages: https://carbon.sevenlabs.org/llms.txt
