Raydium CLMM decoder

Decode Raydium CLMM instructions, accounts and events in Rust with carbon-raydium-clmm-decoder 2.0.0. Program ID CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK.

On this page

carbon-raydium-clmm-decoder decodes the instructions, accounts and events of the Raydium CLMM program (CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK): 34 instructions, 12 account types, 15 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.

Cratecarbon-raydium-clmm-decoder 2.0.0
Installcargo add carbon-raydium-clmm-decoder@2.0.0
Program IDCAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK (carbon_raydium_clmm_decoder::PROGRAM_ID)
CategoryDEX & AMM
Decodercarbon_raydium_clmm_decoder::RaydiumClmmDecoder
Instruction enuminstructions::RaydiumClmmInstruction
Account enumaccounts::RaydiumClmmAccount
Event enuminstructions::CpiEvent
Featuresserde, postgres, graphql (none enabled by default)
API docsdocs.rs/carbon-raydium-clmm-decoder/2.0.0
Sourcedecoders/raydium-clmm-decoder

Other DEX and AMM decoders: BonkSwap, FluxBeam, Gavel, Heaven, Jupiter Limit Order, Jupiter Limit Order v2, Kamino Limit Order, Lifinity AMM v2, Meteora DAMM v2, Meteora DLMM, Meteora Pools, OpenBook v2, Orca Whirlpools, PancakeSwap, Phoenix v1, PumpSwap, Raydium AMM v4, Raydium CPMM, Raydium Stable Swap, Stabble Stable Swap, Stabble Weighted Swap. To decode several in one pipeline, see dEX and AMM 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 CLMM transactions from the public RPC and prints every decoded Swap instruction. Add the dependencies:

