Raydium Launchpad decoder
Decode Raydium Launchpad instructions, accounts and events in Rust with the carbon-raydium-launchpad-decoder crate.
On this page
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 for how decoders plug into a pipeline.
| Crate | carbon-raydium-launchpad-decoder 2.0.0 |
| Install | cargo add carbon-raydium-launchpad-decoder@2. |
| Program ID | LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj (carbon_) |
| Category | Launchpads |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Event enum | instructions:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-raydium-launchpad-decoder/2.0.0 |
| Source | decoders/raydium-launchpad-decoder |
Other launchpad decoders: Boop, Meteora DBC, Moonshot, Pump.fun, Vertigo, Virtuals, Wavebreak. To decode several in one pipeline, see launchpad decoders.
The serde feature derives Serialize/Deserialize on every type, postgres adds tables and processors for Postgres, and graphql adds a schema for the GraphQL server.
Usage#
This program crawls recent Raydium Launchpad transactions from the public RPC and prints every decoded BuyExactIn instruction. Add the dependencies:
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/fulluse {
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(())
}
}RUST_LOG=info cargo runEach 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 for the crawler options.
Events published with Anchor's emit_cpi! arrive as the CpiEvent instruction. Match them with RaydiumLaunchpadInstruction:: (import instructions::); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_.
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:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
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(())
}
}RUST_LOG=info cargo runEach 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.
Instructions#
Variants of RaydiumLaunchpadInstruction. Each is RaydiumLaunchpadInstruction::, where data and accounts are the types listed under the variant, exported from carbon_. 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:
- The instruction's program ID is
LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- 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_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., 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 accountsamount_in- Amount of quote token to purchaseminimum_- Minimum amount of base token to receive (slippage protection)amount_ out share_- Fee rate for the sharefee_ rate
Discriminator faea0d7bd59c13ec · data BuyExactIn · accounts BuyExactInInstructionAccounts.
| Field | Type |
|---|---|
amount_in | u64 |
minimum_ | u64 |
share_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of BuyExactInInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | authority | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | pool_state | Pubkey |
| 5 | user_ | Pubkey |
| 6 | user_ | Pubkey |
| 7 | base_vault | Pubkey |
| 8 | quote_vault | Pubkey |
| 9 | base_ | Pubkey |
| 10 | quote_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
BuyExactOut#
From the program's IDL:
Use quote tokens to purchase the given amount of base tokens.
Arguments
ctx- The context of accountsamount_out- Amount of base token to receivemaximum_- Maximum amount of quote token to purchase (slippage protection)amount_ in share_- Fee rate for the sharefee_ rate
Discriminator 18d3742869039938 · data BuyExactOut · accounts BuyExactOutInstructionAccounts.
| Field | Type |
|---|---|
amount_out | u64 |
maximum_ | u64 |
share_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of BuyExactOutInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | authority | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | pool_state | Pubkey |
| 5 | user_ | Pubkey |
| 6 | user_ | Pubkey |
| 7 | base_vault | Pubkey |
| 8 | quote_vault | Pubkey |
| 9 | base_ | Pubkey |
| 10 | quote_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
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_ | Pubkey |
| 2 | creator_ | Pubkey |
| 3 | recipient_ | Pubkey |
| 4 | quote_mint | Pubkey |
| 5 | token_ | Pubkey |
| 6 | system_ | Pubkey |
| 7 | associated_ | Pubkey |
| 8… | remaining | Vec< |
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_ | Pubkey |
| 1 | authority | Pubkey |
| 2 | pool_state | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | quote_vault | Pubkey |
| 5 | recipient_ | Pubkey |
| 6 | quote_mint | Pubkey |
| 7 | token_ | Pubkey |
| 8 | system_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10… | remaining | Vec< |
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_ | Pubkey |
| 1 | fee_ | Pubkey |
| 2 | platform_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | recipient_ | Pubkey |
| 5 | quote_mint | Pubkey |
| 6 | token_ | Pubkey |
| 7 | system_ | Pubkey |
| 8 | associated_ | Pubkey |
| 9… | remaining | Vec< |
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_ | Pubkey |
| 4 | base_vault | Pubkey |
| 5 | user_ | Pubkey |
| 6 | base_ | Pubkey |
| 7 | base_ | Pubkey |
| 8 | system_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10… | remaining | Vec< |
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_ | Pubkey |
| 2 | platform_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4… | remaining | Vec< |
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_ | Pubkey |
| 4 | quote_vault | Pubkey |
| 5 | quote_mint | Pubkey |
| 6 | recipient_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
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_ | Pubkey |
| 4 | quote_vault | Pubkey |
| 5 | quote_mint | Pubkey |
| 6 | recipient_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
CreateConfig#
From the program's IDL:
Creates a new configuration
Arguments
ctx- The accounts needed by instructioncurve_type- The type of bonding curve (0: ConstantProduct)index- The index of config, there may be multiple config with the same curve type.trade_- Trade fee rate, must be less thanfee_ rate
RATE_DENOMINATOR_VALUE
Discriminator c9cff3724b6f2fbd · data CreateConfig · accounts CreateConfigInstructionAccounts.
| Field | Type |
|---|---|
curve_type | u8 |
index | u16 |
migrate_fee | u64 |
trade_ | u64 |
Required accounts: 8; extras go to remaining.
Fields of CreateConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | global_ | Pubkey |
| 2 | quote_ | Pubkey |
| 3 | protocol_ | Pubkey |
| 4 | migrate_ | Pubkey |
| 5 | migrate_ | Pubkey |
| 6 | migrate_ | Pubkey |
| 7 | system_ | Pubkey |
| 8… | remaining | Vec< |
CreatePlatformConfig#
From the program's IDL:
Create platform config account
Arguments
ctx- The context of accountsFields
fee_rate- Fee rate of the platformname- Name of the platformweb- Website of the platformimg- Image link of the platform
Discriminator b05ac4affd71dc14 · data CreatePlatformConfig · accounts CreatePlatformConfigInstructionAccounts.
| Field | Type |
|---|---|
platform_ | PlatformParams |
Required accounts: 8; extras go to remaining.
Fields of CreatePlatformConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | platform_ | Pubkey |
| 1 | platform_ | Pubkey |
| 2 | platform_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | cpswap_ | Pubkey |
| 5 | system_ | Pubkey |
| 6 | transfer_ | Pubkey |
| 7 | platform_ | Pubkey |
| 8… | remaining | Vec< |
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_ | Pubkey |
| 2 | platform_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
CreatePlatformVestingAccount#
From the program's IDL:
Create vesting account
Arguments
ctx- The context of accountsshare- 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_ | Pubkey |
| 1 | beneficiary | Pubkey |
| 2 | platform_ | Pubkey |
| 3 | pool_state | Pubkey |
| 4 | platform_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
CreateVestingAccount#
From the program's IDL:
Create vesting account
Arguments
ctx- The context of accountsshare- The share amount of base token to be vested
Discriminator 81b2020dd9ace6da · data CreateVestingAccount · accounts CreateVestingAccountInstructionAccounts.
| Field | Type |
|---|---|
share_ | 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_ | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
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_ | MintParams |
curve_param | CurveParams |
vesting_ | VestingParams |
Required accounts: 18; extras go to remaining.
Fields of InitializeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | creator | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | 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_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | metadata_ | Pubkey |
| 14 | system_ | Pubkey |
| 15 | rent_ | Pubkey |
| 16 | event_ | Pubkey |
| 17 | program | Pubkey |
| 18… | remaining | Vec< |
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_ | MintParams |
curve_param | CurveParams |
vesting_ | VestingParams |
amm_fee_on | AmmCreatorFeeOn |
Required accounts: 18; extras go to remaining.
Fields of InitializeV2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | creator | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | 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_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | metadata_ | Pubkey |
| 14 | system_ | Pubkey |
| 15 | rent_ | Pubkey |
| 16 | event_ | Pubkey |
| 17 | program | Pubkey |
| 18… | remaining | Vec< |
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_ | MintParams |
curve_param | CurveParams |
vesting_ | VestingParams |
amm_fee_on | AmmCreatorFeeOn |
transfer_ | Option< |
Required accounts: 15; extras go to remaining.
Fields of InitializeWithToken2022InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | creator | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | 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_ | Pubkey |
| 11 | quote_ | Pubkey |
| 12 | system_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
MigrateToAmm#
From the program's IDL:
Arguments
ctx- The context of accounts
Discriminator cf52c091fecf91df · data MigrateToAmm · accounts MigrateToAmmInstructionAccounts.
| Field | Type |
|---|---|
base_ | u64 |
quote_ | u64 |
market_ | 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_ | Pubkey |
| 4 | market | Pubkey |
| 5 | request_ | Pubkey |
| 6 | event_queue | Pubkey |
| 7 | bids | Pubkey |
| 8 | asks | Pubkey |
| 9 | market_ | Pubkey |
| 10 | market_ | Pubkey |
| 11 | market_ | Pubkey |
| 12 | amm_program | Pubkey |
| 13 | amm_pool | Pubkey |
| 14 | amm_ | Pubkey |
| 15 | amm_ | Pubkey |
| 16 | amm_lp_mint | Pubkey |
| 17 | amm_ | Pubkey |
| 18 | amm_ | Pubkey |
| 19 | amm_ | Pubkey |
| 20 | amm_config | Pubkey |
| 21 | amm_ | Pubkey |
| 22 | authority | Pubkey |
| 23 | pool_state | Pubkey |
| 24 | global_ | Pubkey |
| 25 | base_vault | Pubkey |
| 26 | quote_vault | Pubkey |
| 27 | pool_ | Pubkey |
| 28 | spl_ | Pubkey |
| 29 | associated_ | Pubkey |
| 30 | system_ | Pubkey |
| 31 | rent_ | Pubkey |
| 32… | remaining | Vec< |
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_ | Pubkey |
| 4 | cpswap_ | Pubkey |
| 5 | cpswap_pool | Pubkey |
| 6 | cpswap_ | Pubkey |
| 7 | cpswap_ | Pubkey |
| 8 | cpswap_ | Pubkey |
| 9 | cpswap_ | Pubkey |
| 10 | cpswap_ | Pubkey |
| 11 | cpswap_ | Pubkey |
| 12 | cpswap_ | Pubkey |
| 13 | lock_ | Pubkey |
| 14 | lock_ | Pubkey |
| 15 | lock_ | Pubkey |
| 16 | authority | Pubkey |
| 17 | pool_state | Pubkey |
| 18 | global_ | Pubkey |
| 19 | base_vault | Pubkey |
| 20 | quote_vault | Pubkey |
| 21 | pool_ | Pubkey |
| 22 | base_ | Pubkey |
| 23 | quote_ | Pubkey |
| 24 | associated_ | Pubkey |
| 25 | system_ | Pubkey |
| 26 | rent_ | Pubkey |
| 27 | metadata_ | Pubkey |
| 28… | remaining | Vec< |
RemovePlatformCurveParam#
From the program's IDL:
Remove platform launch param
Arguments
ctx- The context of accountsindex- 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_ | Pubkey |
| 1 | platform_ | Pubkey |
| 2… | remaining | Vec< |
SellExactIn#
From the program's IDL:
Use the given amount of base tokens to sell for quote tokens.
Arguments
ctx- The context of accountsamount_in- Amount of base token to sellminimum_- Minimum amount of quote token to receive (slippage protection)amount_ out share_- Fee rate for the sharefee_ rate
Discriminator 9527de9bd37c981a · data SellExactIn · accounts SellExactInInstructionAccounts.
| Field | Type |
|---|---|
amount_in | u64 |
minimum_ | u64 |
share_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of SellExactInInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | authority | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | pool_state | Pubkey |
| 5 | user_ | Pubkey |
| 6 | user_ | Pubkey |
| 7 | base_vault | Pubkey |
| 8 | quote_vault | Pubkey |
| 9 | base_ | Pubkey |
| 10 | quote_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
SellExactOut#
From the program's IDL:
Sell base tokens for the given amount of quote tokens.
Arguments
ctx- The context of accountsamount_out- Amount of quote token to receivemaximum_- Maximum amount of base token to purchase (slippage protection)amount_ in share_- Fee rate for the sharefee_ rate
Discriminator 5fc8472208090ba6 · data SellExactOut · accounts SellExactOutInstructionAccounts.
| Field | Type |
|---|---|
amount_out | u64 |
maximum_ | u64 |
share_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of SellExactOutInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | authority | Pubkey |
| 2 | global_ | Pubkey |
| 3 | platform_ | Pubkey |
| 4 | pool_state | Pubkey |
| 5 | user_ | Pubkey |
| 6 | user_ | Pubkey |
| 7 | base_vault | Pubkey |
| 8 | quote_vault | Pubkey |
| 9 | base_ | Pubkey |
| 10 | quote_ | Pubkey |
| 11 | base_ | Pubkey |
| 12 | quote_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
UpdateConfig#
From the program's IDL:
Updates configuration parameters
Arguments
ctx- The context of accountsparam- 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_ | Pubkey |
| 2… | remaining | Vec< |
UpdatePlatformConfig#
From the program's IDL:
Update platform config
Arguments
ctx- The context of accountsparam- Parameter to update
Discriminator c33c4c81922d438f · data UpdatePlatformConfig · accounts UpdatePlatformConfigInstructionAccounts.
| Field | Type |
|---|---|
param | PlatformConfigParam |
Required accounts: 2; extras go to remaining.
Fields of UpdatePlatformConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | platform_ | Pubkey |
| 1 | platform_ | Pubkey |
| 2… | remaining | Vec< |
UpdatePlatformCurveParam#
From the program's IDL:
Update platform launch param
Arguments
ctx- The context of accountsbonding_- Parameter to updatecurve_ param
Discriminator 8a908afadc800439 · data UpdatePlatformCurveParam · accounts UpdatePlatformCurveParamInstructionAccounts.
| Field | Type |
|---|---|
index | u8 |
bonding_ | BondingCurveParam |
Required accounts: 4; extras go to remaining.
Fields of UpdatePlatformCurveParamInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | platform_ | Pubkey |
| 1 | platform_ | Pubkey |
| 2 | global_ | Pubkey |
| 3 | system_ | Pubkey |
| 4… | remaining | Vec< |
CpiEvent#
Anchor self-CPI that carries one of the program's 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_ | Pubkey |
| 2… | remaining | Vec< |
Accounts#
Variants of RaydiumLaunchpadAccount. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
GlobalConfig#
Discriminator 95089ccaa0fcb0d9 · accounts::.
| 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_ | u64 | The trade fee rate, denominated in hundredths of a bip (10^-6) |
max_ | u64 | The maximum share fee rate, denominated in hundredths of a bip (10^-6) |
min_ | u64 | The minimum base supply, the value without decimals |
max_ | u64 | The maximum lock rate, denominated in hundredths of a bip (10^-6) |
min_ | u64 | The minimum base sell rate, denominated in hundredths of a bip (10^-6) |
min_ | u64 | The minimum base migrate rate, denominated in hundredths of a bip (10^-6) |
min_ | u64 | The minimum quote fund raising, the value with decimals |
quote_mint | Pubkey | Mint information for quote token |
protocol_ | Pubkey | Protocol Fee owner |
migrate_ | Pubkey | Migrate Fee owner |
migrate_ | Pubkey | Migrate to amm control wallet |
migrate_ | Pubkey | Migrate to cpswap wallet |
requires_ | u8 | Whether a platform must be explicitly authorized before using this global config |
padding_ | [u8; 7] | padding alignment |
padding | [u64; 15] | padding for future updates |
PlatformConfig#
Discriminator a04e8000f853e6a0 · accounts::.
| Field | Type | Description |
|---|---|---|
epoch | u64 | The epoch for update interval |
platform_ | Pubkey | The platform fee wallet |
platform_ | Pubkey | The platform nft wallet to receive the platform NFT after migration if platform_scale is not 0(Only support MigrateType::CPSWAP) |
platform_ | u64 | Scale of the platform liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP) |
creator_ | 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_ | Pubkey | The platform specifies the trade fee rate after migration to cp swap |
creator_ | u64 | Creator fee rate |
transfer_ | Pubkey | If the base token belongs to token2022, then you can choose to support the transferfeeConfig extension, which includes permissions such as transfer_ and withdraw_. When initializing mint, withdraw_ and transfer_ both belongs to the contract. Once the token is migrated to AMM, the authorities will be reset to this value |
platform_ | Pubkey | |
platform_ | u64 | |
platform_ | 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_ | Vec< | The parameters for launching the pool |
PlatformGlobalAccess#
Discriminator ae9384f089dbf310 · accounts::.
| Field | Type | Description |
|---|---|---|
bump | u8 | |
global_ | Pubkey | |
platform_ | Pubkey | |
padding | [u64; 8] | padding for future updates |
PoolState#
Discriminator f7ede3f5d7c3de46 · accounts::.
| 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_ | u8 | Decimals of the pool base token |
quote_ | u8 | Decimals of the pool quote token |
migrate_ | u8 | Migrate to AMM or CpSwap, 0: amm, 1: cpswap |
supply | u64 | Supply of the pool base token |
total_ | u64 | Total sell amount of the base token |
virtual_ | 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_ | 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_ | u64 | The total quote fund raising of the pool |
quote_ | u64 | Accumulated trading fees in quote tokens Can be collected by the protocol fee owner |
platform_ | 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_ | VestingSchedule | Vesting schedule for the base token |
global_ | Pubkey | Public key of the global configuration account Contains protocol-wide settings this pool adheres to |
platform_ | 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_ | 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_ | AmmCreatorFeeOn | migrate to cpmm, creator fee on quote token or both token |
platform_ | u64 | platform vesting token amount |
padding | [u8; 54] | padding for future updates |
VestingRecord#
Discriminator 6af3ddcde67e5553 · accounts::.
| Field | Type | Description |
|---|---|---|
epoch | u64 | Account update epoch |
pool | Pubkey | The pool state account |
beneficiary | Pubkey | The beneficiary of the vesting account |
claimed_ | u64 | The amount of tokens claimed |
token_ | u64 | The share amount of the token to be vested |
padding | [u64; 8] | padding for future updates |
Events#
Variants of instructions::, decoded from the CpiEvent instruction. Each wraps a struct from carbon_. The discriminator is the 8-byte event discriminator that follows the e445a52e51cb9a1d CPI-event tag.
ClaimVestedEvent#
Discriminator 15c2725778d3e220 · events::.
| Field | Type |
|---|---|
pool_state | Pubkey |
beneficiary | Pubkey |
claim_ | u64 |
CreateVestingEvent#
Discriminator 96980bb334d2bf7d · events::.
| Field | Type |
|---|---|
pool_state | Pubkey |
beneficiary | Pubkey |
share_ | u64 |
PoolCreateEvent#
Discriminator 97d7e20976a173ae · events::.
| Field | Type |
|---|---|
pool_state | Pubkey |
creator | Pubkey |
config | Pubkey |
base_ | MintParams |
curve_param | CurveParams |
vesting_ | VestingParams |
amm_fee_on | AmmCreatorFeeOn |
TradeEvent#
Discriminator bddb7fd34ee661ee · events::.
| Field | Type |
|---|---|
pool_state | Pubkey |
total_ | u64 |
virtual_ | u64 |
virtual_ | u64 |
real_ | u64 |
real_ | u64 |
real_ | u64 |
real_ | u64 |
amount_in | u64 |
amount_out | u64 |
protocol_ | u64 |
platform_ | u64 |
creator_fee | u64 |
share_fee | u64 |
trade_ | TradeDirection |
pool_status | PoolStatus |
exact_in | bool |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
AmmCreatorFeeOn#
From the program's IDL:
migrate to cpmm, creator fee on quote token or both token
Enum types::.
| Variant |
|---|
QuoteToken |
BothToken |
BondingCurveParam#
Struct types::.
| Field | Type | Description |
|---|---|---|
migrate_ | u8 | Migrate to AMM or CpSwap, 0: amm, 1: cpswap, Neither 0 nor 1: invalid |
migrate_ | 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_ | u64 | The total base sell of the token 0: invalid |
total_ | u64 | The total quote fund raising of the token 0: invalid |
total_ | u64 | total amount of tokens to be unlocked u64::MAX: invalid |
cliff_ | u64 | Waiting time in seconds before unlocking after fundraising ends u64::MAX: invalid |
unlock_ | u64 | Unlocking period in seconds u64::MAX: invalid |
ClaimVestedEvent#
From the program's IDL:
Emitted when vesting token claimed by beneficiary
Struct types::. Same fields as the ClaimVestedEvent event.
ConstantCurve#
Struct types::.
| Field | Type |
|---|---|
supply | u64 |
total_ | u64 |
total_ | u64 |
migrate_ | u8 |
CreateVestingEvent#
From the program's IDL:
Emitted when vest_account created
Struct types::. Same fields as the CreateVestingEvent event.
CurveParams#
Enum types::.
| Variant | Fields |
|---|---|
Constant | data: ConstantCurve |
Fixed | data: FixedCurve |
Linear | data: LinearCurve |
FixedCurve#
Struct types::.
| Field | Type |
|---|---|
supply | u64 |
total_ | u64 |
migrate_ | u8 |
LinearCurve#
Struct types::.
| Field | Type |
|---|---|
supply | u64 |
total_ | u64 |
migrate_ | u8 |
MigrateNftInfo#
From the program's IDL:
Represents the parameters for initializing a platform config account(Only support MigrateType::CPSWAP) # Fields
platform_- Scale of the platform liquidity quantity rights will be converted into NFTscale creator_- Scale of the token creator liquidity quantity rights will be converted into NFTscale burn_scale- Scale of liquidity directly to burn- platform_scale + creator_scale + burn_scale = RATE_DENOMINATOR_VALUE
Struct types::.
| Field | Type |
|---|---|
platform_ | u64 |
creator_ | 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 tokenname- Name of the tokensymbol- Symbol/ticker of the tokenuri- URI pointing to token metadata
Struct types::.
| Field | Type |
|---|---|
decimals | u8 |
name | String |
symbol | String |
uri | String |
PlatformConfigInfo#
Struct types::.
| Field | Type |
|---|---|
fee_wallet | Pubkey |
nft_wallet | Pubkey |
migrate_ | MigrateNftInfo |
fee_rate | u64 |
name | String |
web | String |
img | String |
transfer_ | Pubkey |
creator_ | u64 |
platform_ | u64 |
vesting_ | Pubkey |
PlatformConfigParam#
Enum types::.
| Variant | Fields |
|---|---|
FeeWallet | Pubkey |
NFTWallet | Pubkey |
MigrateNftInfo | MigrateNftInfo |
FeeRate | u64 |
Name | String |
Web | String |
Img | String |
CpSwapConfig | |
AllInfo | PlatformConfigInfo |
VestingWallet | Pubkey |
PlatformVestingScale | u64 |
PlatformCPCreator | Pubkey |
PlatformCurveParam#
Struct types::.
| Field | Type | Description |
|---|---|---|
epoch | u64 | The epoch for update interval, 0 means not update |
index | u8 | The curve params index |
global_ | Pubkey | The global config address |
bonding_ | 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_- The platform configures liquidity info during migration(Only support MigrateType::CPSWAP)nft_ info fee_rate- Fee rate of the platformname- Name of the platformweb- Website of the platformimg- Image link of the platform/// *
creator_- The fee rate charged by the creator for each transaction.fee_ rate
Struct types::.
| Field | Type |
|---|---|
migrate_ | MigrateNftInfo |
fee_rate | u64 |
name | String |
web | String |
img | String |
creator_ | u64 |
platform_ | u64 |
PoolCreateEvent#
From the program's IDL:
Emitted when pool created
Struct types::. Same fields as the 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::.
| 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::.
| Variant |
|---|
Buy |
Sell |
TradeEvent#
From the program's IDL:
Emitted when trade process
Struct types::. Same fields as the TradeEvent event.
TransferFeeExtensionParams#
Struct types::.
| Field | Type | Description |
|---|---|---|
transfer_ | 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::.
| Field | Type |
|---|---|
total_ | u64 |
cliff_ | u64 |
unlock_ | u64 |
VestingSchedule#
Struct types::.
| Field | Type | Description |
|---|---|---|
total_ | u64 | |
cliff_ | u64 | |
unlock_ | u64 | |
start_time | u64 | |
allocated_ | u64 | Total allocated share amount of the base token, not greater than total_locked_amount |