Meteora DAMM v2 decoder

Decode Meteora DAMM v2 instructions, accounts and events in Rust with the carbon-meteora-damm-v2-decoder crate.

On this page

carbon-meteora-damm-v2-decoder decodes the instructions, accounts and events of the Meteora DAMM v2 program (cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG): 38 instructions, 9 account types, 23 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.

Cratecarbon-meteora-damm-v2-decoder 2.0.0
Installcargo add carbon-meteora-damm-v2-decoder@2.0.0
Program IDcpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG (carbon_meteora_damm_v2_decoder::PROGRAM_ID)
CategoryDEX & AMM
Decodercarbon_meteora_damm_v2_decoder::MeteoraDammV2Decoder
Instruction enuminstructions::MeteoraDammV2Instruction
Account enumaccounts::MeteoraDammV2Account
Event enuminstructions::CpiEvent
Featuresserde, postgres, graphql (none enabled by default)
API docsdocs.rs/carbon-meteora-damm-v2-decoder/2.0.0
Sourcedecoders/meteora-damm-v2-decoder

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

Terminal
cargo add carbon-core@2.0.0 carbon-meteora-damm-v2-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_meteora_damm_v2_decoder::{
        instructions::MeteoraDammV2Instruction, MeteoraDammV2Decoder, 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(MeteoraDammV2Decoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, MeteoraDammV2Instruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, MeteoraDammV2Instruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let MeteoraDammV2Instruction::Swap { data, accounts, .. } = input.decoded_instruction {
            println!("swap {signature}: {data:?} pool_authority={}", accounts.pool_authority);
        }
        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 MeteoraDammV2Instruction::CpiEvent { data: CpiEvent::EvtClaimPositionFee(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 Pool 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_meteora_damm_v2_decoder::{
        accounts::MeteoraDammV2Account, MeteoraDammV2Decoder, 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(MeteoraDammV2Decoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

impl Processor<AccountProcessorInputType<'_, MeteoraDammV2Account>> for AccountLogger {
    async fn process(
        &mut self,
        input: &AccountProcessorInputType<'_, MeteoraDammV2Account>,
    ) -> CarbonResult<()> {
        if let MeteoraDammV2Account::Pool(pool) = &input.decoded_account.data {
            println!("pool {}: {pool:?}", input.metadata.pubkey);
        }
        Ok(())
    }
}
Terminal
RUST_LOG=info cargo run

Each update to a Pool 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 MeteoraDammV2Instruction. Each is MeteoraDammV2Instruction::<Variant> { program_id, data, accounts }, where data and accounts are the types listed under the variant, exported from carbon_meteora_damm_v2_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 cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG.
  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.

AddLiquidity#

Discriminator b59d59438fb63448 · data AddLiquidity · accounts AddLiquidityInstructionAccounts.

FieldType
paramsAddLiquidityParameters

Required accounts: 14; extras go to remaining.

Fields of AddLiquidityInstructionAccounts, in account order:

#FieldType
0poolPubkey
1positionPubkey
2token_a_accountPubkey
3token_b_accountPubkey
4token_a_vaultPubkey
5token_b_vaultPubkey
6token_a_mintPubkey
7token_b_mintPubkey
8position_nft_accountPubkey
9ownerPubkey
10token_a_programPubkey
11token_b_programPubkey
12event_authorityPubkey
13programPubkey
14…remainingVec<AccountMeta>

ClaimPositionFee#

Discriminator b4269a118521a2d3 · data ClaimPositionFee · accounts ClaimPositionFeeInstructionAccounts.

No data fields.

Required accounts: 15; extras go to remaining.

Fields of ClaimPositionFeeInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2positionPubkey
3token_a_accountPubkey
4token_b_accountPubkey
5token_a_vaultPubkey
6token_b_vaultPubkey
7token_a_mintPubkey
8token_b_mintPubkey
9position_nft_accountPubkey
10ownerPubkey
11token_a_programPubkey
12token_b_programPubkey
13event_authorityPubkey
14programPubkey
15…remainingVec<AccountMeta>

ClaimProtocolFee#

Discriminator a5e4853063f9ff21 · data ClaimProtocolFee · accounts ClaimProtocolFeeInstructionAccounts.

FieldType
max_amount_au64
max_amount_bu64

Required accounts: 14; extras go to remaining.

Fields of ClaimProtocolFeeInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2token_a_vaultPubkey
3token_b_vaultPubkey
4token_a_mintPubkey
5token_b_mintPubkey
6token_a_accountPubkey
7token_b_accountPubkey
8operatorPubkey
9signerPubkey
10token_a_programPubkey
11token_b_programPubkey
12event_authorityPubkey
13programPubkey
14…remainingVec<AccountMeta>

ClaimReward#

Discriminator 955fb5f25e5a9ea2 · data ClaimReward · accounts ClaimRewardInstructionAccounts.

FieldType
reward_indexu8
skip_rewardu8

Required accounts: 11; extras go to remaining.

Fields of ClaimRewardInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2positionPubkey
3reward_vaultPubkey
4reward_mintPubkey
5user_token_accountPubkey
6position_nft_accountPubkey
7ownerPubkey
8token_programPubkey
9event_authorityPubkey
10programPubkey
11…remainingVec<AccountMeta>

CloseConfig#

Discriminator 9109489d5f7d3d55 · data CloseConfig · accounts CloseConfigInstructionAccounts.

No data fields.

Required accounts: 6; extras go to remaining.

Fields of CloseConfigInstructionAccounts, in account order:

#FieldType
0configPubkey
1operatorPubkey
2signerPubkey
3rent_receiverPubkey
4event_authorityPubkey
5programPubkey
6…remainingVec<AccountMeta>

CloseOperatorAccount#

Discriminator ab09d54a7817031d · data CloseOperatorAccount · accounts CloseOperatorAccountInstructionAccounts.

No data fields.

Required accounts: 5; extras go to remaining.

Fields of CloseOperatorAccountInstructionAccounts, in account order:

#FieldType
0operatorPubkey
1signerPubkey
2rent_receiverPubkey
3event_authorityPubkey
4programPubkey
5…remainingVec<AccountMeta>

ClosePosition#

Discriminator 7b86510031446262 · data ClosePosition · accounts ClosePositionInstructionAccounts.

No data fields.

Required accounts: 10; extras go to remaining.

Fields of ClosePositionInstructionAccounts, in account order:

#FieldType
0position_nft_mintPubkey
1position_nft_accountPubkey
2poolPubkey
3positionPubkey
4pool_authorityPubkey
5rent_receiverPubkey
6ownerPubkey
7token_programPubkey
8event_authorityPubkey
9programPubkey
10…remainingVec<AccountMeta>

CloseTokenBadge#

Discriminator 6c92566eb3fe0a68 · data CloseTokenBadge · accounts CloseTokenBadgeInstructionAccounts.

No data fields.

Required accounts: 6; extras go to remaining.

Fields of CloseTokenBadgeInstructionAccounts, in account order:

#FieldType
0token_badgePubkey
1operatorPubkey
2signerPubkey
3rent_receiverPubkey
4event_authorityPubkey
5programPubkey
6…remainingVec<AccountMeta>

CreateConfig#

From the program's IDL:

OPERATOR FUNCTIONS /////

Discriminator c9cff3724b6f2fbd · data CreateConfig · accounts CreateConfigInstructionAccounts.

FieldType
indexu64
config_parametersStaticConfigParameters

Required accounts: 7; extras go to remaining.

Fields of CreateConfigInstructionAccounts, in account order:

#FieldType
0configPubkey
1operatorPubkey
2signerPubkey
3payerPubkey
4system_programPubkey
5event_authorityPubkey
6programPubkey
7…remainingVec<AccountMeta>

CreateDynamicConfig#

Discriminator 51fb7a4e4239d052 · data CreateDynamicConfig · accounts CreateDynamicConfigInstructionAccounts.

FieldType
indexu64
config_parametersDynamicConfigParameters

Required accounts: 7; extras go to remaining.

Fields of CreateDynamicConfigInstructionAccounts, in account order:

#FieldType
0configPubkey
1operatorPubkey
2signerPubkey
3payerPubkey
4system_programPubkey
5event_authorityPubkey
6programPubkey
7…remainingVec<AccountMeta>

CreateOperatorAccount#

From the program's IDL:

ADMIN FUNCTIONS /////

Discriminator dd40f695f099e5a3 · data CreateOperatorAccount · accounts CreateOperatorAccountInstructionAccounts.

FieldType
permissionu128

Required accounts: 7; extras go to remaining.

Fields of CreateOperatorAccountInstructionAccounts, in account order:

#FieldType
0operatorPubkey
1whitelisted_addressPubkey
2signerPubkey
3payerPubkey
4system_programPubkey
5event_authorityPubkey
6programPubkey
7…remainingVec<AccountMeta>

CreatePosition#

Discriminator 30d7c59960cbb485 · data CreatePosition · accounts CreatePositionInstructionAccounts.

No data fields.

Required accounts: 11; extras go to remaining.

Fields of CreatePositionInstructionAccounts, in account order:

#FieldType
0ownerPubkey
1position_nft_mintPubkey
2position_nft_accountPubkey
3poolPubkey
4positionPubkey
5pool_authorityPubkey
6payerPubkey
7token_programPubkey
8system_programPubkey
9event_authorityPubkey
10programPubkey
11…remainingVec<AccountMeta>

CreateTokenBadge#

Discriminator 58ce005b3caf9776 · data CreateTokenBadge · accounts CreateTokenBadgeInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of CreateTokenBadgeInstructionAccounts, in account order:

#FieldType
0token_badgePubkey
1token_mintPubkey
2operatorPubkey
3signerPubkey
4payerPubkey
5system_programPubkey
6event_authorityPubkey
7programPubkey
8…remainingVec<AccountMeta>

DummyIx#

Discriminator ea5fb0b9072a239f · data DummyIx · accounts DummyIxInstructionAccounts.

FieldType
ixsDummyParams

Required accounts: 3; extras go to remaining.

Fields of DummyIxInstructionAccounts, in account order:

#FieldType
0pod_aligned_fee_time_schedulerPubkey
1pod_aligned_fee_rate_limiterPubkey
2pod_aligned_fee_market_cap_schedulerPubkey
3…remainingVec<AccountMeta>

FixConfigFeeParams#

Discriminator 261ed851fab1f3fe · data FixConfigFeeParams · accounts FixConfigFeeParamsInstructionAccounts.

FieldType
paramsBaseFeeParameters

Required accounts: 3; extras go to remaining.

Fields of FixConfigFeeParamsInstructionAccounts, in account order:

#FieldType
0configPubkey
1operatorPubkey
2signerPubkey
3…remainingVec<AccountMeta>

FixPoolFeeParams#

Discriminator 846251c42c3a78c1 · data FixPoolFeeParams · accounts FixPoolFeeParamsInstructionAccounts.

FieldType
paramsBaseFeeParameters

Required accounts: 3; extras go to remaining.

Fields of FixPoolFeeParamsInstructionAccounts, in account order:

#FieldType
0poolPubkey
1operatorPubkey
2signerPubkey
3…remainingVec<AccountMeta>

FixPoolLayoutVersion#

Discriminator a69e452351a7c8d7 · data FixPoolLayoutVersion · accounts FixPoolLayoutVersionInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of FixPoolLayoutVersionInstructionAccounts, in account order:

#FieldType
0poolPubkey
1operatorPubkey
2signerPubkey
3…remainingVec<AccountMeta>

FundReward#

Discriminator bc32f9a55d97263f · data FundReward · accounts FundRewardInstructionAccounts.

FieldType
reward_indexu8
amountu64
carry_forwardbool

Required accounts: 8; extras go to remaining.

Fields of FundRewardInstructionAccounts, in account order:

#FieldType
0poolPubkey
1reward_vaultPubkey
2reward_mintPubkey
3funder_token_accountPubkey
4funderPubkey
5token_programPubkey
6event_authorityPubkey
7programPubkey
8…remainingVec<AccountMeta>

InitializeCustomizablePool#

Discriminator 14a1f118bdddb402 · data InitializeCustomizablePool · accounts InitializeCustomizablePoolInstructionAccounts.

Required accounts: 19; extras go to remaining.

Fields of InitializeCustomizablePoolInstructionAccounts, in account order:

#FieldType
0creatorPubkey
1position_nft_mintPubkey
2position_nft_accountPubkey
3payerPubkey
4pool_authorityPubkey
5poolPubkey
6positionPubkey
7token_a_mintPubkey
8token_b_mintPubkey
9token_a_vaultPubkey
10token_b_vaultPubkey
11payer_token_aPubkey
12payer_token_bPubkey
13token_a_programPubkey
14token_b_programPubkey
15token2022_programPubkey
16system_programPubkey
17event_authorityPubkey
18programPubkey
19…remainingVec<AccountMeta>

InitializePool#

From the program's IDL:

USER FUNCTIONS ////

Discriminator 5fb40aac54aee828 · data InitializePool · accounts InitializePoolInstructionAccounts.

Required accounts: 20; extras go to remaining.

Fields of InitializePoolInstructionAccounts, in account order:

#FieldType
0creatorPubkey
1position_nft_mintPubkey
2position_nft_accountPubkey
3payerPubkey
4configPubkey
5pool_authorityPubkey
6poolPubkey
7positionPubkey
8token_a_mintPubkey
9token_b_mintPubkey
10token_a_vaultPubkey
11token_b_vaultPubkey
12payer_token_aPubkey
13payer_token_bPubkey
14token_a_programPubkey
15token_b_programPubkey
16token2022_programPubkey
17system_programPubkey
18event_authorityPubkey
19programPubkey
20…remainingVec<AccountMeta>

InitializePoolWithDynamicConfig#

Discriminator 955248c5fdfc440f · data InitializePoolWithDynamicConfig · accounts InitializePoolWithDynamicConfigInstructionAccounts.

Required accounts: 21; extras go to remaining.

Fields of InitializePoolWithDynamicConfigInstructionAccounts, in account order:

#FieldType
0creatorPubkey
1position_nft_mintPubkey
2position_nft_accountPubkey
3payerPubkey
4pool_creator_authorityPubkey
5configPubkey
6pool_authorityPubkey
7poolPubkey
8positionPubkey
9token_a_mintPubkey
10token_b_mintPubkey
11token_a_vaultPubkey
12token_b_vaultPubkey
13payer_token_aPubkey
14payer_token_bPubkey
15token_a_programPubkey
16token_b_programPubkey
17token2022_programPubkey
18system_programPubkey
19event_authorityPubkey
20programPubkey
21…remainingVec<AccountMeta>

InitializeReward#

Discriminator 5f87c0c4f281e644 · data InitializeReward · accounts InitializeRewardInstructionAccounts.

FieldType
reward_indexu8
reward_durationu64
funderPubkey

Required accounts: 10; extras go to remaining.

Fields of InitializeRewardInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2reward_vaultPubkey
3reward_mintPubkey
4signerPubkey
5payerPubkey
6token_programPubkey
7system_programPubkey
8event_authorityPubkey
9programPubkey
10…remainingVec<AccountMeta>

LockInnerPosition#

Discriminator 481331cc127a175a · data LockInnerPosition · accounts LockInnerPositionInstructionAccounts.

FieldType
paramsVestingParameters

Required accounts: 6; extras go to remaining.

Fields of LockInnerPositionInstructionAccounts, in account order:

#FieldType
0poolPubkey
1positionPubkey
2position_nft_accountPubkey
3ownerPubkey
4event_authorityPubkey
5programPubkey
6…remainingVec<AccountMeta>

LockPosition#

Discriminator e33e02fcf70aabb9 · data LockPosition · accounts LockPositionInstructionAccounts.

FieldType
paramsVestingParameters

Required accounts: 9; extras go to remaining.

Fields of LockPositionInstructionAccounts, in account order:

#FieldType
0poolPubkey
1positionPubkey
2vestingPubkey
3position_nft_accountPubkey
4ownerPubkey
5payerPubkey
6system_programPubkey
7event_authorityPubkey
8programPubkey
9…remainingVec<AccountMeta>

PermanentLockPosition#

Discriminator a5b07d06e7abbad5 · data PermanentLockPosition · accounts PermanentLockPositionInstructionAccounts.

FieldType
permanent_lock_liquidityu128

Required accounts: 6; extras go to remaining.

Fields of PermanentLockPositionInstructionAccounts, in account order:

#FieldType
0poolPubkey
1positionPubkey
2position_nft_accountPubkey
3ownerPubkey
4event_authorityPubkey
5programPubkey
6…remainingVec<AccountMeta>

RefreshVesting#

Discriminator 095ed80e74ccf700 · data RefreshVesting · accounts RefreshVestingInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of RefreshVestingInstructionAccounts, in account order:

#FieldType
0poolPubkey
1positionPubkey
2position_nft_accountPubkey
3ownerPubkey
4…remainingVec<AccountMeta>

RemoveAllLiquidity#

Discriminator 0a333d2370691855 · data RemoveAllLiquidity · accounts RemoveAllLiquidityInstructionAccounts.

FieldType
token_a_amount_thresholdu64
token_b_amount_thresholdu64

Required accounts: 15; extras go to remaining.

Fields of RemoveAllLiquidityInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2positionPubkey
3token_a_accountPubkey
4token_b_accountPubkey
5token_a_vaultPubkey
6token_b_vaultPubkey
7token_a_mintPubkey
8token_b_mintPubkey
9position_nft_accountPubkey
10ownerPubkey
11token_a_programPubkey
12token_b_programPubkey
13event_authorityPubkey
14programPubkey
15…remainingVec<AccountMeta>

RemoveLiquidity#

Discriminator 5055d14818ceb16c · data RemoveLiquidity · accounts RemoveLiquidityInstructionAccounts.

Required accounts: 15; extras go to remaining.

Fields of RemoveLiquidityInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2positionPubkey
3token_a_accountPubkey
4token_b_accountPubkey
5token_a_vaultPubkey
6token_b_vaultPubkey
7token_a_mintPubkey
8token_b_mintPubkey
9position_nft_accountPubkey
10ownerPubkey
11token_a_programPubkey
12token_b_programPubkey
13event_authorityPubkey
14programPubkey
15…remainingVec<AccountMeta>

SetPoolStatus#

Discriminator 705787df53cc8435 · data SetPoolStatus · accounts SetPoolStatusInstructionAccounts.

FieldType
statusu8

Required accounts: 5; extras go to remaining.

Fields of SetPoolStatusInstructionAccounts, in account order:

#FieldType
0poolPubkey
1operatorPubkey
2signerPubkey
3event_authorityPubkey
4programPubkey
5…remainingVec<AccountMeta>

SplitPosition#

Discriminator acf1dd8aa11dfd2a · data SplitPosition · accounts SplitPositionInstructionAccounts.

Required accounts: 9; extras go to remaining.

Fields of SplitPositionInstructionAccounts, in account order:

#FieldType
0poolPubkey
1first_positionPubkey
2first_position_nft_accountPubkey
3second_positionPubkey
4second_position_nft_accountPubkey
5first_ownerPubkey
6second_ownerPubkey
7event_authorityPubkey
8programPubkey
9…remainingVec<AccountMeta>

SplitPosition2#

Discriminator dd93e4cf8cd41177 · data SplitPosition2 · accounts SplitPosition2InstructionAccounts.

FieldType
numeratoru32

Required accounts: 9; extras go to remaining.

Fields of SplitPosition2InstructionAccounts, in account order:

#FieldType
0poolPubkey
1first_positionPubkey
2first_position_nft_accountPubkey
3second_positionPubkey
4second_position_nft_accountPubkey
5first_ownerPubkey
6second_ownerPubkey
7event_authorityPubkey
8programPubkey
9…remainingVec<AccountMeta>

Swap#

Discriminator f8c69e91e17587c8 · data Swap · accounts SwapInstructionAccounts.

FieldType
paramsSwapParameters

Required accounts: 14; extras go to remaining.

Fields of SwapInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2input_token_accountPubkey
3output_token_accountPubkey
4token_a_vaultPubkey
5token_b_vaultPubkey
6token_a_mintPubkey
7token_b_mintPubkey
8payerPubkey
9token_a_programPubkey
10token_b_programPubkey
11referral_token_accountOption<Pubkey>
12event_authorityPubkey
13programPubkey
14…remainingVec<AccountMeta>

Swap2#

Discriminator 414b3f4ceb5b5b88 · data Swap2 · accounts Swap2InstructionAccounts.

FieldType
paramsSwapParameters2

Required accounts: 14; extras go to remaining.

Fields of Swap2InstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2input_token_accountPubkey
3output_token_accountPubkey
4token_a_vaultPubkey
5token_b_vaultPubkey
6token_a_mintPubkey
7token_b_mintPubkey
8payerPubkey
9token_a_programPubkey
10token_b_programPubkey
11referral_token_accountOption<Pubkey>
12event_authorityPubkey
13programPubkey
14…remainingVec<AccountMeta>

UpdatePoolFees#

Discriminator 76d9cbb33c084659 · data UpdatePoolFees · accounts UpdatePoolFeesInstructionAccounts.

Required accounts: 5; extras go to remaining.

Fields of UpdatePoolFeesInstructionAccounts, in account order:

#FieldType
0poolPubkey
1operatorPubkey
2signerPubkey
3event_authorityPubkey
4programPubkey
5…remainingVec<AccountMeta>

UpdateRewardDuration#

Discriminator 8aaec4a9d5ebfe6b · data UpdateRewardDuration · accounts UpdateRewardDurationInstructionAccounts.

FieldType
reward_indexu8
new_durationu64

Required accounts: 4; extras go to remaining.

Fields of UpdateRewardDurationInstructionAccounts, in account order:

#FieldType
0poolPubkey
1signerPubkey
2event_authorityPubkey
3programPubkey
4…remainingVec<AccountMeta>

UpdateRewardFunder#

Discriminator d31c3020d7a02317 · data UpdateRewardFunder · accounts UpdateRewardFunderInstructionAccounts.

FieldType
reward_indexu8
new_funderPubkey

Required accounts: 4; extras go to remaining.

Fields of UpdateRewardFunderInstructionAccounts, in account order:

#FieldType
0poolPubkey
1signerPubkey
2event_authorityPubkey
3programPubkey
4…remainingVec<AccountMeta>

WithdrawIneligibleReward#

Discriminator 94ce2ac3f7316708 · data WithdrawIneligibleReward · accounts WithdrawIneligibleRewardInstructionAccounts.

FieldType
reward_indexu8

Required accounts: 9; extras go to remaining.

Fields of WithdrawIneligibleRewardInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2reward_vaultPubkey
3reward_mintPubkey
4funder_token_accountPubkey
5funderPubkey
6token_programPubkey
7event_authorityPubkey
8programPubkey
9…remainingVec<AccountMeta>

ZapProtocolFee#

Discriminator d59bbb2238b65bf0 · data ZapProtocolFee · accounts ZapProtocolFeeInstructionAccounts.

FieldType
max_amountu64

Required accounts: 9; extras go to remaining.

Fields of ZapProtocolFeeInstructionAccounts, in account order:

#FieldType
0pool_authorityPubkey
1poolPubkey
2token_vaultPubkey
3token_mintPubkey
4receiver_tokenPubkey
5operatorPubkey
6signerPubkey
7token_programPubkey
8sysvar_instructionsPubkey
9…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 MeteoraDammV2Account. Each wraps a boxed struct from carbon_meteora_damm_v2_decoder::accounts::<module>. decode_account only considers accounts owned by PROGRAM_ID and returns the first variant that matches.

Config#

Discriminator 9b0caae01efacc82 · accounts::config::Config.

FieldTypeDescription
vault_config_keyPubkeyVault config key
pool_creator_authorityPubkeyOnly pool_creator_authority can use the current config to initialize new pool. When it's Pubkey::default, it's a public config.
pool_feesPoolFeesConfigPool fee
activation_typeu8Activation type
collect_fee_modeu8Collect fee mode
config_typeu8Config type mode, 0 for static, 1 for dynamic
padding0[u8; 5]padding 0
indexu64config index
sqrt_min_priceu128sqrt min price
sqrt_max_priceu128sqrt max price
padding1[u64; 10]Fee curve point Padding for further use

Operator#

Discriminator db1fbc91458bcc75 · accounts::operator::Operator.

FieldType
whitelisted_addressPubkey
permissionu128
padding[u64; 2]

PodAlignedFeeMarketCapScheduler#

Discriminator fb82d0fdf51b91cb · accounts::pod_aligned_fee_market_cap_scheduler::PodAlignedFeeMarketCapScheduler.

FieldType
cliff_fee_numeratoru64
base_fee_modeu8
padding[u8; 5]
number_of_periodu16
sqrt_price_step_bpsu32
scheduler_expiration_durationu32
reduction_factoru64

PodAlignedFeeRateLimiter#

Discriminator a0db08fbb3071075 · accounts::pod_aligned_fee_rate_limiter::PodAlignedFeeRateLimiter.

FieldType
cliff_fee_numeratoru64
base_fee_modeu8
padding[u8; 5]
fee_increment_bpsu16
max_limiter_durationu32
max_fee_bpsu32
reference_amountu64

PodAlignedFeeTimeScheduler#

Discriminator ef848ad5439a8246 · accounts::pod_aligned_fee_time_scheduler::PodAlignedFeeTimeScheduler.

FieldType
cliff_fee_numeratoru64
base_fee_modeu8
padding[u8; 5]
number_of_periodu16
period_frequencyu64
reduction_factoru64

Pool#

Discriminator f19a6d0411b16dbc · accounts::pool::Pool.

FieldTypeDescription
pool_feesPoolFeesStructPool fee
token_a_mintPubkeytoken a mint
token_b_mintPubkeytoken b mint
token_a_vaultPubkeytoken a vault
token_b_vaultPubkeytoken b vault
whitelisted_vaultPubkeyWhitelisted vault to be able to buy pool before activation_point
padding0[u8; 32]padding, previously partner pubkey, be careful when using this field
liquidityu128liquidity share
padding1u128padding, previous reserve amount, be careful to use that field
protocol_a_feeu64protocol a fee
protocol_b_feeu64protocol b fee
padding2u128
sqrt_min_priceu128min price
sqrt_max_priceu128max price
sqrt_priceu128current price
activation_pointu64Activation point, can be slot or timestamp
activation_typeu8Activation type, 0 means by slot, 1 means by timestamp
pool_statusu8pool status, 0: enable, 1 disable
token_a_flagu8token a flag
token_b_flagu8token b flag
collect_fee_modeu80 is collect fee in both token, 1 only collect fee only in token b
pool_typeu8pool type
fee_versionu8pool fee version, 0: max_fee is still capped at 50%, 1: max_fee is capped at 99%
padding3u8padding
fee_a_per_liquidity[u8; 32]cumulative
fee_b_per_liquidity[u8; 32]cumulative
permanent_lock_liquidityu128
metricsPoolMetricsmetrics
creatorPubkeypool creator
token_a_amountu64token a amount
token_b_amountu64token b amount
layout_versionu8layout version: version 0: haven't track token_a_amount and token_b_amount, version 1: track token_a_amount and token_b_amount
padding4[u8; 7]Padding for further use
padding5[u64; 3]Padding for further use
reward_infos[RewardInfo; 2]Farming reward information

Position#

Discriminator aabc8fe47a40f7d0 · accounts::position::Position.

FieldTypeDescription
poolPubkey
nft_mintPubkeynft mint
fee_a_per_token_checkpoint[u8; 32]fee a checkpoint
fee_b_per_token_checkpoint[u8; 32]fee b checkpoint
fee_a_pendingu64fee a pending
fee_b_pendingu64fee b pending
unlocked_liquidityu128unlock liquidity
vested_liquidityu128vesting liquidity
permanent_locked_liquidityu128permanent locked liquidity
metricsPositionMetricsmetrics
reward_infos[UserRewardInfo; 2]Farming reward information
inner_vestingInnerVestinginner vesting info
paddingu128padding for future usage

TokenBadge#

Discriminator 74dbcce5f974ff96 · accounts::token_badge::TokenBadge.

FieldTypeDescription
token_mintPubkeytoken mint
padding[u8; 128]Reserve

Vesting#

Discriminator 6495428a5fc880f1 · accounts::vesting::Vesting.

FieldType
positionPubkey
inner_vestingInnerVesting
padding2[u128; 4]

Events#

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

EvtClaimPositionFee#

Discriminator c6b6b734610c3138 · events::evt_claim_position_fee::EvtClaimPositionFeeEvent.

FieldType
poolPubkey
positionPubkey
ownerPubkey
fee_a_claimedu64
fee_b_claimedu64

EvtClaimProtocolFee#

Discriminator baf44bfbbc0d1921 · events::evt_claim_protocol_fee::EvtClaimProtocolFeeEvent.

FieldType
poolPubkey
token_a_amountu64
token_b_amountu64

EvtClaimReward#

Discriminator da5693c8ebbcd7e7 · events::evt_claim_reward::EvtClaimRewardEvent.

FieldType
poolPubkey
positionPubkey
ownerPubkey
mint_rewardPubkey
reward_indexu8
total_rewardu64

EvtCloseConfig#

Discriminator 241eef2d3a840e05 · events::evt_close_config::EvtCloseConfigEvent.

FieldTypeDescription
configPubkeyConfig pubkey
adminPubkeyadmin pk

EvtClosePosition#

Discriminator 149190448f8ed6b2 · events::evt_close_position::EvtClosePositionEvent.

FieldType
poolPubkey
ownerPubkey
positionPubkey
position_nft_mintPubkey

EvtCreateConfig#

Discriminator 83cfb4aeb449a536 · events::evt_create_config::EvtCreateConfigEvent.

FieldType
pool_feesPoolFeeParameters
vault_config_keyPubkey
pool_creator_authorityPubkey
activation_typeu8
sqrt_min_priceu128
sqrt_max_priceu128
collect_fee_modeu8
indexu64
configPubkey

EvtCreateDynamicConfig#

Discriminator e7c50da4f8d58598 · events::evt_create_dynamic_config::EvtCreateDynamicConfigEvent.

FieldType
configPubkey
pool_creator_authorityPubkey
indexu64

EvtCreatePosition#

Discriminator 9c0f77c61db5dd37 · events::evt_create_position::EvtCreatePositionEvent.

FieldType
poolPubkey
ownerPubkey
positionPubkey
position_nft_mintPubkey

EvtCreateTokenBadge#

Discriminator 8d788674221c72a0 · events::evt_create_token_badge::EvtCreateTokenBadgeEvent.

FieldType
token_mintPubkey

EvtFundReward#

Discriminator 68e9ed7ac7bf7955 · events::evt_fund_reward::EvtFundRewardEvent.

FieldType
poolPubkey
funderPubkey
mint_rewardPubkey
reward_indexu8
amountu64
transfer_fee_excluded_amount_inu64
reward_duration_endu64
pre_reward_rateu128
post_reward_rateu128

EvtInitializePool#

Discriminator e432f655cb428625 · events::evt_initialize_pool::EvtInitializePoolEvent.

FieldType
poolPubkey
token_a_mintPubkey
token_b_mintPubkey
creatorPubkey
payerPubkey
alpha_vaultPubkey
pool_feesPoolFeeParameters
sqrt_min_priceu128
sqrt_max_priceu128
activation_typeu8
collect_fee_modeu8
liquidityu128
sqrt_priceu128
activation_pointu64
token_a_flagu8
token_b_flagu8
token_a_amountu64
token_b_amountu64
total_amount_au64
total_amount_bu64
pool_typeu8

EvtInitializeReward#

Discriminator 815bbc03f634b9f9 · events::evt_initialize_reward::EvtInitializeRewardEvent.

FieldType
poolPubkey
reward_mintPubkey
funderPubkey
creatorPubkey
reward_indexu8
reward_durationu64

EvtLiquidityChange#

Discriminator c5ab4e7fe0d3570d · events::evt_liquidity_change::EvtLiquidityChangeEvent.

FieldType
poolPubkey
positionPubkey
ownerPubkey
token_a_amountu64
token_b_amountu64
transfer_fee_included_token_a_amountu64
transfer_fee_included_token_b_amountu64
reserve_a_amountu64
reserve_b_amountu64
liquidity_deltau128
token_a_amount_thresholdu64
token_b_amount_thresholdu64
change_typeu8

EvtLockPosition#

Discriminator a83f6c53db5202c8 · events::evt_lock_position::EvtLockPositionEvent.

FieldType
poolPubkey
positionPubkey
ownerPubkey
vestingPubkey
cliff_pointu64
period_frequencyu64
cliff_unlock_liquidityu128
liquidity_per_periodu128
number_of_periodu16

EvtPermanentLockPosition#

Discriminator 918fa2dada50430b · events::evt_permanent_lock_position::EvtPermanentLockPositionEvent.

FieldType
poolPubkey
positionPubkey
lock_liquidity_amountu128
total_permanent_locked_liquidityu128

EvtSetPoolStatus#

Discriminator 64d54a035f5be492 · events::evt_set_pool_status::EvtSetPoolStatusEvent.

FieldType
poolPubkey
statusu8

EvtSplitPosition2#

Discriminator a520cbae4864e967 · events::evt_split_position2::EvtSplitPosition2Event.

FieldType
poolPubkey
first_ownerPubkey
second_ownerPubkey
first_positionPubkey
second_positionPubkey
current_sqrt_priceu128
amount_splitsSplitAmountInfo
first_position_infoSplitPositionInfo
second_position_infoSplitPositionInfo
split_position_parametersSplitPositionParameters2

EvtSplitPosition3#

Discriminator e875beda55a2cf4e · events::evt_split_position3::EvtSplitPosition3Event.

FieldType
poolPubkey
first_ownerPubkey
second_ownerPubkey
first_positionPubkey
second_positionPubkey
current_sqrt_priceu128
amount_splitsSplitAmountInfo2
first_position_infoSplitPositionInfo2
second_position_infoSplitPositionInfo2
split_position_parametersSplitPositionParameters3

EvtSwap2#

Discriminator bd4233a826507599 · events::evt_swap2::EvtSwap2Event.

FieldType
poolPubkey
trade_directionu8
collect_fee_modeu8
has_referralbool
paramsSwapParameters2
swap_resultSwapResult2
included_transfer_fee_amount_inu64
included_transfer_fee_amount_outu64
excluded_transfer_fee_amount_outu64
current_timestampu64
reserve_a_amountu64
reserve_b_amountu64

EvtUpdatePoolFees#

Discriminator 4ca5f66666d99c2c · events::evt_update_pool_fees::EvtUpdatePoolFeesEvent.

FieldType
poolPubkey
operatorPubkey
paramsUpdatePoolFeesParameters

EvtUpdateRewardDuration#

Discriminator 958741e781994139 · events::evt_update_reward_duration::EvtUpdateRewardDurationEvent.

FieldType
poolPubkey
reward_indexu8
old_reward_durationu64
new_reward_durationu64

EvtUpdateRewardFunder#

Discriminator 4c9ad00d2873f692 · events::evt_update_reward_funder::EvtUpdateRewardFunderEvent.

FieldType
poolPubkey
reward_indexu8
old_funderPubkey
new_funderPubkey

EvtWithdrawIneligibleReward#

Discriminator f8d7b84e1fb4b3a8 · events::evt_withdraw_ineligible_reward::EvtWithdrawIneligibleRewardEvent.

FieldType
poolPubkey
reward_mintPubkey
amountu64

Types#

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

AddLiquidityParameters#

Struct types::AddLiquidityParameters.

FieldTypeDescription
liquidity_deltau128delta liquidity
token_a_amount_thresholdu64maximum token a amount
token_b_amount_thresholdu64maximum token b amount

BaseFeeInfo#

Struct types::BaseFeeInfo.

FieldType
data[u8; 32]

BaseFeeParameters#

Struct types::BaseFeeParameters.

FieldType
data[u8; 27]

BaseFeeStruct#

Struct types::BaseFeeStruct.

FieldType
base_fee_infoBaseFeeInfo
padding1u64

BorshFeeMarketCapScheduler#

Struct types::BorshFeeMarketCapScheduler.

FieldType
cliff_fee_numeratoru64
number_of_periodu16
sqrt_price_step_bpsu32
scheduler_expiration_durationu32
reduction_factoru64
base_fee_modeu8

BorshFeeRateLimiter#

From the program's IDL:

we denote reference_amount = x0, cliff_fee_numerator = c, fee_increment = i if input_amount <= x0, then fee = input_amount * c if input_amount > x0, then input_amount = x0 + (a * x0 + b) if a < max_index then fee = x0 * c + x0 * (c + i) + .... + x0 * (c + ia) + b * (c + i * (a+1)) then fee = x0 * (c + ca + ia(a+1)/2) + b * (c + i * (a+1)) if a >= max_index if a = max_index + d, input_amount = x0 + max_index * x0 + (d * x0 + b) then fee = x0 * (c + cmax_index + imax_index*(max_index+1)/2) + (d * x0 + b) * MAX_FEE

Struct types::BorshFeeRateLimiter.

FieldType
cliff_fee_numeratoru64
fee_increment_bpsu16
max_limiter_durationu32
max_fee_bpsu32
reference_amountu64
base_fee_modeu8

BorshFeeTimeScheduler#

Struct types::BorshFeeTimeScheduler.

FieldType
cliff_fee_numeratoru64
number_of_periodu16
period_frequencyu64
reduction_factoru64
base_fee_modeu8

DummyParams#

Struct types::DummyParams.

FieldType
borsh_fee_time_scheduler_paramsBorshFeeTimeScheduler
borsh_fee_rate_limiter_paramsBorshFeeRateLimiter
borsh_fee_market_cap_scheduler_paramsBorshFeeMarketCapScheduler

DynamicConfigParameters#

Struct types::DynamicConfigParameters.

FieldType
pool_creator_authorityPubkey

DynamicFeeConfig#

Struct types::DynamicFeeConfig.

FieldType
initializedu8
padding[u8; 7]
max_volatility_accumulatoru32
variable_fee_controlu32
bin_stepu16
filter_periodu16
decay_periodu16
reduction_factoru16
padding1[u8; 8]
bin_step_u128u128

DynamicFeeParameters#

Struct types::DynamicFeeParameters.

FieldType
bin_stepu16
bin_step_u128u128
filter_periodu16
decay_periodu16
reduction_factoru16
max_volatility_accumulatoru32
variable_fee_controlu32

DynamicFeeStruct#

Struct types::DynamicFeeStruct.

FieldType
initializedu8
padding[u8; 7]
max_volatility_accumulatoru32
variable_fee_controlu32
bin_stepu16
filter_periodu16
decay_periodu16
reduction_factoru16
last_update_timestampu64
bin_step_u128u128
sqrt_price_referenceu128
volatility_accumulatoru128
volatility_referenceu128

EvtClaimPositionFee#

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

EvtClaimProtocolFee#

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

EvtClaimReward#

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

EvtCloseConfig#

From the program's IDL:

Close config

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

EvtClosePosition#

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

EvtCreateConfig#

From the program's IDL:

Create static config

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

EvtCreateDynamicConfig#

From the program's IDL:

Create dynamic config

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

EvtCreatePosition#

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

EvtCreateTokenBadge#

From the program's IDL:

Create token badge

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

EvtFundReward#

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

EvtInitializePool#

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

EvtInitializeReward#

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

EvtLiquidityChange#

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

EvtLockPosition#

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

EvtPermanentLockPosition#

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

EvtSetPoolStatus#

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

EvtSplitPosition2#

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

EvtSplitPosition3#

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

EvtSwap2#

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

EvtUpdatePoolFees#

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

EvtUpdateRewardDuration#

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

EvtUpdateRewardFunder#

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

EvtWithdrawIneligibleReward#

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

InitializeCustomizablePoolParameters#

Struct types::InitializeCustomizablePoolParameters.

FieldTypeDescription
pool_feesPoolFeeParameterspool fees
sqrt_min_priceu128sqrt min price
sqrt_max_priceu128sqrt max price
has_alpha_vaultboolhas alpha vault
liquidityu128initialize liquidity
sqrt_priceu128The init price of the pool as a sqrt(token_b/token_a) Q64.64 value. Market cap fee scheduler minimum price will be derived from this value
activation_typeu8activation type
collect_fee_modeu8collect fee mode
activation_pointOption<u64>activation point

InitializePoolParameters#

Struct types::InitializePoolParameters.

FieldTypeDescription
liquidityu128initialize liquidity
sqrt_priceu128The init price of the pool as a sqrt(token_b/token_a) Q64.64 value
activation_pointOption<u64>activation point

InnerVesting#

Struct types::InnerVesting.

FieldType
cliff_pointu64
period_frequencyu64
cliff_unlock_liquidityu128
liquidity_per_periodu128
total_released_liquidityu128
number_of_periodu16
padding[u8; 14]

PoolFeeParameters#

From the program's IDL:

Information regarding fee charges

Struct types::PoolFeeParameters.

FieldTypeDescription
base_feeBaseFeeParametersBase fee
compounding_fee_bpsu16compounding fee bps, only have value if CollectFeeMode::Compounding
paddingu8padding for future use
dynamic_feeOption<DynamicFeeParameters>dynamic fee

PoolFeesConfig#

Struct types::PoolFeesConfig.

FieldTypeDescription
base_feeBaseFeeInfo
dynamic_feeDynamicFeeConfig
protocol_fee_percentu8
padding0u8
referral_fee_percentu8
padding1[u8; 3]
compounding_fee_bpsu16Compounding fee bps, only non-zero if collect_fee_mode is compounding
padding2[u64; 5]

PoolFeesStruct#

From the program's IDL:

Information regarding fee charges trading_fee = amount * trade_fee_numerator / denominator protocol_fee = trading_fee * protocol_fee_percentage / 100 referral_fee = protocol_fee * referral_percentage / 100

Struct types::PoolFeesStruct.

FieldTypeDescription
base_feeBaseFeeStructTrade fees are extra token amounts that are held inside the token accounts during a trade, making the value of liquidity tokens rise. Trade fee numerator
protocol_fee_percentu8Protocol trading fees are extra token amounts that are held inside the token accounts during a trade, with the equivalent in pool tokens minted to the protocol of the program. Protocol trade fee numerator
padding0u8padding for future use
referral_fee_percentu8referral fee
padding1[u8; 3]padding
compounding_fee_bpsu16compounding fee bps, only non-zero in CollectFeeMode::Compounding
dynamic_feeDynamicFeeStructdynamic fee
init_sqrt_priceu128

PoolMetrics#

Struct types::PoolMetrics.

FieldType
total_lp_a_feeu128
total_lp_b_feeu128
total_protocol_a_feeu64
total_protocol_b_feeu64
padding0[u64; 2]
total_positionu64
paddingu64

PositionMetrics#

Struct types::PositionMetrics.

FieldType
total_claimed_a_feeu64
total_claimed_b_feeu64

RemoveLiquidityParameters#

Struct types::RemoveLiquidityParameters.

FieldTypeDescription
liquidity_deltau128delta liquidity
token_a_amount_thresholdu64minimum token a amount
token_b_amount_thresholdu64minimum token b amount

RewardInfo#

From the program's IDL:

Stores the state relevant for tracking liquidity mining rewards

Struct types::RewardInfo.

FieldTypeDescription
initializedu8Indicates if the reward has been initialized
reward_token_flagu8reward token flag
padding0[u8; 6]padding
padding1[u8; 8]Padding to ensure reward_rate: u128 is 16-byte aligned
mintPubkeyReward token mint.
vaultPubkeyReward vault token account.
funderPubkeyAuthority account that allows to fund rewards
reward_durationu64reward duration
reward_duration_endu64reward duration end
reward_rateu128reward rate
reward_per_token_stored[u8; 32]Reward per token stored
last_update_timeu64The last time reward states were updated.
cumulative_seconds_with_empty_liquidity_rewardu64Accumulated seconds when the farm distributed rewards but the bin was empty. These rewards will be carried over to the next reward time window.

SplitAmountInfo#

Struct types::SplitAmountInfo.

FieldType
permanent_locked_liquidityu128
unlocked_liquidityu128
fee_au64
fee_bu64
reward0u64
reward1u64

SplitAmountInfo2#

Struct types::SplitAmountInfo2.

FieldType
permanent_locked_liquidityu128
unlocked_liquidityu128
vested_liquidityu128
fee_au64
fee_bu64
reward0u64
reward1u64

SplitPositionInfo#

Struct types::SplitPositionInfo.

FieldType
liquidityu128
fee_au64
fee_bu64
reward0u64
reward1u64

SplitPositionInfo2#

Struct types::SplitPositionInfo2.

FieldType
unlocked_liquidityu128
permanent_locked_liquidityu128
vested_liquidityu128
fee_au64
fee_bu64
reward0u64
reward1u64

SplitPositionParameters#

Struct types::SplitPositionParameters.

FieldTypeDescription
unlocked_liquidity_percentageu8Percentage of unlocked liquidity to split to the second position
permanent_locked_liquidity_percentageu8Percentage of permanent locked liquidity to split to the second position
fee_a_percentageu8Percentage of fee A pending to split to the second position
fee_b_percentageu8Percentage of fee B pending to split to the second position
reward0_percentageu8Percentage of reward 0 pending to split to the second position
reward1_percentageu8Percentage of reward 1 pending to split to the second position
inner_vesting_liquidity_percentageu8Percentage of inner vesting liquidity
padding[u8; 15]padding for future

SplitPositionParameters2#

Struct types::SplitPositionParameters2.

FieldType
unlocked_liquidity_numeratoru32
permanent_locked_liquidity_numeratoru32
fee_a_numeratoru32
fee_b_numeratoru32
reward0_numeratoru32
reward1_numeratoru32

SplitPositionParameters3#

Struct types::SplitPositionParameters3.

FieldType
unlocked_liquidity_numeratoru32
permanent_locked_liquidity_numeratoru32
fee_a_numeratoru32
fee_b_numeratoru32
reward0_numeratoru32
reward1_numeratoru32
inner_vesting_liquidity_numeratoru32

StaticConfigParameters#

Struct types::StaticConfigParameters.

FieldType
pool_feesPoolFeeParameters
sqrt_min_priceu128
sqrt_max_priceu128
vault_config_keyPubkey
pool_creator_authorityPubkey
activation_typeu8
collect_fee_modeu8

SwapParameters#

Struct types::SwapParameters.

FieldType
amount_inu64
minimum_amount_outu64

SwapParameters2#

Struct types::SwapParameters2.

FieldTypeDescription
amount0u64When it's exact in, partial fill, this will be amount_in. When it's exact out, this will be amount_out
amount1u64When it's exact in, partial fill, this will be minimum_amount_out. When it's exact out, this will be maximum_amount_in
swap_modeu8Swap mode, refer [SwapMode]

SwapResult2#

Struct types::SwapResult2.

FieldType
included_fee_input_amountu64
excluded_fee_input_amountu64
amount_leftu64
output_amountu64
next_sqrt_priceu128
claiming_feeu64
protocol_feeu64
compounding_feeu64
referral_feeu64

UpdatePoolFeesParameters#

Struct types::UpdatePoolFeesParameters.

FieldTypeDescription
cliff_fee_numeratorOption<u64>Base fee update mode: - None: skip base fee update - Some: update new cliff_fee_numerator if base fee is static
dynamic_feeOption<DynamicFeeParameters>Dynamic fee update mode: - None: skip dynamic fee update - Some(with default value): disable dynamic fee - Some(with non default value): enable dynamic fee if disabled or update dynamic fee if enabled

UserRewardInfo#

Struct types::UserRewardInfo.

FieldTypeDescription
reward_per_token_checkpoint[u8; 32]The latest update reward checkpoint
reward_pendingsu64Current pending rewards
total_claimed_rewardsu64Total claimed rewards

VestingParameters#

Struct types::VestingParameters.

FieldType
cliff_pointOption<u64>
period_frequencyu64
cliff_unlock_liquidityu128
liquidity_per_periodu128
number_of_periodu16

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.