Terminal
cargo add carbon-core@2.0.0 carbon-raydium-clmm-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
use {
    carbon_core::{
        error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_raydium_clmm_decoder::{
        instructions::RaydiumClmmInstruction, RaydiumClmmDecoder, 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(RaydiumClmmDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, RaydiumClmmInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, RaydiumClmmInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let RaydiumClmmInstruction::Swap { data, accounts, .. } = input.decoded_instruction {
            println!("swap {signature}: {data:?} payer={}", accounts.payer);
        }
        Ok(())
    }
}
Terminal
RUST_LOG=info cargo run

Each Swap instruction prints one line with the transaction signature and the decoded Swap 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 RaydiumClmmInstruction::CpiEvent { data: CpiEvent::CollectPersonalFeeEvent(event), .. } (import instructions::CpiEvent); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_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:

Terminal
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2
src/main.rs
use {
    carbon_core::{
        account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_raydium_clmm_decoder::{accounts::RaydiumClmmAccount, RaydiumClmmDecoder, 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(RaydiumClmmDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

Instructions#

Variants of RaydiumClmmInstruction. Each is RaydiumClmmInstruction::<Variant> { program_id, data, accounts }, where data and accounts are the types listed under the variant, exported from carbon_raydium_clmm_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 CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK.
  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 AccountMetas. 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.

CloseLimitOrder#

From the program's IDL:

Close a limit order
Closes the limit order account when unfilled amount is zero

Arguments

  • ctx - The context of accounts

Discriminator 4c7c800fd55725fa · data CloseLimitOrder · accounts CloseLimitOrderInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of CloseLimitOrderInstructionAccounts, in account order:

#FieldType
0signerPubkey
1rent_receiverPubkey
2limit_orderPubkey
3…remainingVec<AccountMeta>

ClosePosition#

From the program's IDL:

Close the user's position and NFT account. If the NFT mint belongs to token2022, it will also be closed and the funds returned to the NFT owner. # Arguments

  • ctx - The context of accounts

Discriminator 7b86510031446262 · data ClosePosition · accounts ClosePositionInstructionAccounts.

No data fields.

Required accounts: 6; extras go to remaining.

Fields of ClosePositionInstructionAccounts, in account order:

#FieldType
0nft_ownerPubkey
1position_nft_mintPubkey
2position_nft_accountPubkey
3personal_positionPubkey
4system_programPubkey
5token_programPubkey
6…remainingVec<AccountMeta>

CloseProtocolPosition#

From the program's IDL:

The CLMM protocol decides to discard the protocol position account, which can reduce users' opening costs. After the original protocol position account is closed, the gas fee will be refunded to the user who created it. # Arguments

  • ctx - The context of accounts

Discriminator c975989055556cb2 · data CloseProtocolPosition · accounts CloseProtocolPositionInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of CloseProtocolPositionInstructionAccounts, in account order:

#FieldType
0adminPubkey
1protocol_positionPubkey
2…remainingVec<AccountMeta>

CollectFundFee#

From the program's IDL:

Collect the fund fee accrued to the pool

Arguments

  • ctx - The context of accounts
  • amount_0_requested - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1
  • amount_1_requested - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0

Discriminator a78a4e95dfc2067e · data CollectFundFee · accounts CollectFundFeeInstructionAccounts.

FieldType
amount0_requestedu64
amount1_requestedu64

Required accounts: 11; extras go to remaining.

Fields of CollectFundFeeInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1pool_statePubkey
2amm_configPubkey
3token_vault0Pubkey
4token_vault1Pubkey
5vault0_mintPubkey
6vault1_mintPubkey
7recipient_token_account0Pubkey
8recipient_token_account1Pubkey
9token_programPubkey
10token_program2022Pubkey
11…remainingVec<AccountMeta>

CollectProtocolFee#

From the program's IDL:

Collect the protocol fee accrued to the pool

Arguments

  • ctx - The context of accounts
  • amount_0_requested - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1
  • amount_1_requested - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0

Discriminator 8888fcddc2427e59 · data CollectProtocolFee · accounts CollectProtocolFeeInstructionAccounts.

FieldType
amount0_requestedu64
amount1_requestedu64

Required accounts: 11; extras go to remaining.

Fields of CollectProtocolFeeInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1pool_statePubkey
2amm_configPubkey
3token_vault0Pubkey
4token_vault1Pubkey
5vault0_mintPubkey
6vault1_mintPubkey
7recipient_token_account0Pubkey
8recipient_token_account1Pubkey
9token_programPubkey
10token_program2022Pubkey
11…remainingVec<AccountMeta>

CollectRemainingRewards#

From the program's IDL:

Collect remaining reward token for reward founder

Arguments

  • ctx - The context of accounts
  • reward_index - the index to reward info

Discriminator 12eda6c52210d590 · data CollectRemainingRewards · accounts CollectRemainingRewardsInstructionAccounts.

FieldType
reward_indexu8

Required accounts: 8; extras go to remaining.

Fields of CollectRemainingRewardsInstructionAccounts, in account order:

#FieldType
0reward_funderPubkey
1funder_token_accountPubkey
2pool_statePubkey
3reward_token_vaultPubkey
4reward_vault_mintPubkey
5token_programPubkey
6token_program2022Pubkey
7memo_programPubkey
8…remainingVec<AccountMeta>

CreateAmmConfig#

From the program's IDL:

Arguments

  • ctx - The accounts needed by instruction.
  • index - The index of amm config, there may be multiple config.
  • tick_spacing - The tickspacing binding with config, cannot be changed.
  • trade_fee_rate - Trade fee rate, can be changed.
  • protocol_fee_rate - The rate of protocol fee within trade fee.
  • fund_fee_rate - The rate of fund fee within trade fee.
  • limit_fee_rate - The rate of limit order fee.

Discriminator 8934edd4d7756c68 · data CreateAmmConfig · accounts CreateAmmConfigInstructionAccounts.

FieldType
indexu16
tick_spacingu16
trade_fee_rateu32
protocol_fee_rateu32
fund_fee_rateu32

Required accounts: 3; extras go to remaining.

Fields of CreateAmmConfigInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1amm_configPubkey
2system_programPubkey
3…remainingVec<AccountMeta>

CreateCustomizablePool#

From the program's IDL:

Creates a pool for the given token pair with customizable parameters

Arguments

  • ctx - The context of accounts
  • customizable_params - the customizable parameters

Discriminator 2b44d4a7592fa401 · data CreateCustomizablePool · accounts CreateCustomizablePoolInstructionAccounts.

FieldType
customizable_paramsCreateCustomizableParams

Required accounts: 13; extras go to remaining.

Fields of CreateCustomizablePoolInstructionAccounts, in account order:

#FieldType
0pool_creatorPubkey
1amm_configPubkey
2pool_statePubkey
3token_mint0Pubkey
4token_mint1Pubkey
5token_vault0Pubkey
6token_vault1Pubkey
7observation_statePubkey
8tick_array_bitmapPubkey
9token_program0Pubkey
10token_program1Pubkey
11system_programPubkey
12rentPubkey
13…remainingVec<AccountMeta>

CreateDynamicFeeConfig#

From the program's IDL:

Create dynamic fee config

Arguments

  • ctx - The context of accounts
  • index - The index of dynamic fee config
  • filter_period - The period of filter
  • decay_period - The period of decay
  • reduction_factor - The reduction factor
  • adaptive_fee_control_factor - The adaptive fee control factor
  • max_volatility_accumulator - The max volatility accumulator
  • tick_group_size - The tick group size

Discriminator bd0eb5785576e33e · data CreateDynamicFeeConfig · accounts CreateDynamicFeeConfigInstructionAccounts.

FieldType
indexu16
filter_periodu16
decay_periodu16
reduction_factoru16
dynamic_fee_controlu32
max_volatility_accumulatoru32

Required accounts: 3; extras go to remaining.

Fields of CreateDynamicFeeConfigInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1dynamic_fee_configPubkey
2system_programPubkey
3…remainingVec<AccountMeta>

CreateOperationAccount#

From the program's IDL:

Creates an operation account for the program

Arguments

  • ctx - The context of accounts

Discriminator 3f5794216d230868 · data CreateOperationAccount · accounts CreateOperationAccountInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of CreateOperationAccountInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1operation_statePubkey
2system_programPubkey
3…remainingVec<AccountMeta>

CreatePool#

From the program's IDL:

Creates a pool for the given token pair and the initial price

Arguments

  • ctx - The context of accounts
  • sqrt_price_x64 - the initial sqrt price (amount_token_1 / amount_token_0) of the pool as a Q64.64

Note: The open_time must be smaller than the current block_timestamp on chain.

Discriminator e992d18ecf6840bc · data CreatePool · accounts CreatePoolInstructionAccounts.

FieldType
sqrt_price_x64u128
open_timeu64

Required accounts: 13; extras go to remaining.

Fields of CreatePoolInstructionAccounts, in account order:

#FieldType
0pool_creatorPubkey
1amm_configPubkey
2pool_statePubkey
3token_mint0Pubkey
4token_mint1Pubkey
5token_vault0Pubkey
6token_vault1Pubkey
7observation_statePubkey
8tick_array_bitmapPubkey
9token_program0Pubkey
10token_program1Pubkey
11system_programPubkey
12rentPubkey
13…remainingVec<AccountMeta>

CreateSupportMintAssociated#

From the program's IDL:

Create support token22 mint account which can create pool and send rewards while ignoring unsupported extensions.

Discriminator 11fb415c88f20ea9 · data CreateSupportMintAssociated · accounts CreateSupportMintAssociatedInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of CreateSupportMintAssociatedInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1token_mintPubkey
2support_mint_associatedPubkey
3system_programPubkey
4…remainingVec<AccountMeta>

DecreaseLimitOrder#

From the program's IDL:

Decrease/Cancel a limit order
First settle the filled portion of the order; only the remaining unfilled amount can be decreased. Even if the specified amount is very large, the decrease will not exceed the remaining unfilled order amount.
It is recommended to call the settle_limit_order instruction before invoking this instruction to settle any filled portions of the order.
Make sure to check your order's remaining unfilled amount.

Arguments

  • ctx - The context of accounts
  • amount - The decrease amount of the order,
  • amount_min - The minimum amount of the order, which serves as a slippage check

Discriminator 759d3c674231a300 · data DecreaseLimitOrder · accounts DecreaseLimitOrderInstructionAccounts.

FieldType
amountu64
amount_minu64

Required accounts: 12; extras go to remaining.

Fields of DecreaseLimitOrderInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1pool_statePubkey
2tick_arrayPubkey
3limit_orderPubkey
4input_token_accountPubkey
5output_token_accountPubkey
6input_vaultPubkey
7output_vaultPubkey
8input_vault_mintPubkey
9output_vault_mintPubkey
10token_programPubkey
11token_program2022Pubkey
12…remainingVec<AccountMeta>

DecreaseLiquidity#

From the program's IDL:

#[deprecated(note = "Use decrease_liquidity_v2 instead.")] Decreases liquidity for an existing position

Arguments

  • ctx - The context of accounts
  • liquidity - The amount by which liquidity will be decreased
  • amount_0_min - The minimum amount of token_0 that should be accounted for the burned liquidity
  • amount_1_min - The minimum amount of token_1 that should be accounted for the burned liquidity

Discriminator a026d06f685b2c01 · data DecreaseLiquidity · accounts DecreaseLiquidityInstructionAccounts.

FieldType
liquidityu128
amount0_minu64
amount1_minu64

Required accounts: 12; extras go to remaining.

Fields of DecreaseLiquidityInstructionAccounts, in account order:

#FieldType
0nft_ownerPubkey
1nft_accountPubkey
2personal_positionPubkey
3pool_statePubkey
4protocol_positionPubkey
5token_vault0Pubkey
6token_vault1Pubkey
7tick_array_lowerPubkey
8tick_array_upperPubkey
9recipient_token_account0Pubkey
10recipient_token_account1Pubkey
11token_programPubkey
12…remainingVec<AccountMeta>

DecreaseLiquidityV2#

From the program's IDL:

Decreases liquidity for an existing position, support Token2022

Arguments

  • ctx - The context of accounts
  • liquidity - The amount by which liquidity will be decreased
  • amount_0_min - The minimum amount of token_0 that should be accounted for the burned liquidity
  • amount_1_min - The minimum amount of token_1 that should be accounted for the burned liquidity

Discriminator 3a7fbc3e4f52c460 · data DecreaseLiquidityV2 · accounts DecreaseLiquidityV2InstructionAccounts.

FieldType
liquidityu128
amount0_minu64
amount1_minu64

Required accounts: 16; extras go to remaining.

Fields of DecreaseLiquidityV2InstructionAccounts, in account order:

#FieldType
0nft_ownerPubkey
1nft_accountPubkey
2personal_positionPubkey
3pool_statePubkey
4protocol_positionPubkey
5token_vault0Pubkey
6token_vault1Pubkey
7tick_array_lowerPubkey
8tick_array_upperPubkey
9recipient_token_account0Pubkey
10recipient_token_account1Pubkey
11token_programPubkey
12token_program2022Pubkey
13memo_programPubkey
14vault0_mintPubkey
15vault1_mintPubkey
16…remainingVec<AccountMeta>

IncreaseLimitOrder#

From the program's IDL:

Increase a limit order

Arguments

  • ctx - The context of accounts
  • amount - The increase amount of the order
  • is_increase - The direction of the order, true: increase, false: decrease

Discriminator b19059ecfaba7d63 · data IncreaseLimitOrder · accounts IncreaseLimitOrderInstructionAccounts.

FieldType
amountu64

Required accounts: 8; extras go to remaining.

Fields of IncreaseLimitOrderInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1pool_statePubkey
2tick_arrayPubkey
3limit_orderPubkey
4input_token_accountPubkey
5input_vaultPubkey
6input_vault_mintPubkey
7input_token_programPubkey
8…remainingVec<AccountMeta>

IncreaseLiquidity#

From the program's IDL:

#[deprecated(note = "Use increase_liquidity_v2 instead.")] Increases liquidity for an existing position, with amount paid by payer

Arguments

  • ctx - The context of accounts
  • liquidity - The desired liquidity to be added, can't be zero
  • amount_0_max - The max amount of token_0 to spend, which serves as a slippage check
  • amount_1_max - The max amount of token_1 to spend, which serves as a slippage check

Discriminator 2e9cf3760dcdfbb2 · data IncreaseLiquidity · accounts IncreaseLiquidityInstructionAccounts.

FieldType
liquidityu128
amount0_maxu64
amount1_maxu64

Required accounts: 12; extras go to remaining.

Fields of IncreaseLiquidityInstructionAccounts, in account order:

#FieldType
0nft_ownerPubkey
1nft_accountPubkey
2pool_statePubkey
3protocol_positionPubkey
4personal_positionPubkey
5tick_array_lowerPubkey
6tick_array_upperPubkey
7token_account0Pubkey
8token_account1Pubkey
9token_vault0Pubkey
10token_vault1Pubkey
11token_programPubkey
12…remainingVec<AccountMeta>

IncreaseLiquidityV2#

From the program's IDL:

Increases liquidity for an existing position, with amount paid by payer, support Token2022 # Arguments

  • ctx - The context of accounts
  • liquidity - The desired liquidity to be added, if zero, calculate liquidity base amount_0 or amount_1 according base_flag
  • amount_0_max - The max amount of token_0 to spend, which serves as a slippage check
  • amount_1_max - The max amount of token_1 to spend, which serves as a slippage check
  • base_flag - must be specified if liquidity is zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator 851d59df45eeb00a · data IncreaseLiquidityV2 · accounts IncreaseLiquidityV2InstructionAccounts.

FieldType
liquidityu128
amount0_maxu64
amount1_maxu64
base_flagOption<bool>

Required accounts: 15; extras go to remaining.

Fields of IncreaseLiquidityV2InstructionAccounts, in account order:

#FieldType
0nft_ownerPubkey
1nft_accountPubkey
2pool_statePubkey
3protocol_positionPubkey
4personal_positionPubkey
5tick_array_lowerPubkey
6tick_array_upperPubkey
7token_account0Pubkey
8token_account1Pubkey
9token_vault0Pubkey
10token_vault1Pubkey
11token_programPubkey
12token_program2022Pubkey
13vault0_mintPubkey
14vault1_mintPubkey
15…remainingVec<AccountMeta>

InitializeReward#

From the program's IDL:

Initialize a reward info for a given pool and reward index

Arguments

  • ctx - The context of accounts
  • reward_index - the index to reward info
  • open_time - reward open timestamp
  • end_time - reward end timestamp
  • emissions_per_second_x64 - Token reward per second are earned per unit of liquidity.

Discriminator 5f87c0c4f281e644 · data InitializeReward · accounts InitializeRewardInstructionAccounts.

FieldType
paramInitializeRewardParam

Required accounts: 10; extras go to remaining.

Fields of InitializeRewardInstructionAccounts, in account order:

#FieldType
0reward_funderPubkey
1funder_token_accountPubkey
2amm_configPubkey
3pool_statePubkey
4operation_statePubkey
5reward_token_mintPubkey
6reward_token_vaultPubkey
7reward_token_programPubkey
8system_programPubkey
9rentPubkey
10…remainingVec<AccountMeta>

OpenLimitOrder#

From the program's IDL:

Place a limit order

Arguments

  • ctx - The context of accounts
  • nonce_index - The limit order nonce account index, used to create user's order nonce PDA account.
  • zero_for_one - The direction of the order, true: zero for one, false:
    one for zero
  • tick_index - The index of the tick
  • amount - The amount of the order
  • with_metadata - The flag indicating whether to create NFT mint metadata

Discriminator 9d20dab7471d1293 · data OpenLimitOrder · accounts OpenLimitOrderInstructionAccounts.

FieldType
nonce_indexu8
zero_for_onebool
tick_indexi32
amountu64

Required accounts: 10; extras go to remaining.

Fields of OpenLimitOrderInstructionAccounts, in account order:

#FieldType
0payerPubkey
1pool_statePubkey
2tick_arrayPubkey
3limit_order_noncePubkey
4limit_orderPubkey
5input_token_accountPubkey
6input_vaultPubkey
7input_vault_mintPubkey
8input_token_programPubkey
9system_programPubkey
10…remainingVec<AccountMeta>

OpenPosition#

From the program's IDL:

#[deprecated(note = "Use open_position_with_token22_nft instead.")] Creates a new position wrapped in a NFT

Arguments

  • ctx - The context of accounts
  • tick_lower_index - The low boundary of market
  • tick_upper_index - The upper boundary of market
  • tick_array_lower_start_index - The start index of tick array which includes tick low
  • tick_array_upper_start_index - The start index of tick array which includes tick upper
  • liquidity - The liquidity to be added
  • amount_0_max - The max amount of token_0 to spend, which serves as a slippage check
  • amount_1_max - The max amount of token_1 to spend, which serves as a slippage check

Discriminator 87802f4d0f98f031 · data OpenPosition · accounts OpenPositionInstructionAccounts.

FieldType
tick_lower_indexi32
tick_upper_indexi32
tick_array_lower_start_indexi32
tick_array_upper_start_indexi32
liquidityu128
amount0_maxu64
amount1_maxu64

Required accounts: 19; extras go to remaining.

Fields of OpenPositionInstructionAccounts, in account order:

#FieldType
0payerPubkey
1position_nft_ownerPubkey
2position_nft_mintPubkey
3position_nft_accountPubkey
4metadata_accountPubkey
5pool_statePubkey
6protocol_positionPubkey
7tick_array_lowerPubkey
8tick_array_upperPubkey
9personal_positionPubkey
10token_account0Pubkey
11token_account1Pubkey
12token_vault0Pubkey
13token_vault1Pubkey
14rentPubkey
15system_programPubkey
16token_programPubkey
17associated_token_programPubkey
18metadata_programPubkey
19…remainingVec<AccountMeta>

OpenPositionV2#

From the program's IDL:

#[deprecated(note = "Use open_position_with_token22_nft instead.")] Creates a new position wrapped in a NFT, support Token2022

Arguments

  • ctx - The context of accounts
  • tick_lower_index - The low boundary of market
  • tick_upper_index - The upper boundary of market
  • tick_array_lower_start_index - The start index of tick array which includes tick low
  • tick_array_upper_start_index - The start index of tick array which includes tick upper
  • liquidity - The liquidity to be added, if zero, and the base_flag is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity
  • amount_0_max - The max amount of token_0 to spend, which serves as a slippage check
  • amount_1_max - The max amount of token_1 to spend, which serves as a slippage check
  • with_metadata - The flag indicating whether to create NFT mint metadata
  • base_flag - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator 4db84ad67056f1c7 · data OpenPositionV2 · accounts OpenPositionV2InstructionAccounts.

FieldType
tick_lower_indexi32
tick_upper_indexi32
tick_array_lower_start_indexi32
tick_array_upper_start_indexi32
liquidityu128
amount0_maxu64
amount1_maxu64
with_metadatabool
base_flagOption<bool>

Required accounts: 22; extras go to remaining.

Fields of OpenPositionV2InstructionAccounts, in account order:

#FieldType
0payerPubkey
1position_nft_ownerPubkey
2position_nft_mintPubkey
3position_nft_accountPubkey
4metadata_accountPubkey
5pool_statePubkey
6protocol_positionPubkey
7tick_array_lowerPubkey
8tick_array_upperPubkey
9personal_positionPubkey
10token_account0Pubkey
11token_account1Pubkey
12token_vault0Pubkey
13token_vault1Pubkey
14rentPubkey
15system_programPubkey
16token_programPubkey
17associated_token_programPubkey
18metadata_programPubkey
19token_program2022Pubkey
20vault0_mintPubkey
21vault1_mintPubkey
22…remainingVec<AccountMeta>

OpenPositionWithToken22Nft#

From the program's IDL:

Creates a new position wrapped in a Token2022 NFT without relying on metadata_program and metadata_account, reduce the cost for user to create a personal position. # Arguments

  • ctx - The context of accounts
  • tick_lower_index - The low boundary of market
  • tick_upper_index - The upper boundary of market
  • tick_array_lower_start_index - The start index of tick array which includes tick low
  • tick_array_upper_start_index - The start index of tick array which includes tick upper
  • liquidity - The liquidity to be added, if zero, and the base_flag is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity
  • amount_0_max - The max amount of token_0 to spend, which serves as a slippage check
  • amount_1_max - The max amount of token_1 to spend, which serves as a slippage check
  • with_metadata - The flag indicating whether to create NFT mint metadata
  • base_flag - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max

Discriminator 4dffae527d1dc92e · data OpenPositionWithToken22Nft · accounts OpenPositionWithToken22NftInstructionAccounts.

FieldType
tick_lower_indexi32
tick_upper_indexi32
tick_array_lower_start_indexi32
tick_array_upper_start_indexi32
liquidityu128
amount0_maxu64
amount1_maxu64
with_metadatabool
base_flagOption<bool>

Required accounts: 20; extras go to remaining.

Fields of OpenPositionWithToken22NftInstructionAccounts, in account order:

#FieldType
0payerPubkey
1position_nft_ownerPubkey
2position_nft_mintPubkey
3position_nft_accountPubkey
4pool_statePubkey
5protocol_positionPubkey
6tick_array_lowerPubkey
7tick_array_upperPubkey
8personal_positionPubkey
9token_account0Pubkey
10token_account1Pubkey
11token_vault0Pubkey
12token_vault1Pubkey
13rentPubkey
14system_programPubkey
15token_programPubkey
16associated_token_programPubkey
17token_program2022Pubkey
18vault0_mintPubkey
19vault1_mintPubkey
20…remainingVec<AccountMeta>

SetRewardParams#

From the program's IDL:

Reset reward param, start a new reward cycle or extend the current cycle.

Arguments

  • ctx - The context of accounts
  • reward_index - The index of reward token in the pool.
  • emissions_per_second_x64 - The per second emission reward, when extend the current cycle,

new value can't be less than old value

  • open_time - reward open timestamp, must be set when starting a new cycle
  • end_time - reward end timestamp

Discriminator 7034a74b20c9d389 · data SetRewardParams · accounts SetRewardParamsInstructionAccounts.

FieldType
reward_indexu8
emissions_per_second_x64u128
open_timeu64
end_timeu64

Required accounts: 6; extras go to remaining.

Fields of SetRewardParamsInstructionAccounts, in account order:

#FieldType
0authorityPubkey
1amm_configPubkey
2pool_statePubkey
3operation_statePubkey
4token_programPubkey
5token_program2022Pubkey
6…remainingVec<AccountMeta>

SettleLimitOrder#

From the program's IDL:

Settle a limit order

Arguments

  • ctx - The context of accounts

Discriminator cd4e74215c691a60 · data SettleLimitOrder · accounts SettleLimitOrderInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of SettleLimitOrderInstructionAccounts, in account order:

#FieldType
0signerPubkey
1pool_statePubkey
2tick_arrayPubkey
3limit_orderPubkey
4output_token_accountPubkey
5output_vaultPubkey
6output_vault_mintPubkey
7output_token_programPubkey
8…remainingVec<AccountMeta>

Swap#

From the program's IDL:

#[deprecated(note = "Use swap_v2 instead.")] Swaps one token for as much as possible of another token across a single pool # Arguments

  • ctx - The context of accounts
  • amount - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)
  • other_amount_threshold - For slippage check
  • sqrt_price_limit - The Q64.64 sqrt price √P limit. If zero for one, the price cannot
  • is_base_input - swap base input or swap base output

Discriminator f8c69e91e17587c8 · data Swap · accounts SwapInstructionAccounts.

FieldType
amountu64
other_amount_thresholdu64
sqrt_price_limit_x64u128
is_base_inputbool

Required accounts: 10; extras go to remaining.

Fields of SwapInstructionAccounts, in account order:

#FieldType
0payerPubkey
1amm_configPubkey
2pool_statePubkey
3input_token_accountPubkey
4output_token_accountPubkey
5input_vaultPubkey
6output_vaultPubkey
7observation_statePubkey
8token_programPubkey
9tick_arrayPubkey
10…remainingVec<AccountMeta>

SwapRouterBaseIn#

From the program's IDL:

Swap token for as much as possible of another token across the path provided, base input # Arguments

  • ctx - The context of accounts
  • amount_in - Token amount to be swapped in
  • amount_out_minimum - Panic if output amount is below minimum amount. For slippage.

Discriminator 457d73daf5baf2c4 · data SwapRouterBaseIn · accounts SwapRouterBaseInInstructionAccounts.

FieldType
amount_inu64
amount_out_minimumu64

Required accounts: 6; extras go to remaining.

Fields of SwapRouterBaseInInstructionAccounts, in account order:

#FieldType
0payerPubkey
1input_token_accountPubkey
2input_token_mintPubkey
3token_programPubkey
4token_program2022Pubkey
5memo_programPubkey
6…remainingVec<AccountMeta>

SwapV2#

From the program's IDL:

Swaps one token for as much as possible of another token across a single pool, support token program 2022 # Arguments

  • ctx - The context of accounts
  • amount - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)
  • other_amount_threshold - For slippage check
  • sqrt_price_limit - The Q64.64 sqrt price √P limit. If zero for one, the price cannot
  • is_base_input - swap base input or swap base output

Discriminator 2b04ed0b1ac91e62 · data SwapV2 · accounts SwapV2InstructionAccounts.

FieldType
amountu64
other_amount_thresholdu64
sqrt_price_limit_x64u128
is_base_inputbool

Required accounts: 13; extras go to remaining.

Fields of SwapV2InstructionAccounts, in account order:

#FieldType
0payerPubkey
1amm_configPubkey
2pool_statePubkey
3input_token_accountPubkey
4output_token_accountPubkey
5input_vaultPubkey
6output_vaultPubkey
7observation_statePubkey
8token_programPubkey
9token_program2022Pubkey
10memo_programPubkey
11input_vault_mintPubkey
12output_vault_mintPubkey
13…remainingVec<AccountMeta>

TransferRewardOwner#

From the program's IDL:

Transfer reward owner

Arguments

  • ctx - The context of accounts
  • new_owner - new owner pubkey

Discriminator 07160c53f22b3079 · data TransferRewardOwner · accounts TransferRewardOwnerInstructionAccounts.

FieldType
new_ownerPubkey

Required accounts: 2; extras go to remaining.

Fields of TransferRewardOwnerInstructionAccounts, in account order:

#FieldType
0authorityPubkey
1pool_statePubkey
2…remainingVec<AccountMeta>

UpdateAmmConfig#

From the program's IDL:

Updates the owner of the amm config
Must be called by the current owner or admin

Arguments

  • ctx - The context of accounts
  • trade_fee_rate - The new trade fee rate of amm config, be set when param is 0
  • protocol_fee_rate - The new protocol fee rate of amm config, be set when param is 1
  • fund_fee_rate - The new fund fee rate of amm config, be set when param is 2
  • new_owner - The config's new owner, be set when param is 3
  • new_fund_owner - The config's new fund owner, be set when param is 4
  • limit_protocol_fee_rate - The new limit protocol fee rate of amm config, be set when param is 5
  • limit_fund_fee_rate - The new limit fund fee rate of amm config, be set when param is 6
  • param - The value can be 0 | 1 | 2 | 3 | 4 | 5 | 6, otherwise will report an error

Discriminator 313cae889a1c74c8 · data UpdateAmmConfig · accounts UpdateAmmConfigInstructionAccounts.

FieldType
paramu8
valueu32

Required accounts: 2; extras go to remaining.

Fields of UpdateAmmConfigInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1amm_configPubkey
2…remainingVec<AccountMeta>

UpdateDynamicFeeConfig#

From the program's IDL:

Updates the dynamic fee configuration constants.
This function allows updating the parameters that control dynamic fee calculation, such as filter period, decay period, reduction factor, fee control factor, etc. Only the admin or the amm config owner can update these settings. # Arguments

  • ctx - The context of accounts
  • filter_period - Period that determines the high frequency trading time window (in seconds)
  • decay_period - Period that determines when the dynamic fee starts to decrease (in seconds)
  • reduction_factor - Dynamic fee rate decrement rate, used for volatility reference decay
  • dynamic_fee_control - Factor used to scale the dynamic fee component
  • max_volatility_accumulator - Maximum value for the volatility accumulator
  • create_pool_authority - The new authority pubkey that can use this dynamic fee config to create pools

Discriminator 0707500802c784f0 · data UpdateDynamicFeeConfig · accounts UpdateDynamicFeeConfigInstructionAccounts.

FieldType
filter_periodu16
decay_periodu16
reduction_factoru16
dynamic_fee_controlu32
max_volatility_accumulatoru32

Required accounts: 2; extras go to remaining.

Fields of UpdateDynamicFeeConfigInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1dynamic_fee_configPubkey
2…remainingVec<AccountMeta>

UpdateOperationAccount#

From the program's IDL:

Update the operation account

Arguments

  • ctx - The context of accounts
  • param - The value can be 0 | 1 | 2 | 3, otherwise will report an error
  • keys- update operation owner when the param is 0

remove operation owner when the param is 1 update whitelist mint when the param is 2 remove whitelist mint when the param is 3

Discriminator 7f467728bce33d07 · data UpdateOperationAccount · accounts UpdateOperationAccountInstructionAccounts.

FieldType
paramu8
keysVec<Pubkey>

Required accounts: 3; extras go to remaining.

Fields of UpdateOperationAccountInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1operation_statePubkey
2system_programPubkey
3…remainingVec<AccountMeta>

UpdatePoolStatus#

From the program's IDL:

Update pool status for given value

Arguments

  • ctx - The context of accounts
  • status - The value of status

Discriminator 82576c062ee0757b · data UpdatePoolStatus · accounts UpdatePoolStatusInstructionAccounts.

FieldType
statusu8

Required accounts: 2; extras go to remaining.

Fields of UpdatePoolStatusInstructionAccounts, in account order:

#FieldType
0authorityPubkey
1pool_statePubkey
2…remainingVec<AccountMeta>

UpdateRewardInfos#

From the program's IDL:

Update rewards info of the given pool, can be called for everyone

Arguments

  • ctx - The context of accounts

Discriminator a3ace0340b9a6adf · data UpdateRewardInfos · accounts UpdateRewardInfosInstructionAccounts.

No data fields.

Required accounts: 1; extras go to remaining.

Fields of UpdateRewardInfosInstructionAccounts, in account order:

#FieldType
0pool_statePubkey
1…remainingVec<AccountMeta>

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:

#FieldType
0programPubkey
1event_authorityPubkey
2…remainingVec<AccountMeta>

Accounts#

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

AmmConfig#

Discriminator daf42168cbcb2b6f · accounts::amm_config::AmmConfig.

FieldTypeDescription
bumpu8Bump to identify PDA
indexu16
ownerPubkeyAddress of the protocol owner
protocol_fee_rateu32The protocol fee
trade_fee_rateu32The trade fee, denominated in hundredths of a bip (10^-6)
tick_spacingu16The tick spacing
fund_fee_rateu32The fund fee, denominated in hundredths of a bip (10^-6)
padding_u32u32
fund_ownerPubkeyThe fund owner
padding[u64; 3]

DynamicFeeConfig#

Discriminator f4e258520e3bf6dc · accounts::dynamic_fee_config::DynamicFeeConfig.

FieldType
indexu16
filter_periodu16
decay_periodu16
reduction_factoru16
dynamic_fee_controlu32
max_volatility_accumulatoru32
padding[u64; 8]

LimitOrderNonce#

Discriminator 1199ec3919c7e7f8 · accounts::limit_order_nonce::LimitOrderNonce.

FieldType
user_walletPubkey
nonce_indexu8
order_nonceu64
padding[u64; 4]

LimitOrderState#

Discriminator 01ee058ecf3e2ce4 · accounts::limit_order_state::LimitOrderState.

FieldTypeDescription
pool_idPubkey
ownerPubkeyOwner of this limit order
tick_indexi32
zero_for_onebool
order_phaseu64Order phase of this limit order, aligned with TickState.order_phase for FIFO semantics
total_amountu64Total amount of the limit order
filled_amountu64Filled amount of the limit order (informational, for events/display)
settle_baseu64The unfilled amount when the current computation segment started. Set to total_amount on open, reset on decrease. Never updated during settle — this avoids cascading floor-division error across multiple settles.
settled_outputu64Cumulative output paid to user in the current segment. Reset on decrease. Each settle computes total_output from the segment base and pays the diff (total_output - settled_output), limiting dust deduction to once per segment.
open_timeu64Order open time
unfilled_ratio_x64u128Snapshot of TickState.unfilled_ratio_x64 at the time this segment started (Q64.64). Initialized to Q64 on open; reset to tick's current ratio on decrease.
padding[u64; 4]

ObservationState#

Discriminator 7aaec5358109a584 · accounts::observation_state::ObservationState.

FieldTypeDescription
initializedboolWhether the ObservationState is initialized
recent_epochu64recent update epoch
observation_indexu16the most-recently updated index of the observations array
pool_idPubkeybelongs to which pool
observations[Observation; 100]observation array
padding[u64; 4]padding for feature update

OperationState#

Discriminator 13ec3aed51deb7fc · accounts::operation_state::OperationState.

FieldTypeDescription
bumpu8Bump to identify PDA
operation_owners[Pubkey; 10]Address of the operation owner
whitelist_mints[Pubkey; 100]The mint address of whitelist to emit reward

PersonalPositionState#

Discriminator 466f967ee60f1975 · accounts::personal_position_state::PersonalPositionState.

FieldTypeDescription
bump[u8; 1]Bump to identify PDA
nft_mintPubkeyMint address of the tokenized position
pool_idPubkeyThe ID of the pool with which this token is connected
tick_lower_indexi32The lower bound tick of the position
tick_upper_indexi32The upper bound tick of the position
liquidityu128The amount of liquidity owned by this position
fee_growth_inside0_last_x64u128The token_0 fee growth of the aggregate position as of the last action on the individual position
fee_growth_inside1_last_x64u128The token_1 fee growth of the aggregate position as of the last action on the individual position
token_fees_owed0u64The fees owed to the position owner in token_0, as of the last computation
token_fees_owed1u64The fees owed to the position owner in token_1, as of the last computation
reward_infos[PositionRewardInfo; 3]
recent_epochu64
padding[u64; 7]

PoolState#

Discriminator f7ede3f5d7c3de46 · accounts::pool_state::PoolState.

FieldTypeDescription
bump[u8; 1]Bump to identify PDA
amm_configPubkey
ownerPubkey
token_mint0PubkeyToken pair of the pool, where token_mint_0 address < token_mint_1 address
token_mint1Pubkey
token_vault0PubkeyToken pair vault
token_vault1Pubkey
observation_keyPubkeyobservation account key
mint_decimals0u8mint0 and mint1 decimals
mint_decimals1u8
tick_spacingu16The minimum number of ticks between initialized ticks
liquidityu128The currently in range liquidity available to the pool.
sqrt_price_x64u128The current price of the pool as a sqrt(token_1/token_0) Q64.64 value
tick_currenti32The current tick of the pool, i.e. according to the last tick transition that was run.
padding3u16
padding4u16
fee_growth_global0_x64u128The fee growth as a Q64.64 number, i.e. fees of token_0 and token_1 collected per unit of liquidity for the entire life of the pool.
fee_growth_global1_x64u128
protocol_fees_token0u64The amounts of token_0 and token_1 that are owed to the protocol.
protocol_fees_token1u64
padding5[u128; 4]
statusu8Bitwise representation of the state of the pool bit0, 1: disable open position and increase liquidity, 0: normal bit1, 1: disable decrease liquidity, 0: normal bit2, 1: disable collect fee, 0: normal bit3, 1: disable collect reward, 0: normal bit4, 1: disable swap, 0: normal bit5, 1: disable limit order, 0: normal
fee_onu8Fee on which token (0 = FromInput, 1 = Token0Only, 2 = Token1Only)
padding[u8; 6]Leave blank for future use
reward_infos[RewardInfo; 3]
tick_array_bitmap[u64; 16]Packed initialized tick array state
padding6[u64; 4]
fund_fees_token0u64
fund_fees_token1u64
open_timeu64
recent_epochu64
dynamic_fee_infoDynamicFeeInfoDynamic fee info
padding1[u64; 14]
padding2[u64; 32]

ProtocolPositionState#

Discriminator 64e2916392daa06a · accounts::protocol_position_state::ProtocolPositionState.

FieldTypeDescription
bumpu8Bump to identify PDA
pool_idPubkeyThe ID of the pool with which this token is connected
tick_lower_indexi32The lower bound tick of the position
tick_upper_indexi32The upper bound tick of the position
liquidityu128The amount of liquidity owned by this position
fee_growth_inside0_last_x64u128The token_0 fee growth per unit of liquidity as of the last update to liquidity or fees owed
fee_growth_inside1_last_x64u128The token_1 fee growth per unit of liquidity as of the last update to liquidity or fees owed
token_fees_owed0u64The fees owed to the position owner in token_0
token_fees_owed1u64The fees owed to the position owner in token_1
reward_growth_inside[u128; 3]The reward growth per unit of liquidity as of the last update to liquidity
recent_epochu64
padding[u64; 7]

SupportMintAssociated#

Discriminator 8628b74f0c70a235 · accounts::support_mint_associated::SupportMintAssociated.

FieldTypeDescription
bumpu8Bump to identify PDA
mintPubkeyAddress of the supported token22 mint
padding[u64; 8]

TickArrayBitmapExtension#

Discriminator 3c9624db61808b99 · accounts::tick_array_bitmap_extension::TickArrayBitmapExtension.

FieldTypeDescription
pool_idPubkey
positive_tick_array_bitmap[[u64; 8]; 14]Packed initialized tick array state for start_tick_index is positive
negative_tick_array_bitmap[[u64; 8]; 14]Packed initialized tick array state for start_tick_index is negitive

TickArrayState#

Discriminator c09b55cd31f9812a · accounts::tick_array_state::TickArrayState.

FieldType
pool_idPubkey
start_tick_indexi32
ticks[TickState; 60]
initialized_tick_countu8
recent_epochu64
padding[u8; 107]

Events#

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

CollectPersonalFeeEvent#

Discriminator a6ae69c051a15369 · events::collect_personal_fee_event::CollectPersonalFeeEventEvent.

FieldTypeDescription
position_nft_mintPubkeyThe ID of the token for which underlying tokens were collected
recipient_token_account0PubkeyThe token account that received the collected token_0 tokens
recipient_token_account1PubkeyThe token account that received the collected token_1 tokens
amount0u64The amount of token_0 owed to the position that was collected
amount1u64The amount of token_1 owed to the position that was collected

CollectProtocolFeeEvent#

Discriminator ce57114f2d29d53d · events::collect_protocol_fee_event::CollectProtocolFeeEventEvent.

FieldTypeDescription
pool_statePubkeyThe pool whose protocol fee is collected
recipient_token_account0PubkeyThe address that receives the collected token_0 protocol fees
recipient_token_account1PubkeyThe address that receives the collected token_1 protocol fees
amount0u64The amount of token_0 protocol fees that is withdrawn
amount1u64The amount of token_0 protocol fees that is withdrawn

ConfigChangeEvent#

Discriminator f7bd07776a705f97 · events::config_change_event::ConfigChangeEventEvent.

FieldType
indexu16
ownerPubkey
protocol_fee_rateu32
trade_fee_rateu32
tick_spacingu16
fund_fee_rateu32
fund_ownerPubkey

CreatePersonalPositionEvent#

Discriminator 641e57f9c4df9ace · events::create_personal_position_event::CreatePersonalPositionEventEvent.

FieldTypeDescription
pool_statePubkeyThe pool for which liquidity was added
minterPubkeyThe address that create the position
nft_ownerPubkeyThe owner of the position and recipient of any minted liquidity
tick_lower_indexi32The lower tick of the position
tick_upper_indexi32The upper tick of the position
liquidityu128The amount of liquidity minted to the position range
deposit_amount0u64The amount of token_0 was deposit for the liquidity
deposit_amount1u64The amount of token_1 was deposit for the liquidity
deposit_amount0_transfer_feeu64The token transfer fee for deposit_amount_0
deposit_amount1_transfer_feeu64The token transfer fee for deposit_amount_1

DecreaseLimitOrderEvent#

Discriminator 463028dddbedd4a3 · events::decrease_limit_order_event::DecreaseLimitOrderEventEvent.

FieldTypeDescription
pool_idPubkeyThe pool whose limit order was decreased
limit_orderPubkeyThe limit order account
zero_for_oneboolDirection of the limit order (true if zero_for_one)
tick_indexi32Tick index of the limit order
total_amountu64Total amount of the limit order
filled_amountu64Filled amount of the limit order
settled_output_amountu64Amount of output tokens settled (excluding fees)
decreased_amountu64Amount of input tokens returned to user

DecreaseLiquidityEvent#

Discriminator 3ade563a44325538 · events::decrease_liquidity_event::DecreaseLiquidityEventEvent.

FieldTypeDescription
position_nft_mintPubkeyThe ID of the token for which liquidity was decreased
liquidityu128The amount by which liquidity for the position was decreased
decrease_amount0u64The amount of token_0 that was paid for the decrease in liquidity
decrease_amount1u64The amount of token_1 that was paid for the decrease in liquidity
fee_amount0u64
fee_amount1u64The amount of token_1 fee
reward_amounts[u64; 3]The amount of rewards
transfer_fee0u64The amount of token_0 transfer fee
transfer_fee1u64The amount of token_1 transfer fee

IncreaseLimitOrderEvent#

Discriminator 0b780dccc75713c8 · events::increase_limit_order_event::IncreaseLimitOrderEventEvent.

FieldTypeDescription
pool_idPubkeyThe pool whose limit order was increased
limit_orderPubkeyThe limit order account
zero_for_oneboolDirection of the limit order (true if zero_for_one)
tick_indexi32Tick index of the limit order
total_amountu64Total amount of the limit order
increased_amountu64Increased amount of the limit order
transfer_feeu64Transfer fee of the limit order

IncreaseLiquidityEvent#

Discriminator 314f69d420221e54 · events::increase_liquidity_event::IncreaseLiquidityEventEvent.

FieldTypeDescription
position_nft_mintPubkeyThe ID of the token for which liquidity was increased
liquidityu128The amount by which liquidity for the NFT position was increased
amount0u64The amount of token_0 that was paid for the increase in liquidity
amount1u64The amount of token_1 that was paid for the increase in liquidity
amount0_transfer_feeu64The token transfer fee for amount_0
amount1_transfer_feeu64The token transfer fee for amount_1

LiquidityCalculateEvent#

Discriminator ed7094e63954b4a2 · events::liquidity_calculate_event::LiquidityCalculateEventEvent.

FieldTypeDescription
pool_liquidityu128The pool liquidity before decrease or increase
pool_sqrt_price_x64u128The pool price when decrease or increase in liquidity
pool_ticki32The pool tick when decrease or increase in liquidity
calc_amount0u64The amount of token_0 that was calculated for the decrease or increase in liquidity
calc_amount1u64The amount of token_1 that was calculated for the decrease or increase in liquidity
trade_fee_owed0u64
trade_fee_owed1u64The amount of token_1 fee
transfer_fee0u64The amount of token_0 transfer fee without trade_fee_amount_0
transfer_fee1u64The amount of token_1 transfer fee without trade_fee_amount_0

LiquidityChangeEvent#

Discriminator 7ef0afce9e58996b · events::liquidity_change_event::LiquidityChangeEventEvent.

FieldTypeDescription
pool_statePubkeyThe pool for swap
ticki32The tick of the pool
tick_loweri32The tick lower of position
tick_upperi32The tick lower of position
liquidity_beforeu128The liquidity of the pool before liquidity change
liquidity_afteru128The liquidity of the pool after liquidity change

OpenLimitOrderEvent#

Discriminator 6a18475539a99ed8 · events::open_limit_order_event::OpenLimitOrderEventEvent.

FieldTypeDescription
pool_idPubkeyThe pool whose limit order was opened
limit_orderPubkeyThe limit order account
zero_for_oneboolDirection of the limit order (true if zero_for_one)
tick_indexi32Tick index of the limit order
total_amountu64Total amount of the limit order
transfer_feeu64Transfer fee of the limit order

PoolCreatedEvent#

Discriminator 195e4b2f7063353f · events::pool_created_event::PoolCreatedEventEvent.

FieldTypeDescription
token_mint0PubkeyThe first token of the pool by address sort order
token_mint1PubkeyThe second token of the pool by address sort order
tick_spacingu16The minimum number of ticks between initialized ticks
pool_statePubkeyThe address of the created pool
sqrt_price_x64u128The initial sqrt price of the pool, as a Q64.64
ticki32The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
token_vault0PubkeyVault of token_0
token_vault1PubkeyVault of token_1

SettleLimitOrderEvent#

Discriminator 58774da47d7c0ac2 · events::settle_limit_order_event::SettleLimitOrderEventEvent.

FieldTypeDescription
pool_idPubkeyThe pool whose limit order was settled
limit_orderPubkeyThe limit order account
zero_for_oneboolDirection of the limit order (true if zero_for_one)
tick_indexi32Tick index of the limit order
total_amountu64Total amount of the limit order
filled_amountu64Filled amount of the limit order
settled_amount_outu64Amount of output tokens transferred (excluding fees)

SwapEvent#

Discriminator 40c6cde8260871e2 · events::swap_event::SwapEventEvent.

FieldTypeDescription
pool_statePubkeyThe pool for which token_0 and token_1 were swapped
senderPubkeyThe address that initiated the swap call, and that received the callback
token_account0PubkeyThe payer token account in zero for one swaps, or the recipient token account in one for zero swaps
token_account1PubkeyThe payer token account in one for zero swaps, or the recipient token account in zero for one swaps
amount0u64The real delta amount of the token_0 of the pool or user
transfer_fee0u64The transfer fee charged by the withheld_amount of the token_0
amount1u64The real delta of the token_1 of the pool or user
transfer_fee1u64The transfer fee charged by the withheld_amount of the token_1
zero_for_oneboolif true, amount_0 is negtive and amount_1 is positive
sqrt_price_x64u128The sqrt(price) of the pool after the swap, as a Q64.64
liquidityu128The liquidity of the pool after the swap
ticki32The log base 1.0001 of price of the pool after the swap

UpdateRewardInfosEvent#

Discriminator 6d7fba4e724125ec · events::update_reward_infos_event::UpdateRewardInfosEventEvent.

FieldTypeDescription
reward_growth_global_x64[u128; 3]Reward info

Types#

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

CollectFeeOn#

Enum types::CollectFeeOn.

Variant
FromInput
Token0Only
Token1Only

CollectPersonalFeeEvent#

From the program's IDL:

Emitted when tokens are collected for a position

Struct types::CollectPersonalFeeEvent. Same fields as the CollectPersonalFeeEvent event.

CollectProtocolFeeEvent#

From the program's IDL:

Emitted when the collected protocol fees are withdrawn by the factory owner

Struct types::CollectProtocolFeeEvent. Same fields as the CollectProtocolFeeEvent event.

ConfigChangeEvent#

From the program's IDL:

Emitted when create or update a config

Struct types::ConfigChangeEvent. Same fields as the ConfigChangeEvent event.

CreateCustomizableParams#

Struct types::CreateCustomizableParams.

FieldType
sqrt_price_x64u128
collect_fee_onCollectFeeOn
enable_dynamic_feebool

CreatePersonalPositionEvent#

From the program's IDL:

Emitted when create a new position

Struct types::CreatePersonalPositionEvent. Same fields as the CreatePersonalPositionEvent event.

DecreaseLimitOrderEvent#

Struct types::DecreaseLimitOrderEvent. Same fields as the DecreaseLimitOrderEvent event.

DecreaseLiquidityEvent#

From the program's IDL:

Emitted when liquidity is decreased.

Struct types::DecreaseLiquidityEvent. Same fields as the DecreaseLiquidityEvent event.

DynamicFeeInfo#

From the program's IDL:

Dynamic fee information for pool configuration

Struct types::DynamicFeeInfo.

FieldTypeDescription
filter_periodu16Period that determines the high frequency trading time window (in seconds).
decay_periodu16Period that determines when the dynamic fee starts to decrease (in seconds).
reduction_factoru16Dynamic fee rate decrement rate, used for volatility reference decay.
dynamic_fee_controlu32Factor used to scale the dynamic fee component in the fee rate calculation.
max_volatility_accumulatoru32Maximum value for the volatility accumulator, used to cap the dynamic fee rate.
tick_spacing_index_referencei32Active tick spacing index at the last reference update.
volatility_referenceu32Volatility reference value, stores the decayed volatility accumulator.
volatility_accumulatoru32Volatility accumulator, used to calculate the dynamic fee rate.
last_update_timestampu64Last timestamp (block time) when volatility_reference and tick_spacing_index_reference were updated.
padding[u8; 46]Reserved for future upgrades.

IncreaseLimitOrderEvent#

Struct types::IncreaseLimitOrderEvent. Same fields as the IncreaseLimitOrderEvent event.

IncreaseLiquidityEvent#

From the program's IDL:

Emitted when liquidity is increased.

Struct types::IncreaseLiquidityEvent. Same fields as the IncreaseLiquidityEvent event.

InitializeRewardParam#

Struct types::InitializeRewardParam.

FieldTypeDescription
open_timeu64Reward open time
end_timeu64Reward end time
emissions_per_second_x64u128Token reward per second are earned per unit of liquidity

LiquidityCalculateEvent#

From the program's IDL:

Emitted when liquidity decreased or increase.

Struct types::LiquidityCalculateEvent. Same fields as the LiquidityCalculateEvent event.

LiquidityChangeEvent#

From the program's IDL:

Emitted pool liquidity change when increase and decrease liquidity

Struct types::LiquidityChangeEvent. Same fields as the LiquidityChangeEvent event.

Observation#

From the program's IDL:

The element of observations in ObservationState

Struct types::Observation.

FieldTypeDescription
block_timestampu32The block timestamp of the observation
tick_cumulativei64the cumulative of tick during the duration time
padding[u64; 4]padding for feature update

OpenLimitOrderEvent#

From the program's IDL:

Emitted when a limit order is opened

Struct types::OpenLimitOrderEvent. Same fields as the OpenLimitOrderEvent event.

PoolCreatedEvent#

From the program's IDL:

Emitted when a pool is created and initialized with a starting price

Struct types::PoolCreatedEvent. Same fields as the PoolCreatedEvent event.

PositionRewardInfo#

Struct types::PositionRewardInfo.

FieldType
growth_inside_last_x64u128
reward_amount_owedu64

RewardInfo#

Struct types::RewardInfo.

FieldTypeDescription
reward_stateu8Reward state
open_timeu64Reward open time
end_timeu64Reward end time
last_update_timeu64Reward last update time
emissions_per_second_x64u128Q64.64 number indicates how many tokens per second are earned per unit of liquidity.
reward_total_emittedu64The total amount of reward emitted
reward_claimedu64The total amount of claimed reward
token_mintPubkeyReward token mint.
token_vaultPubkeyReward vault token account.
authorityPubkeyThe owner that has permission to set reward param
reward_growth_global_x64u128Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward emissions were turned on.

SettleLimitOrderEvent#

From the program's IDL:

Emitted when a limit order is settled and proceeds are transferred

Struct types::SettleLimitOrderEvent. Same fields as the SettleLimitOrderEvent event.

SwapEvent#

From the program's IDL:

Emitted by when a swap is performed for a pool

Struct types::SwapEvent. Same fields as the SwapEvent event.

TickState#

Struct types::TickState.

FieldTypeDescription
ticki32
liquidity_neti128Amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left)
liquidity_grossu128The total position liquidity that references this tick
fee_growth_outside0_x64u128Fee growth per unit of liquidity on the other side of this tick (relative to the current tick) only has relative meaning, not absolute — the value depends on when the tick is initialized
fee_growth_outside1_x64u128
reward_growths_outside_x64[u128; 3]Reward growth per unit of liquidity like fee, array of Q64.64
order_phaseu64Order phase of the tick, used as a FIFO cohort index for limit orders
orders_amountu64The amount of limit orders that have never been matched, only counts newly opened orders, not partially filled ones
part_filled_orders_remainingu64Remaining part filled orders amount
unfilled_ratio_x64u128Cumulative unfilled ratio for the current part-filled cohort (Q64.64 format). Starts at Q64(1) when a new cohort forms, multiplied down as fills occur.
padding[u32; 3]

UpdateRewardInfosEvent#

From the program's IDL:

Emitted when Reward are updated for a pool

Struct types::UpdateRewardInfosEvent. Same fields as the UpdateRewardInfosEvent event.

Generated from the crate’s source at Carbon v2.0.0, so it always matches the published code. Spotted a problem? Report it; edits to this page itself are overwritten on the next release.

Your endpoints

Code samples use these instead of the placeholders, so you can copy and run them as they are. They’re stored only in this browser and never sent anywhere.