marginfi v2 decoder

Decode marginfi v2 instructions, accounts and events in Rust with carbon-marginfi-v2-decoder 2.0.0. Program ID MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA.

On this page

carbon-marginfi-v2-decoder decodes the instructions, accounts and events of the marginfi v2 program (MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA): 91 instructions, 15 account types, 30 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.

Cratecarbon-marginfi-v2-decoder 2.0.0
Installcargo add carbon-marginfi-v2-decoder@2.0.0
Program IDMFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA (carbon_marginfi_v2_decoder::PROGRAM_ID)
CategoryLending
Decodercarbon_marginfi_v2_decoder::MarginfiV2Decoder
Instruction enuminstructions::MarginfiV2Instruction
Account enumaccounts::MarginfiV2Account
Event enuminstructions::CpiEvent
Featuresserde, postgres, graphql (none enabled by default)
API docsdocs.rs/carbon-marginfi-v2-decoder/2.0.0
Sourcedecoders/marginfi-v2-decoder

Other lending decoders: Jupiter Lend, Kamino Lending, Kamino Vault, Meteora Vault, Sharky. To decode several in one pipeline, see lending 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 marginfi v2 transactions from the public RPC and prints every decoded ConfigGroupFee instruction. Add the dependencies:

Terminal
cargo add carbon-core@2.0.0 carbon-marginfi-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_marginfi_v2_decoder::{
        instructions::MarginfiV2Instruction, MarginfiV2Decoder, 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(MarginfiV2Decoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

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

Each ConfigGroupFee instruction prints one line with the transaction signature and the decoded ConfigGroupFee 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 MarginfiV2Instruction::CpiEvent { data: CpiEvent::DeleverageEvent(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 MarginfiAccount 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_marginfi_v2_decoder::{accounts::MarginfiV2Account, MarginfiV2Decoder, 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(MarginfiV2Decoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

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

ConfigGroupFee#

From the program's IDL:

(global fee admin only) Enable or disable program fees for any group. Does not require the group admin to sign: the global fee state admin can turn program fees on or off for any group

Discriminator e7cd42f2dc579126 · data ConfigGroupFee · accounts ConfigGroupFeeInstructionAccounts.

FieldType
enable_program_feebool

Required accounts: 3; extras go to remaining.

Fields of ConfigGroupFeeInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1global_fee_adminPubkey
2fee_statePubkey
3…remainingVec<AccountMeta>

ConfigureBankRateLimits#

From the program's IDL:

(admin or delegate_limit_admin) Configure bank-level rate limits for withdraw/borrow. Rate limits track net outflow in native tokens. Deposits offset withdraws. Set to 0 to disable. Hourly and daily windows are independent.

Discriminator af5455ddcedc6eae · data ConfigureBankRateLimits · accounts ConfigureBankRateLimitsInstructionAccounts.

FieldType
hourly_max_outflowOption<u64>
daily_max_outflowOption<u64>

Required accounts: 3; extras go to remaining.

Fields of ConfigureBankRateLimitsInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

ConfigureDeleverageWithdrawalLimit#

From the program's IDL:

(admin or delegate_limit_admin) Set the daily withdrawal limit for deleverages per group.

Discriminator 1c84cd9e434db13f · data ConfigureDeleverageWithdrawalLimit · accounts ConfigureDeleverageWithdrawalLimitInstructionAccounts.

FieldType
limitu32

Required accounts: 2; extras go to remaining.

Fields of ConfigureDeleverageWithdrawalLimitInstructionAccounts, in account order:

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

ConfigureGroupRateLimits#

From the program's IDL:

(admin or delegate_limit_admin) Configure group-level rate limits for withdraw/borrow. Rate limits track aggregate net outflow in USD.
Example: $10M = 10_000_000. Set to 0 to disable.

Discriminator 6f2fd58e9e33e266 · data ConfigureGroupRateLimits · accounts ConfigureGroupRateLimitsInstructionAccounts.

FieldType
hourly_max_outflow_usdOption<u64>
daily_max_outflow_usdOption<u64>

Required accounts: 2; extras go to remaining.

Fields of ConfigureGroupRateLimitsInstructionAccounts, in account order:

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

DriftDeposit#

From the program's IDL:

(user) Deposit into a Drift spot market through a marginfi account

  • amount - in the underlying token (e.g., USDC), in native decimals

Discriminator fc3ffac96237820c · data DriftDeposit · accounts DriftDepositInstructionAccounts.

FieldType
amountu64

Required accounts: 17; extras go to remaining.

Fields of DriftDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4drift_oracleOption<Pubkey>
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7signer_token_accountPubkey
8drift_statePubkey
9integration_acc2Pubkey
10integration_acc3Pubkey
11integration_acc1Pubkey
12drift_spot_market_vaultPubkey
13mintPubkey
14drift_programPubkey
15token_programPubkey
16system_programPubkey
17…remainingVec<AccountMeta>

DriftHarvestReward#

From the program's IDL:

(permissionless) Harvest rewards from admin deposits in Drift spot markets.
Rewards are always sent to the global fee wallet's canonical ATA.
The harvest spot market must be different from the bank's main drift spot market.

Discriminator a7a1f0c28a3657bd · data DriftHarvestReward · accounts DriftHarvestRewardInstructionAccounts.

No data fields.

Required accounts: 14; extras go to remaining.

Fields of DriftHarvestRewardInstructionAccounts, in account order:

#FieldType
0bankPubkey
1fee_statePubkey
2liquidity_vault_authorityPubkey
3intermediary_token_accountPubkey
4destination_token_accountPubkey
5drift_statePubkey
6integration_acc2Pubkey
7integration_acc3Pubkey
8harvest_drift_spot_marketPubkey
9harvest_drift_spot_market_vaultPubkey
10drift_signerPubkey
11reward_mintPubkey
12drift_programPubkey
13token_programPubkey
14…remainingVec<AccountMeta>

DriftInitUser#

From the program's IDL:

(permissionless) Initialize a Drift user and user stats for a marginfi bank
Creates user with sub_account_id = 0 and empty name
Requires a minimum deposit to ensure the account remains active

  • amount - minimum deposit amount (at least 10 units) in native decimals

Discriminator 1d12ecbe1dfe72a9 · data DriftInitUser · accounts DriftInitUserInstructionAccounts.

FieldType
amountu64

Required accounts: 16; extras go to remaining.

Fields of DriftInitUserInstructionAccounts, in account order:

#FieldType
0fee_payerPubkey
1signer_token_accountPubkey
2bankPubkey
3liquidity_vault_authorityPubkey
4liquidity_vaultPubkey
5mintPubkey
6integration_acc3Pubkey
7integration_acc2Pubkey
8drift_statePubkey
9integration_acc1Pubkey
10drift_spot_market_vaultPubkey
11drift_oracleOption<Pubkey>
12drift_programPubkey
13token_programPubkey
14rentPubkey
15system_programPubkey
16…remainingVec<AccountMeta>

DriftWithdraw#

From the program's IDL:

(user) Withdraw from a Drift spot market through a marginfi account

  • amount - in the underlying token (e.g., USDC), in native decimals
  • withdraw_all - if true, withdraws entire position

Discriminator 563bba7bb7b5ea89 · data DriftWithdraw · accounts DriftWithdrawInstructionAccounts.

FieldType
amountu64
withdraw_allOption<bool>

Required accounts: 24; extras go to remaining.

Fields of DriftWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4drift_oracleOption<Pubkey>
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7destination_token_accountPubkey
8drift_statePubkey
9integration_acc2Pubkey
10integration_acc3Pubkey
11integration_acc1Pubkey
12drift_spot_market_vaultPubkey
13drift_reward_oracleOption<Pubkey>
14drift_reward_spot_marketOption<Pubkey>
15drift_reward_mintOption<Pubkey>
16drift_reward_oracle2Option<Pubkey>
17drift_reward_spot_market2Option<Pubkey>
18drift_reward_mint2Option<Pubkey>
19drift_signerPubkey
20mintPubkey
21drift_programPubkey
22token_programPubkey
23system_programPubkey
24…remainingVec<AccountMeta>

EditGlobalFeeState#

From the program's IDL:

(global fee admin only) Adjust fees, admin, or the destination wallet

Discriminator 343e23815d45a5ca · data EditGlobalFeeState · accounts EditGlobalFeeStateInstructionAccounts.

FieldType
adminPubkey
fee_walletPubkey
bank_init_flat_sol_feeu32
liquidation_flat_sol_feeu32
order_init_flat_sol_feeu32
program_fee_fixedWrappedI80F48
program_fee_rateWrappedI80F48
liquidation_max_feeWrappedI80F48
order_execution_max_feeWrappedI80F48

Required accounts: 2; extras go to remaining.

Fields of EditGlobalFeeStateInstructionAccounts, in account order:

#FieldType
0global_fee_adminPubkey
1fee_statePubkey
2…remainingVec<AccountMeta>

EditStakedSettings#

From the program's IDL:

(admin only) Edit the staked collateral settings for the group.

Discriminator 0b6cd757f00942f1 · data EditStakedSettings · accounts EditStakedSettingsInstructionAccounts.

FieldType
settingsStakedSettingsEditConfig

Required accounts: 3; extras go to remaining.

Fields of EditStakedSettingsInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2staked_settingsPubkey
3…remainingVec<AccountMeta>

EndDeleverage#

From the program's IDL:

(risk_admin only) End forced deleverage. Validates health did not worsen.

Discriminator 720efa8ffc68d6d1 · data EndDeleverage · accounts EndDeleverageInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of EndDeleverageInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1liquidation_recordPubkey
2groupPubkey
3risk_adminPubkey
4…remainingVec<AccountMeta>

EndLiquidation#

From the program's IDL:

(liquidation_receiver, set in start_liquidation) End receivership liquidation. Validates health improved and seized assets are within fee limits. Charges a flat SOL fee.

Discriminator 6e0bf436e5b516b8 · data EndLiquidation · accounts EndLiquidationInstructionAccounts.

No data fields.

Required accounts: 6; extras go to remaining.

Fields of EndLiquidationInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1liquidation_recordPubkey
2liquidation_receiverPubkey
3fee_statePubkey
4global_fee_walletPubkey
5system_programPubkey
6…remainingVec<AccountMeta>

InitBankMetadata#

From the program's IDL:

(permissionless) pay the rent to open a bank's metadata.

Discriminator 5eef328889ccfed5 · data InitBankMetadata · accounts InitBankMetadataInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of InitBankMetadataInstructionAccounts, in account order:

#FieldType
0bankPubkey
1fee_payerPubkey
2metadataPubkey
3system_programPubkey
4…remainingVec<AccountMeta>

InitGlobalFeeState#

From the program's IDL:

(Runs once per program) Configures the fee state account, where the global admin sets fees that are assessed to the protocol

Discriminator 5230f73bdc6de72c · data InitGlobalFeeState · accounts InitGlobalFeeStateInstructionAccounts.

FieldType
adminPubkey
fee_walletPubkey
bank_init_flat_sol_feeu32
liquidation_flat_sol_feeu32
order_init_flat_sol_feeu32
program_fee_fixedWrappedI80F48
program_fee_rateWrappedI80F48
liquidation_max_feeWrappedI80F48
order_execution_max_feeWrappedI80F48

Required accounts: 3; extras go to remaining.

Fields of InitGlobalFeeStateInstructionAccounts, in account order:

#FieldType
0payerPubkey
1fee_statePubkey
2system_programPubkey
3…remainingVec<AccountMeta>

InitStakedSettings#

From the program's IDL:

(group admin only) Init the Staked Settings account, which is used to create staked collateral banks, and must run before any staked collateral bank can be created with add_pool_permissionless. Running this ix effectively opts the group into the staked collateral feature.

Discriminator 3423952c45564550 · data InitStakedSettings · accounts InitStakedSettingsInstructionAccounts.

FieldType
settingsStakedSettingsConfig

Required accounts: 5; extras go to remaining.

Fields of InitStakedSettingsInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2fee_payerPubkey
3staked_settingsPubkey
4system_programPubkey
5…remainingVec<AccountMeta>

JuplendDeposit#

From the program's IDL:

(user) Deposit into a JupLend lending pool through a marginfi account.

  • amount - in the underlying token (e.g., USDC), in native decimals

Discriminator 720bda51b7a58fff · data JuplendDeposit · accounts JuplendDepositInstructionAccounts.

FieldType
amountu64

Required accounts: 23; extras go to remaining.

Fields of JuplendDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4signer_token_accountPubkey
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7mintPubkey
8integration_acc1Pubkey
9f_token_mintPubkey
10integration_acc2Pubkey
11lending_adminPubkey
12supply_token_reserves_liquidityPubkey
13lending_supply_position_on_liquidityPubkey
14rate_modelPubkey
15vaultPubkey
16liquidityPubkey
17liquidity_programPubkey
18rewards_rate_modelPubkey
19juplend_programPubkey
20token_programPubkey
21associated_token_programPubkey
22system_programPubkey
23…remainingVec<AccountMeta>

JuplendInitPosition#

From the program's IDL:

(permissionless) Initialize the bank-level JupLend position.
This creates the bank's fToken ATA (owned by the bank liquidity vault authority) and performs a nominal seed deposit into JupLend, then flips the bank from Paused to Operational.

Discriminator b0ff976a05cf4ad7 · data JuplendInitPosition · accounts JuplendInitPositionInstructionAccounts.

FieldType
amountu64

Required accounts: 21; extras go to remaining.

Fields of JuplendInitPositionInstructionAccounts, in account order:

#FieldType
0fee_payerPubkey
1signer_token_accountPubkey
2bankPubkey
3liquidity_vault_authorityPubkey
4liquidity_vaultPubkey
5mintPubkey
6integration_acc1Pubkey
7f_token_mintPubkey
8integration_acc2Pubkey
9lending_adminPubkey
10supply_token_reserves_liquidityPubkey
11lending_supply_position_on_liquidityPubkey
12rate_modelPubkey
13vaultPubkey
14liquidityPubkey
15liquidity_programPubkey
16rewards_rate_modelPubkey
17juplend_programPubkey
18token_programPubkey
19associated_token_programPubkey
20system_programPubkey
21…remainingVec<AccountMeta>

JuplendWithdraw#

From the program's IDL:

(user) Withdraw from a JupLend lending pool through a marginfi account.

  • amount - in the underlying token (e.g., USDC), in native decimals

Discriminator f5a4fdca354dfbdd · data JuplendWithdraw · accounts JuplendWithdrawInstructionAccounts.

FieldType
amountu64
withdraw_allOption<bool>

Required accounts: 24; extras go to remaining.

Fields of JuplendWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4destination_token_accountPubkey
5liquidity_vault_authorityPubkey
6mintPubkey
7integration_acc1Pubkey
8f_token_mintPubkey
9integration_acc2Pubkey
10integration_acc3Pubkey
11lending_adminPubkey
12supply_token_reserves_liquidityPubkey
13lending_supply_position_on_liquidityPubkey
14rate_modelPubkey
15vaultPubkey
16claim_accountPubkey
17liquidityPubkey
18liquidity_programPubkey
19rewards_rate_modelPubkey
20juplend_programPubkey
21token_programPubkey
22associated_token_programPubkey
23system_programPubkey
24…remainingVec<AccountMeta>

KaminoDeposit#

From the program's IDL:

(user) Deposit into a Kamino pool through a marginfi account

  • amount - in the liquidity token (e.g. if there is a Kamino USDC bank, pass the amount of

USDC desired), in native decimals.

Discriminator ed08bcbb73633155 · data KaminoDeposit · accounts KaminoDepositInstructionAccounts.

FieldType
amountu64

Required accounts: 22; extras go to remaining.

Fields of KaminoDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4signer_token_accountPubkey
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7integration_acc2Pubkey
8lending_marketPubkey
9lending_market_authorityPubkey
10integration_acc1Pubkey
11mintPubkey
12reserve_liquidity_supplyPubkey
13reserve_collateral_mintPubkey
14reserve_destination_deposit_collateralPubkey
15obligation_farm_user_stateOption<Pubkey>
16reserve_farm_stateOption<Pubkey>
17kamino_programPubkey
18farms_programPubkey
19collateral_token_programPubkey
20liquidity_token_programPubkey
21instruction_sysvar_accountPubkey
22…remainingVec<AccountMeta>

KaminoHarvestReward#

From the program's IDL:

(permissionless) Harvest the specified reward index from the Kamino Farm attached to this bank. Rewards are always sent to the global fee wallet's canonical ATA.

  • reward_index — index of the reward token in the Kamino Farm's reward list

Discriminator a3caf88d6a147405 · data KaminoHarvestReward · accounts KaminoHarvestRewardInstructionAccounts.

FieldType
reward_indexu64

Required accounts: 15; extras go to remaining.

Fields of KaminoHarvestRewardInstructionAccounts, in account order:

#FieldType
0bankPubkey
1fee_statePubkey
2destination_token_accountPubkey
3liquidity_vault_authorityPubkey
4user_statePubkey
5farm_statePubkey
6global_configPubkey
7reward_mintPubkey
8user_reward_ataPubkey
9rewards_vaultPubkey
10rewards_treasury_vaultPubkey
11farm_vaults_authorityPubkey
12scope_pricesOption<Pubkey>
13farms_programPubkey
14token_programPubkey
15…remainingVec<AccountMeta>

KaminoInitObligation#

From the program's IDL:

(permissionless) Initialize a Kamino obligation for a marginfi bank

  • amount - In token, in native decimals. Must be >10 (i.e. 10 lamports, not 10 tokens). Lost

forever. Generally, try to make this the equivalent of around $1, in case
Kamino ever rounds small balances down to zero.

Discriminator fdb1a0e1469cd96d · data KaminoInitObligation · accounts KaminoInitObligationInstructionAccounts.

FieldType
amountu64

Required accounts: 27; extras go to remaining.

Fields of KaminoInitObligationInstructionAccounts, in account order:

#FieldType
0fee_payerPubkey
1bankPubkey
2signer_token_accountPubkey
3liquidity_vault_authorityPubkey
4liquidity_vaultPubkey
5integration_acc2Pubkey
6user_metadataPubkey
7lending_marketPubkey
8lending_market_authorityPubkey
9integration_acc1Pubkey
10mintPubkey
11reserve_liquidity_supplyPubkey
12reserve_collateral_mintPubkey
13reserve_destination_deposit_collateralPubkey
14pyth_oracleOption<Pubkey>
15switchboard_price_oracleOption<Pubkey>
16switchboard_twap_oracleOption<Pubkey>
17scope_pricesOption<Pubkey>
18obligation_farm_user_stateOption<Pubkey>
19reserve_farm_stateOption<Pubkey>
20kamino_programPubkey
21farms_programPubkey
22collateral_token_programPubkey
23liquidity_token_programPubkey
24instruction_sysvar_accountPubkey
25rentPubkey
26system_programPubkey
27…remainingVec<AccountMeta>

KaminoWithdraw#

From the program's IDL:

(user) Withdraw from a Kamino pool through a marginfi account

  • amount - in the collateral token (NOT liquidity token), in native decimals. Must convert

from collateral to liquidity token amounts using the current exchange rate.

  • withdraw_all - if true, withdraw the entire mrgn balance (Note: due to rounding down, a

deposit and withdraw back to back may result in several lamports less)

Discriminator c765292dd562e0c8 · data KaminoWithdraw · accounts KaminoWithdrawInstructionAccounts.

FieldType
amountu64
withdraw_allOption<bool>

Required accounts: 22; extras go to remaining.

Fields of KaminoWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4destination_token_accountPubkey
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7integration_acc2Pubkey
8lending_marketPubkey
9lending_market_authorityPubkey
10integration_acc1Pubkey
11mintPubkey
12reserve_liquidity_supplyPubkey
13reserve_collateral_mintPubkey
14reserve_source_collateralPubkey
15obligation_farm_user_stateOption<Pubkey>
16reserve_farm_stateOption<Pubkey>
17kamino_programPubkey
18farms_programPubkey
19collateral_token_programPubkey
20liquidity_token_programPubkey
21instruction_sysvar_accountPubkey
22…remainingVec<AccountMeta>

LendingAccountBorrow#

From the program's IDL:

(account authority) Borrow assets from a bank. Accrues interest, records liability, applies origination fee, transfers tokens, and runs a health check.

Discriminator 047e74353005d41f · data LendingAccountBorrow · accounts LendingAccountBorrowInstructionAccounts.

FieldType
amountu64

Required accounts: 8; extras go to remaining.

Fields of LendingAccountBorrowInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4destination_token_accountPubkey
5bank_liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7token_programPubkey
8…remainingVec<AccountMeta>

LendingAccountClearEmissions#

From the program's IDL:

(permissionless) Zero out emissions_outstanding on a balance after emissions are disabled on the bank.

Discriminator ef04dd622da7c9f4 · data LendingAccountClearEmissions · accounts LendingAccountClearEmissionsInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of LendingAccountClearEmissionsInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1bankPubkey
2…remainingVec<AccountMeta>

LendingAccountCloseBalance#

From the program's IDL:

(account authority) Close a balance position with dust-level amounts.

Discriminator f5362904f3ca1f11 · data LendingAccountCloseBalance · accounts LendingAccountCloseBalanceInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of LendingAccountCloseBalanceInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4…remainingVec<AccountMeta>

LendingAccountDeposit#

From the program's IDL:

(account authority) Deposit assets into a bank. Accrues interest, records deposit, and transfers tokens from the signer's token account to the bank's liquidity vault.

Discriminator ab5eeb675240d48c · data LendingAccountDeposit · accounts LendingAccountDepositInstructionAccounts.

FieldType
amountu64
deposit_up_to_limitOption<bool>

Required accounts: 7; extras go to remaining.

Fields of LendingAccountDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4signer_token_accountPubkey
5liquidity_vaultPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

LendingAccountEndFlashloan#

From the program's IDL:

(account authority) End a flash loan and run the health check.

Discriminator 697cc96a9902089c · data LendingAccountEndFlashloan · accounts LendingAccountEndFlashloanInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of LendingAccountEndFlashloanInstructionAccounts, in account order:

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

LendingAccountLiquidate#

From the program's IDL:

(permissionless) Liquidate a lending account balance of an unhealthy marginfi account. The liquidator takes on the liability and receives discounted collateral (2.5% liquidator fee + 2.5% insurance fee).

  • asset_amount - amount of collateral to liquidate
  • liquidatee_accounts - number of remaining accounts for the liquidatee
  • liquidator_accounts - number of remaining accounts for the liquidator

Discriminator d6a997d5fba756db · data LendingAccountLiquidate · accounts LendingAccountLiquidateInstructionAccounts.

FieldType
asset_amountu64
liquidatee_accountsu8
liquidator_accountsu8

Required accounts: 10; extras go to remaining.

Fields of LendingAccountLiquidateInstructionAccounts, in account order:

#FieldType
0groupPubkey
1asset_bankPubkey
2liab_bankPubkey
3liquidator_marginfi_accountPubkey
4authorityPubkey
5liquidatee_marginfi_accountPubkey
6bank_liquidity_vault_authorityPubkey
7bank_liquidity_vaultPubkey
8bank_insurance_vaultPubkey
9token_programPubkey
10…remainingVec<AccountMeta>

LendingAccountPulseHealth#

From the program's IDL:

(Permissionless) Refresh the internal risk engine health cache. Useful for liquidators and other consumers that want to see the internal risk state of a user account. This cache is read-only and serves no purpose except being populated by this ix.

  • remaining accounts expected in the same order as borrow, etc. I.e., for each balance the

user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>

Discriminator ba347561224a27fd · data LendingAccountPulseHealth · accounts LendingAccountPulseHealthInstructionAccounts.

No data fields.

Required accounts: 1; extras go to remaining.

Fields of LendingAccountPulseHealthInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1…remainingVec<AccountMeta>

LendingAccountRepay#

From the program's IDL:

(account authority, or any signer during receivership) Repay borrowed assets. Accrues interest, records repayment, and transfers tokens to the bank's liquidity vault.

Discriminator 4fd1acb1de33ad97 · data LendingAccountRepay · accounts LendingAccountRepayInstructionAccounts.

FieldType
amountu64
repay_allOption<bool>

Required accounts: 7; extras go to remaining.

Fields of LendingAccountRepayInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4signer_token_accountPubkey
5liquidity_vaultPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

LendingAccountStartFlashloan#

From the program's IDL:

(account authority) Start a flash loan. Must have a corresponding end_flashloan ix in the same tx. Health checks are skipped until the flash loan ends.

Discriminator 0e8321dc51bab46b · data LendingAccountStartFlashloan · accounts LendingAccountStartFlashloanInstructionAccounts.

FieldType
end_indexu64

Required accounts: 3; extras go to remaining.

Fields of LendingAccountStartFlashloanInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1authorityPubkey
2ixs_sysvarPubkey
3…remainingVec<AccountMeta>

LendingAccountWithdraw#

From the program's IDL:

(account authority, or any signer during receivership) Withdraw assets from a bank. Accrues interest, records withdrawal, transfers tokens, and runs a health check (skipped during receivership).

Discriminator 24484a13d2d2c0c0 · data LendingAccountWithdraw · accounts LendingAccountWithdrawInstructionAccounts.

FieldType
amountu64
withdraw_allOption<bool>

Required accounts: 8; extras go to remaining.

Fields of LendingAccountWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4destination_token_accountPubkey
5bank_liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7token_programPubkey
8…remainingVec<AccountMeta>

LendingPoolAccrueBankInterest#

From the program's IDL:

(permissionless) Accrue interest on a bank, updating share values and collecting fees.

Discriminator 6cc91e572f4161bc · data LendingPoolAccrueBankInterest · accounts LendingPoolAccrueBankInterestInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of LendingPoolAccrueBankInterestInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2…remainingVec<AccountMeta>

LendingPoolAddBank#

From the program's IDL:

(admin only) Add a new bank to the lending pool

Discriminator d744484ed0da67b6 · data LendingPoolAddBank · accounts LendingPoolAddBankInstructionAccounts.

FieldType
bank_configBankConfigCompact

Required accounts: 15; extras go to remaining.

Fields of LendingPoolAddBankInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2fee_payerPubkey
3fee_statePubkey
4global_fee_walletPubkey
5bank_mintPubkey
6bankPubkey
7liquidity_vault_authorityPubkey
8liquidity_vaultPubkey
9insurance_vault_authorityPubkey
10insurance_vaultPubkey
11fee_vault_authorityPubkey
12fee_vaultPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

LendingPoolAddBankDrift#

From the program's IDL:

(group admin only) Add a Drift bank to the group.

Discriminator 3e3f31304c376c9b · data LendingPoolAddBankDrift · accounts LendingPoolAddBankDriftInstructionAccounts.

FieldType
bank_configDriftConfigCompact
bank_seedu64

Required accounts: 16; extras go to remaining.

Fields of LendingPoolAddBankDriftInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2fee_payerPubkey
3bank_mintPubkey
4bankPubkey
5integration_acc1Pubkey
6integration_acc2Pubkey
7integration_acc3Pubkey
8liquidity_vault_authorityPubkey
9liquidity_vaultPubkey
10insurance_vault_authorityPubkey
11insurance_vaultPubkey
12fee_vault_authorityPubkey
13fee_vaultPubkey
14token_programPubkey
15system_programPubkey
16…remainingVec<AccountMeta>

LendingPoolAddBankJuplend#

From the program's IDL:

(admin) Add a JupLend bank to the marginfi group.
Remaining accounts (for oracle validation): 0. underlying oracle feed (pyth push or switchboard pull)

  1. JupLend Lending state

Discriminator 12d0755a356fc329 · data LendingPoolAddBankJuplend · accounts LendingPoolAddBankJuplendInstructionAccounts.

FieldType
bank_configJuplendConfigCompact
bank_seedu64

Required accounts: 16; extras go to remaining.

Fields of LendingPoolAddBankJuplendInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2fee_payerPubkey
3bank_mintPubkey
4bankPubkey
5integration_acc1Pubkey
6liquidity_vault_authorityPubkey
7liquidity_vaultPubkey
8insurance_vault_authorityPubkey
9insurance_vaultPubkey
10fee_vault_authorityPubkey
11fee_vaultPubkey
12f_token_mintPubkey
13integration_acc2Pubkey
14token_programPubkey
15system_programPubkey
16…remainingVec<AccountMeta>

LendingPoolAddBankKamino#

From the program's IDL:

(group admin only) Add a Kamino bank to the group. Pass the oracle and reserve in remaining accounts 0 and 1 respectively.

Discriminator 763510f3fff595f1 · data LendingPoolAddBankKamino · accounts LendingPoolAddBankKaminoInstructionAccounts.

FieldType
bank_configKaminoConfigCompact
bank_seedu64

Required accounts: 15; extras go to remaining.

Fields of LendingPoolAddBankKaminoInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2fee_payerPubkey
3bank_mintPubkey
4bankPubkey
5integration_acc1Pubkey
6integration_acc2Pubkey
7liquidity_vault_authorityPubkey
8liquidity_vaultPubkey
9insurance_vault_authorityPubkey
10insurance_vaultPubkey
11fee_vault_authorityPubkey
12fee_vaultPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

LendingPoolAddBankPermissionless#

From the program's IDL:

(permissionless) Add a staked collateral bank. Requires a valid SPL single-pool LST mint.

Discriminator 7fbb7922bba7ee66 · data LendingPoolAddBankPermissionless · accounts LendingPoolAddBankPermissionlessInstructionAccounts.

FieldType
bank_seedu64

Required accounts: 15; extras go to remaining.

Fields of LendingPoolAddBankPermissionlessInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1staked_settingsPubkey
2fee_payerPubkey
3bank_mintPubkey
4sol_poolPubkey
5stake_poolPubkey
6bankPubkey
7liquidity_vault_authorityPubkey
8liquidity_vaultPubkey
9insurance_vault_authorityPubkey
10insurance_vaultPubkey
11fee_vault_authorityPubkey
12fee_vaultPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

LendingPoolAddBankSolend#

From the program's IDL:

(admin) Add a Solend bank to the marginfi group

Discriminator 51e9cbc72fe20044 · data LendingPoolAddBankSolend · accounts LendingPoolAddBankSolendInstructionAccounts.

FieldType
bank_configSolendConfigCompact
bank_seedu64

Required accounts: 15; extras go to remaining.

Fields of LendingPoolAddBankSolendInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2fee_payerPubkey
3bank_mintPubkey
4bankPubkey
5integration_acc1Pubkey
6integration_acc2Pubkey
7liquidity_vault_authorityPubkey
8liquidity_vaultPubkey
9insurance_vault_authorityPubkey
10insurance_vaultPubkey
11fee_vault_authorityPubkey
12fee_vaultPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

LendingPoolAddBankWithSeed#

From the program's IDL:

(admin only) A copy of lending_pool_add_bank with an additional bank seed.
This seed is used to create a PDA for the bank's signature.
lending_pool_add_bank is preserved for backwards compatibility.

Discriminator 4cd3d5ab754e9e4c · data LendingPoolAddBankWithSeed · accounts LendingPoolAddBankWithSeedInstructionAccounts.

FieldType
bank_configBankConfigCompact
bank_seedu64

Required accounts: 15; extras go to remaining.

Fields of LendingPoolAddBankWithSeedInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2fee_payerPubkey
3fee_statePubkey
4global_fee_walletPubkey
5bank_mintPubkey
6bankPubkey
7liquidity_vault_authorityPubkey
8liquidity_vaultPubkey
9insurance_vault_authorityPubkey
10insurance_vaultPubkey
11fee_vault_authorityPubkey
12fee_vaultPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

LendingPoolCloneBank#

From the program's IDL:

(admin only) Staging or localnet only, panics on mainnet
This instruction is used to clone a bank to a new PDA.

Discriminator d65d11ecb1e44e11 · data LendingPoolCloneBank · accounts LendingPoolCloneBankInstructionAccounts.

FieldType
bank_seedu64

Required accounts: 14; extras go to remaining.

Fields of LendingPoolCloneBankInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2fee_payerPubkey
3bank_mintPubkey
4source_bankPubkey
5bankPubkey
6liquidity_vault_authorityPubkey
7liquidity_vaultPubkey
8insurance_vault_authorityPubkey
9insurance_vaultPubkey
10fee_vault_authorityPubkey
11fee_vaultPubkey
12token_programPubkey
13system_programPubkey
14…remainingVec<AccountMeta>

LendingPoolCloneEmode#

From the program's IDL:

(admin or emode_admin) Copies emode settings from one bank to another.
Useful when applying emode settings from e.g. one LST to another.

Discriminator 92a75e6ab8ca0f0a · data LendingPoolCloneEmode · accounts LendingPoolCloneEmodeInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of LendingPoolCloneEmodeInstructionAccounts, in account order:

#FieldType
0groupPubkey
1signerPubkey
2copy_from_bankPubkey
3copy_to_bankPubkey
4…remainingVec<AccountMeta>

LendingPoolCloseBank#

From the program's IDL:

(admin only) Close a bank. Requires CLOSE_ENABLED_FLAG and zero positions/shares.

Discriminator 16730782e355002f · data LendingPoolCloseBank · accounts LendingPoolCloseBankInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of LendingPoolCloseBankInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2adminPubkey
3…remainingVec<AccountMeta>

LendingPoolCollectBankFees#

From the program's IDL:

(permissionless) Transfer accrued fees from the liquidity vault to insurance/fee/program vaults.

Discriminator c905d774e65c4b96 · data LendingPoolCollectBankFees · accounts LendingPoolCollectBankFeesInstructionAccounts.

No data fields.

Required accounts: 9; extras go to remaining.

Fields of LendingPoolCollectBankFeesInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2liquidity_vault_authorityPubkey
3liquidity_vaultPubkey
4insurance_vaultPubkey
5fee_vaultPubkey
6fee_statePubkey
7fee_ataPubkey
8token_programPubkey
9…remainingVec<AccountMeta>

LendingPoolConfigureBank#

From the program's IDL:

(admin only) Configure bank parameters. If the bank has FREEZE_SETTINGS, only deposit/borrow limits are updated and all other config changes are silently ignored.

Discriminator 79ad9c285d9438ed · data LendingPoolConfigureBank · accounts LendingPoolConfigureBankInstructionAccounts.

FieldType
bank_config_optBankConfigOpt

Required accounts: 3; extras go to remaining.

Fields of LendingPoolConfigureBankInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolConfigureBankEmode#

From the program's IDL:

(emode_admin only)

Discriminator 11af5b39ef563147 · data LendingPoolConfigureBankEmode · accounts LendingPoolConfigureBankEmodeInstructionAccounts.

FieldType
emode_tagu16
entries[EmodeEntry; 10]

Required accounts: 3; extras go to remaining.

Fields of LendingPoolConfigureBankEmodeInstructionAccounts, in account order:

#FieldType
0groupPubkey
1emode_adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolConfigureBankInterestOnly#

From the program's IDL:

(delegate_curve_admin only) Update interest rate config. Does nothing if bank has FREEZE_SETTINGS.

Discriminator f56b532667dba3f1 · data LendingPoolConfigureBankInterestOnly · accounts LendingPoolConfigureBankInterestOnlyInstructionAccounts.

FieldType
interest_rate_configInterestRateConfigOpt

Required accounts: 3; extras go to remaining.

Fields of LendingPoolConfigureBankInterestOnlyInstructionAccounts, in account order:

#FieldType
0groupPubkey
1delegate_curve_adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolConfigureBankLimitsOnly#

From the program's IDL:

(delegate_limit_admin only) Update deposit/borrow/init limits only.

Discriminator 9dc4ddc8ca3e5415 · data LendingPoolConfigureBankLimitsOnly · accounts LendingPoolConfigureBankLimitsOnlyInstructionAccounts.

FieldType
deposit_limitOption<u64>
borrow_limitOption<u64>
total_asset_value_init_limitOption<u64>

Required accounts: 3; extras go to remaining.

Fields of LendingPoolConfigureBankLimitsOnlyInstructionAccounts, in account order:

#FieldType
0groupPubkey
1delegate_limit_adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolConfigureBankOracle#

From the program's IDL:

(admin only)

Discriminator d152ffab7c154751 · data LendingPoolConfigureBankOracle · accounts LendingPoolConfigureBankOracleInstructionAccounts.

FieldType
setupu8
oraclePubkey

Required accounts: 3; extras go to remaining.

Fields of LendingPoolConfigureBankOracleInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolForceTokenlessRepayComplete#

From the program's IDL:

(risk_admin only) - Signals all of a bank's liability have been deleveraged.
Used if a bank still has liability dust after the risk admin has completed deleveraging all debts. The risk admin is trusted not to execute this until all non-dust debts have been deleveraged.

Discriminator 0fcb93e8c70ee725 · data LendingPoolForceTokenlessRepayComplete · accounts LendingPoolForceTokenlessRepayCompleteInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of LendingPoolForceTokenlessRepayCompleteInstructionAccounts, in account order:

#FieldType
0groupPubkey
1risk_adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolHandleBankruptcy#

From the program's IDL:

(risk_admin or admin, unless PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG is set on the bank) Handle bad debt of a bankrupt marginfi account for a given bank. Covers bad debt from the insurance fund and socializes any remainder among depositors.

Discriminator a20b388b5a8046ad · data LendingPoolHandleBankruptcy · accounts LendingPoolHandleBankruptcyInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of LendingPoolHandleBankruptcyInstructionAccounts, in account order:

#FieldType
0groupPubkey
1signerPubkey
2bankPubkey
3marginfi_accountPubkey
4liquidity_vaultPubkey
5insurance_vaultPubkey
6insurance_vault_authorityPubkey
7token_programPubkey
8…remainingVec<AccountMeta>

LendingPoolPulseBankPriceCache#

From the program's IDL:

(Permissionless) Refresh the cached oracle price for a bank.

Discriminator c013c98769cb20de · data LendingPoolPulseBankPriceCache · accounts LendingPoolPulseBankPriceCacheInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of LendingPoolPulseBankPriceCacheInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2…remainingVec<AccountMeta>

LendingPoolReclaimEmissionsVault#

From the program's IDL:

(permissionless) Reclaim all remaining tokens from the emissions vault to the global fee wallet ATA, and disable emissions on the bank.

Discriminator ce43bae1291e5fd8 · data LendingPoolReclaimEmissionsVault · accounts LendingPoolReclaimEmissionsVaultInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of LendingPoolReclaimEmissionsVaultInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2emissions_mintPubkey
3emissions_authPubkey
4emissions_vaultPubkey
5fee_statePubkey
6destination_accountPubkey
7token_programPubkey
8…remainingVec<AccountMeta>

LendingPoolSetFixedOraclePrice#

From the program's IDL:

(admin only)

Discriminator 1c7e7f7f3c25d37d · data LendingPoolSetFixedOraclePrice · accounts LendingPoolSetFixedOraclePriceInstructionAccounts.

FieldType
priceWrappedI80F48

Required accounts: 3; extras go to remaining.

Fields of LendingPoolSetFixedOraclePriceInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3…remainingVec<AccountMeta>

LendingPoolUpdateFeesDestinationAccount#

From the program's IDL:

(admin only) Set the destination wallet for permissionless fee withdrawals.

Discriminator 660479f3ed6e5f0d · data LendingPoolUpdateFeesDestinationAccount · accounts LendingPoolUpdateFeesDestinationAccountInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of LendingPoolUpdateFeesDestinationAccountInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2adminPubkey
3destination_accountPubkey
4…remainingVec<AccountMeta>

LendingPoolWithdrawFees#

From the program's IDL:

(admin only) Withdraw collected group fees from the fee vault.

Discriminator 5c8cd7feaa0053ae · data LendingPoolWithdrawFees · accounts LendingPoolWithdrawFeesInstructionAccounts.

FieldType
amountu64

Required accounts: 7; extras go to remaining.

Fields of LendingPoolWithdrawFeesInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2adminPubkey
3fee_vaultPubkey
4fee_vault_authorityPubkey
5dst_token_accountPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

LendingPoolWithdrawFeesPermissionless#

From the program's IDL:

(permissionless) Withdraw group fees to the pre-configured fees_destination_account.

Discriminator 39f501d082129171 · data LendingPoolWithdrawFeesPermissionless · accounts LendingPoolWithdrawFeesPermissionlessInstructionAccounts.

FieldType
amountu64

Required accounts: 6; extras go to remaining.

Fields of LendingPoolWithdrawFeesPermissionlessInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2fee_vaultPubkey
3fee_vault_authorityPubkey
4fees_destination_accountPubkey
5token_programPubkey
6…remainingVec<AccountMeta>

LendingPoolWithdrawInsurance#

From the program's IDL:

(admin only) Withdraw from the insurance vault.

Discriminator 6c3c3cf6684f9ff3 · data LendingPoolWithdrawInsurance · accounts LendingPoolWithdrawInsuranceInstructionAccounts.

FieldType
amountu64

Required accounts: 7; extras go to remaining.

Fields of LendingPoolWithdrawInsuranceInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2adminPubkey
3insurance_vaultPubkey
4insurance_vault_authorityPubkey
5dst_token_accountPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

MarginfiAccountClose#

From the program's IDL:

(account authority) Close a marginfi account. Requires all balances to be empty and no active flags (disabled, flashloan, receivership).

Discriminator badd5d223261c2f1 · data MarginfiAccountClose · accounts MarginfiAccountCloseInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of MarginfiAccountCloseInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1authorityPubkey
2fee_payerPubkey
3…remainingVec<AccountMeta>

MarginfiAccountCloseOrder#

From the program's IDL:

(user) Close an existing Order, returning rent to the user

Discriminator d4df4fb6acb7cded · data MarginfiAccountCloseOrder · accounts MarginfiAccountCloseOrderInstructionAccounts.

No data fields.

Required accounts: 5; extras go to remaining.

Fields of MarginfiAccountCloseOrderInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1authorityPubkey
2orderPubkey
3fee_recipientPubkey
4system_programPubkey
5…remainingVec<AccountMeta>

MarginfiAccountEndExecuteOrder#

From the program's IDL:

(permissionless keeper) End Order execution

  • Closes the Order (keeper keeps the rent)
  • Closes the borrow position involved in the Order, the lending position remains open
  • User health must be "unchanged" (within Order requirements i.e. minus slippage). Keeper

may keep any slippage in excess of what was needed to complete the Order as profit.

  • StartExecuteOrder must appear earlier in the tx
  • Must appear last in the tx
  • CPI is forbidden
  • Returns rent for ephemeral accounts created during StartExecuteOrder

Discriminator 732a145d7954b253 · data MarginfiAccountEndExecuteOrder · accounts MarginfiAccountEndExecuteOrderInstructionAccounts.

No data fields.

Required accounts: 7; extras go to remaining.

Fields of MarginfiAccountEndExecuteOrderInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2executorPubkey
3fee_recipientPubkey
4orderPubkey
5execute_recordPubkey
6fee_statePubkey
7…remainingVec<AccountMeta>

MarginfiAccountInitialize#

From the program's IDL:

Initialize a marginfi account for a given group. The account is a fresh keypair, and must sign. If you are a CPI caller, consider using marginfi_account_initialize_pda instead, or create the account manually and use transfer_to_new_account to gift it to the owner you wish.

Discriminator 2b4e3dff9434f99a · data MarginfiAccountInitialize · accounts MarginfiAccountInitializeInstructionAccounts.

No data fields.

Required accounts: 5; extras go to remaining.

Fields of MarginfiAccountInitializeInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3fee_payerPubkey
4system_programPubkey
5…remainingVec<AccountMeta>

MarginfiAccountInitializePda#

From the program's IDL:

The same as marginfi_account_initialize, except the created marginfi account uses a PDA (Program Derived Address) seeds:

  • marginfi_group
  • authority: The account authority (owner)
  • account_index: A u16 value to allow multiple accounts per authority
  • third_party_id: Optional u16 for third-party tagging. Seeds <
    PDA_FREE_THRESHOLD can be

used freely. For a dedicated seed used by just your program (via CPI), contact us.

Discriminator 57b15b50da77f51f · data MarginfiAccountInitializePda · accounts MarginfiAccountInitializePdaInstructionAccounts.

FieldType
account_indexu16
third_party_idOption<u16>

Required accounts: 6; extras go to remaining.

Fields of MarginfiAccountInitializePdaInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3fee_payerPubkey
4instructions_sysvarPubkey
5system_programPubkey
6…remainingVec<AccountMeta>

MarginfiAccountInitLiqRecord#

From the program's IDL:

(permissionless) Initialize a liquidation record PDA for a marginfi account.
The fee_payer pays rent; the record is required for receivership liquidation.

Discriminator ecd5ee7e93fba408 · data MarginfiAccountInitLiqRecord · accounts MarginfiAccountInitLiqRecordInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of MarginfiAccountInitLiqRecordInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1fee_payerPubkey
2liquidation_recordPubkey
3system_programPubkey
4…remainingVec<AccountMeta>

MarginfiAccountKeeperCloseOrder#

From the program's IDL:

(permissionless keeper) Close an existing Order after the user account was closed, or it no longer has the associated positions, or the user has executed marginfi_account_set_keeper_close_flags. Keeper keeps the rent.

Discriminator 8072472ec247ba6a · data MarginfiAccountKeeperCloseOrder · accounts MarginfiAccountKeeperCloseOrderInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of MarginfiAccountKeeperCloseOrderInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1fee_recipientPubkey
2orderPubkey
3…remainingVec<AccountMeta>

MarginfiAccountPlaceOrder#

From the program's IDL:

(user) Create a new Order.

  • bank_keys - Currently only two keys: the lending position and borrowing position in the

users's Balances for which the order is being placed

  • trigger - the type of order (stop loss, take profit, or both), and the threshold at which

to trigger the order, in dollars

Discriminator f4704b8a8f6c07ba · data MarginfiAccountPlaceOrder · accounts MarginfiAccountPlaceOrderInstructionAccounts.

FieldType
bank_keysVec<Pubkey>
triggerOrderTrigger

Required accounts: 8; extras go to remaining.

Fields of MarginfiAccountPlaceOrderInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2fee_payerPubkey
3authorityPubkey
4orderPubkey
5fee_statePubkey
6global_fee_walletPubkey
7system_programPubkey
8…remainingVec<AccountMeta>

MarginfiAccountSetFreeze#

From the program's IDL:

(admin only) Freeze or unfreeze a marginfi account. Frozen accounts can only be operated on by the group admin.

Discriminator c7b3e71e8af76ee3 · data MarginfiAccountSetFreeze · accounts MarginfiAccountSetFreezeInstructionAccounts.

FieldType
frozenbool

Required accounts: 3; extras go to remaining.

Fields of MarginfiAccountSetFreezeInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2adminPubkey
3…remainingVec<AccountMeta>

MarginfiAccountSetKeeperCloseFlags#

From the program's IDL:

(user) Purge flags from some balances, enabling a Keeper to call marginfi_account_keeper_close_order on associated Orders. Typically, use marginfi_account_close_order instead if trying to close an Order.

Discriminator 52a3a5ded4ff21d2 · data MarginfiAccountSetKeeperCloseFlags · accounts MarginfiAccountSetKeeperCloseFlagsInstructionAccounts.

FieldType
bank_keys_optOption<Vec<Pubkey>>

Required accounts: 2; extras go to remaining.

Fields of MarginfiAccountSetKeeperCloseFlagsInstructionAccounts, in account order:

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

MarginfiAccountStartExecuteOrder#

From the program's IDL:

(permissionless keeper) Begin Order execution

  • Enables the Keeper to withdraw/repay associated positions until the end of the tx
  • Only one StartExecuteOrder is allowed per tx
  • Must appear before EndExecuteOrder in the tx, and before any instructions except certain

allowed ones (compute budget, kamino refresh, etc)

  • EndExecuteOrder must also appear in the tx
  • CPI is forbidden
  • Costs a small amount of rent, which is returned at the end of the tx, make sure you have

enough SOL to start the tx.

Discriminator 01468c86b71dd0e0 · data MarginfiAccountStartExecuteOrder · accounts MarginfiAccountStartExecuteOrderInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of MarginfiAccountStartExecuteOrderInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2fee_payerPubkey
3executorPubkey
4orderPubkey
5execute_recordPubkey
6instruction_sysvarPubkey
7system_programPubkey
8…remainingVec<AccountMeta>

MarginfiAccountUpdateEmissionsDestinationAccount#

From the program's IDL:

(account authority) Set the wallet whose canonical ATA will receive off-chain emissions.

Discriminator 49b9a2c96f1874b9 · data MarginfiAccountUpdateEmissionsDestinationAccount · accounts MarginfiAccountUpdateEmissionsDestinationAccountInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of MarginfiAccountUpdateEmissionsDestinationAccountInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1authorityPubkey
2destination_accountPubkey
3…remainingVec<AccountMeta>

MarginfiGroupConfigure#

From the program's IDL:

(admin only) Configure group admin keys and emode leverage caps. All admin keys must be provided on every call. Emode leverage caps are set if provided, otherwise the existing (non-zero) values are kept. Pass Some(value) to update, None to leave unchanged.

Discriminator 3ec7514e210dec3d · data MarginfiGroupConfigure · accounts MarginfiGroupConfigureInstructionAccounts.

FieldType
new_adminOption<Pubkey>
new_emode_adminOption<Pubkey>
new_curve_adminOption<Pubkey>
new_limit_adminOption<Pubkey>
new_flow_adminOption<Pubkey>
new_emissions_adminOption<Pubkey>
new_metadata_adminOption<Pubkey>
new_risk_adminOption<Pubkey>
emode_max_init_leverageOption<WrappedI80F48>
emode_max_maint_leverageOption<WrappedI80F48>

Required accounts: 2; extras go to remaining.

Fields of MarginfiGroupConfigureInstructionAccounts, in account order:

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

MarginfiGroupInitialize#

From the program's IDL:

(admin only) Initialize a new marginfi group. The signer becomes the group admin.

Discriminator ff43431a5e1f2214 · data MarginfiGroupInitialize · accounts MarginfiGroupInitializeInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of MarginfiGroupInitializeInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1adminPubkey
2fee_statePubkey
3system_programPubkey
4…remainingVec<AccountMeta>

MigrateCurve#

From the program's IDL:

(Permissionless) Convert a bank from the legacy curve setup to the new setup, with no effect on how interest accrues.

Discriminator 97fe320d70eb9848 · data MigrateCurve · accounts MigrateCurveInstructionAccounts.

No data fields.

Required accounts: 1; extras go to remaining.

Fields of MigrateCurveInstructionAccounts, in account order:

#FieldType
0bankPubkey
1…remainingVec<AccountMeta>

PanicPause#

From the program's IDL:

(global_fee_admin only) Pause the protocol. Auto-expires after 30 minutes.
Limited to 3 pauses per day and 2 consecutive pauses.

Discriminator 4ca47b19042b4fa5 · data PanicPause · accounts PanicPauseInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of PanicPauseInstructionAccounts, in account order:

#FieldType
0global_fee_adminPubkey
1fee_statePubkey
2…remainingVec<AccountMeta>

PanicUnpause#

From the program's IDL:

(global_fee_admin only) Unpause the protocol before the auto-expiry.

Discriminator ec6bc2f263337980 · data PanicUnpause · accounts PanicUnpauseInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of PanicUnpauseInstructionAccounts, in account order:

#FieldType
0global_fee_adminPubkey
1fee_statePubkey
2…remainingVec<AccountMeta>

PanicUnpausePermissionless#

From the program's IDL:

(permissionless) Unpause the protocol when pause time has expired

Discriminator f58b329fd53e5bf8 · data PanicUnpausePermissionless · accounts PanicUnpausePermissionlessInstructionAccounts.

No data fields.

Required accounts: 1; extras go to remaining.

Fields of PanicUnpausePermissionlessInstructionAccounts, in account order:

#FieldType
0fee_statePubkey
1…remainingVec<AccountMeta>

PropagateFeeState#

From the program's IDL:

(Permissionless) Force any group to adopt the current FeeState settings

Discriminator 4003a6c28115659b · data PropagateFeeState · accounts PropagateFeeStateInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of PropagateFeeStateInstructionAccounts, in account order:

#FieldType
0fee_statePubkey
1marginfi_groupPubkey
2…remainingVec<AccountMeta>

PropagateStakedSettings#

From the program's IDL:

(permissionless) Propagate updated staked settings to a staked collateral bank.

Discriminator d21e98458263deaa · data PropagateStakedSettings · accounts PropagateStakedSettingsInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of PropagateStakedSettingsInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1staked_settingsPubkey
2bankPubkey
3…remainingVec<AccountMeta>

PurgeDeleverageBalance#

From the program's IDL:

(risk admin only) Purge a user's lending balance without withdrawing anything. Only usable after all the debt has been settled on a bank in deleveraging mode, e.g. when TOKENLESS_REPAYMENTS_ALLOWED and TOKENLESS_REPAYMENTS_COMPLETE. used to purge remaining lending assets in a now-worthless bank before it is fully sunset.

Discriminator 84bb1995b53bfd88 · data PurgeDeleverageBalance · accounts PurgeDeleverageBalanceInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of PurgeDeleverageBalanceInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2risk_adminPubkey
3bankPubkey
4…remainingVec<AccountMeta>

SolendDeposit#

From the program's IDL:

(user) Deposit into a Solend reserve through a marginfi account

  • amount - in the underlying token (e.g., USDC), in native decimals

Discriminator 387fb0940c190318 · data SolendDeposit · accounts SolendDepositInstructionAccounts.

FieldType
amountu64

Required accounts: 20; extras go to remaining.

Fields of SolendDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4signer_token_accountPubkey
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7integration_acc2Pubkey
8lending_marketPubkey
9lending_market_authorityPubkey
10integration_acc1Pubkey
11mintPubkey
12reserve_liquidity_supplyPubkey
13reserve_collateral_mintPubkey
14reserve_collateral_supplyPubkey
15user_collateralPubkey
16pyth_pricePubkey
17switchboard_feedPubkey
18solend_programPubkey
19token_programPubkey
20…remainingVec<AccountMeta>

SolendInitObligation#

From the program's IDL:

(permissionless) Initialize a Solend obligation for a marginfi bank
Requires a minimum deposit to ensure the obligation remains active

  • amount - minimum deposit amount (at least 10 units) in native decimals

Discriminator 51607b95da74ebc4 · data SolendInitObligation · accounts SolendInitObligationInstructionAccounts.

FieldType
amountu64

Required accounts: 20; extras go to remaining.

Fields of SolendInitObligationInstructionAccounts, in account order:

#FieldType
0fee_payerPubkey
1bankPubkey
2signer_token_accountPubkey
3liquidity_vault_authorityPubkey
4liquidity_vaultPubkey
5integration_acc2Pubkey
6lending_marketPubkey
7lending_market_authorityPubkey
8integration_acc1Pubkey
9mintPubkey
10reserve_liquidity_supplyPubkey
11reserve_collateral_mintPubkey
12reserve_collateral_supplyPubkey
13user_collateralPubkey
14pyth_pricePubkey
15switchboard_feedPubkey
16solend_programPubkey
17token_programPubkey
18rentPubkey
19system_programPubkey
20…remainingVec<AccountMeta>

SolendWithdraw#

From the program's IDL:

(user) Withdraw from a Solend reserve through a marginfi account

  • amount - in collateral tokens (cTokens), in native decimals
  • withdraw_all - withdraw entire position if true

Discriminator ee90aac715489b24 · data SolendWithdraw · accounts SolendWithdrawInstructionAccounts.

FieldType
amountu64
withdraw_allOption<bool>

Required accounts: 18; extras go to remaining.

Fields of SolendWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1marginfi_accountPubkey
2authorityPubkey
3bankPubkey
4destination_token_accountPubkey
5liquidity_vault_authorityPubkey
6liquidity_vaultPubkey
7integration_acc2Pubkey
8lending_marketPubkey
9lending_market_authorityPubkey
10integration_acc1Pubkey
11mintPubkey
12reserve_liquidity_supplyPubkey
13reserve_collateral_mintPubkey
14reserve_collateral_supplyPubkey
15user_collateralPubkey
16solend_programPubkey
17token_programPubkey
18…remainingVec<AccountMeta>

StartDeleverage#

From the program's IDL:

(risk_admin only) Begin forced deleverage on an account. Similar to start_liquidation but does not require the account to be unhealthy.

Discriminator 0a8a0a3928e8b6c1 · data StartDeleverage · accounts StartDeleverageInstructionAccounts.

No data fields.

Required accounts: 5; extras go to remaining.

Fields of StartDeleverageInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1liquidation_recordPubkey
2groupPubkey
3risk_adminPubkey
4instruction_sysvarPubkey
5…remainingVec<AccountMeta>

StartLiquidation#

From the program's IDL:

(permissionless) Begin receivership liquidation on an unhealthy account.
Snapshots health and marks the account in receivership. Must have end_liquidation as the last ix in the tx.

Discriminator f45d5ad6c0a6bf15 · data StartLiquidation · accounts StartLiquidationInstructionAccounts.

No data fields.

Required accounts: 4; extras go to remaining.

Fields of StartLiquidationInstructionAccounts, in account order:

#FieldType
0marginfi_accountPubkey
1liquidation_recordPubkey
2liquidation_receiverPubkey
3instruction_sysvarPubkey
4…remainingVec<AccountMeta>

SuperAdminDeposit#

From the program's IDL:

(primary admin only) Deposit directly into a bank liquidity vault and raise asset_share_value proportionally. No marginfi account is involved.

Discriminator f1bdc711cfe1404b · data SuperAdminDeposit · accounts SuperAdminDepositInstructionAccounts.

FieldType
amountu64

Required accounts: 6; extras go to remaining.

Fields of SuperAdminDepositInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3admin_token_accountPubkey
4liquidity_vaultPubkey
5token_programPubkey
6…remainingVec<AccountMeta>

SuperAdminWithdraw#

From the program's IDL:

(primary admin only) Withdraw directly from a bank liquidity vault and lower asset_share_value proportionally. No marginfi account is involved.

Discriminator ca43557e688a4fc5 · data SuperAdminWithdraw · accounts SuperAdminWithdrawInstructionAccounts.

FieldType
amountu64

Required accounts: 7; extras go to remaining.

Fields of SuperAdminWithdrawInstructionAccounts, in account order:

#FieldType
0groupPubkey
1adminPubkey
2bankPubkey
3destination_token_accountPubkey
4liquidity_vault_authorityPubkey
5liquidity_vaultPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

TransferToNewAccount#

From the program's IDL:

(account authority) Transfer all positions to a new account under a new authority. The old account is disabled. Pays a flat SOL fee to the protocol.

Discriminator 1c4f81e7a9454541 · data TransferToNewAccount · accounts TransferToNewAccountInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of TransferToNewAccountInstructionAccounts, in account order:

#FieldType
0groupPubkey
1old_marginfi_accountPubkey
2new_marginfi_accountPubkey
3authorityPubkey
4fee_payerPubkey
5new_authorityPubkey
6global_fee_walletPubkey
7system_programPubkey
8…remainingVec<AccountMeta>

TransferToNewAccountPda#

From the program's IDL:

(account authority) Same as transfer_to_new_account except the resulting account is a PDA seeds:

  • marginfi_group
  • authority: The account authority (owner)
  • account_index: A u16 value to allow multiple accounts per authority
  • third_party_id: Optional u16 for third-party tagging. Seeds <
    PDA_FREE_THRESHOLD can be

used freely. For a dedicated seed used by just your program (via CPI), contact us.

Discriminator acd2e0dc92d4fd31 · data TransferToNewAccountPda · accounts TransferToNewAccountPdaInstructionAccounts.

FieldType
account_indexu16
third_party_idOption<u16>

Required accounts: 9; extras go to remaining.

Fields of TransferToNewAccountPdaInstructionAccounts, in account order:

#FieldType
0groupPubkey
1old_marginfi_accountPubkey
2new_marginfi_accountPubkey
3authorityPubkey
4fee_payerPubkey
5new_authorityPubkey
6global_fee_walletPubkey
7instructions_sysvarPubkey
8system_programPubkey
9…remainingVec<AccountMeta>

UpdateDeleverageWithdrawals#

From the program's IDL:

(delegate_flow_admin only) Update the deleverage daily withdraw outflow with aggregated data. The delegate flow admin aggregates DeleverageWithdrawFlowEvent events off-chain and calls this instruction at intervals.

Discriminator 3803b5761bf7cfe3 · data UpdateDeleverageWithdrawals · accounts UpdateDeleverageWithdrawalsInstructionAccounts.

FieldType
outflow_usdu32
update_sequ64
event_start_slotu64
event_end_slotu64

Required accounts: 2; extras go to remaining.

Fields of UpdateDeleverageWithdrawalsInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1delegate_flow_adminPubkey
2…remainingVec<AccountMeta>

UpdateGroupRateLimiter#

From the program's IDL:

(delegate_flow_admin only) Update the group rate limiter with aggregated inflow/outflow. The delegate flow admin aggregates RateLimitFlowEvent events off-chain, converts to USD, and calls this instruction at intervals to update group rate limiter state.

Discriminator 174e3c8bbb2c8125 · data UpdateGroupRateLimiter · accounts UpdateGroupRateLimiterInstructionAccounts.

FieldType
outflow_usdOption<u64>
inflow_usdOption<u64>
update_sequ64
event_start_slotu64
event_end_slotu64

Required accounts: 2; extras go to remaining.

Fields of UpdateGroupRateLimiterInstructionAccounts, in account order:

#FieldType
0marginfi_groupPubkey
1delegate_flow_adminPubkey
2…remainingVec<AccountMeta>

WriteBankMetadata#

From the program's IDL:

(metadata admin only) Write ticker/description information for a bank on-chain. Optional, not all Banks are guaranteed to have metadata.

Discriminator 934e5185818ae93b · data WriteBankMetadata · accounts WriteBankMetadataInstructionAccounts.

FieldType
tickerOption<Vec<u8>>
descriptionOption<Vec<u8>>

Required accounts: 4; extras go to remaining.

Fields of WriteBankMetadataInstructionAccounts, in account order:

#FieldType
0groupPubkey
1bankPubkey
2metadata_adminPubkey
3metadataPubkey
4…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 MarginfiV2Account. Each wraps a boxed struct from carbon_marginfi_v2_decoder::accounts::<module>. decode_account only considers accounts owned by PROGRAM_ID and returns the first variant that matches.

Bank#

Discriminator 8e31a6f2324261bc · accounts::bank::Bank.

FieldTypeDescription
mintPubkeyThe SPL token mint this bank manages
mint_decimalsu8Number of decimals of the mint. Must be < 24.
groupPubkeyThe MarginfiGroup this bank belongs to
_pad0[u8; 7]
asset_share_valueWrappedI80F48Monotonically increases as interest rate accumulates. For typical banks, a user's asset value in token = (number of shares the user has * asset_share_value). * A float (arbitrary decimals) * Initially 1
liability_share_valueWrappedI80F48Monotonically increases as interest rate accumulates. For typical banks, a user's liabilty value in token = (number of shares the user has * liability_share_value) * A float (arbitrary decimals) * Initially 1
liquidity_vaultPubkeyThe SPL token account holding deposited liquidity
liquidity_vault_bumpu8PDA bump for the liquidity vault
liquidity_vault_authority_bumpu8PDA bump for the liquidity vault authority
insurance_vaultPubkeyThe SPL token account holding insurance fund tokens
insurance_vault_bumpu8PDA bump for the insurance vault
insurance_vault_authority_bumpu8PDA bump for the insurance vault authority
pad1[u8; 4]
collected_insurance_fees_outstandingWrappedI80F48Fees collected and pending withdraw for the insurance_vault
fee_vaultPubkeyThe SPL token account holding collected group fees
fee_vault_bumpu8PDA bump for the fee vault
fee_vault_authority_bumpu8PDA bump for the fee vault authority
pad2[u8; 6]
collected_group_fees_outstandingWrappedI80F48Fees collected and pending withdraw for the fee_vault
total_liability_sharesWrappedI80F48Sum of all liability shares held by all borrowers in this bank. Multiply by liability_share_value to get the total liability amount in native token units.
total_asset_sharesWrappedI80F48Sum of all asset shares held by all depositors in this bank. Multiply by asset_share_value to get the total asset amount in native token units. * For Kamino banks, this is the quantity of collateral tokens (NOT liquidity tokens) in the bank, and also uses mint_decimals, though the mint itself will always show (6) decimals exactly (i.e Kamino ignores this and treats it as if it was using mint_decimals)
last_updatei64Unix timestamp (i64) of the last interest accrual
configBankConfigThe bank's configuration parameters (weights, limits, oracle setup, interest rate config)
flagsu64Bank flags bitfield (u64). - Bit 0 (1): EMISSIONS_FLAG_BORROW_ACTIVE — borrow-side emissions are active - Bit 1 (2): EMISSIONS_FLAG_LENDING_ACTIVE — lending-side emissions are active - Bit 2 (4): PERMISSIONLESS_BAD_DEBT_SETTLEMENT_FLAG — anyone can settle bad debt - Bit 3 (8): FREEZE_SETTINGS — bank configuration is frozen (only limits can change) - Bit 4 (16): CLOSE_ENABLED_FLAG — bank can be closed (set at creation for banks >= 0.1.4) - Bit 5 (32): TOKENLESS_REPAYMENTS_ALLOWED — risk admin can repay debt without tokens - Bit 6 (64): TOKENLESS_REPAYMENTS_COMPLETE — all debt cleared, lender purge enabled
emissions_rateu64Emissions APR. Number of emitted tokens (emissions_mint) per 1e(bank.mint_decimal) tokens (bank mint) (native amount) per 1 YEAR.
emissions_remainingWrappedI80F48Remaining emissions tokens available for distribution
emissions_mintPubkeyThe SPL token mint used for emissions rewards
collected_program_fees_outstandingWrappedI80F48Fees collected and pending withdraw for the FeeState.global_fee_wallet's canonical ATA for mint
emodeEmodeSettingsControls this bank's emode configuration, which enables some banks to treat the assets of certain other banks more preferentially as collateral.
fees_destination_accountPubkeySet with update_fees_destination_account. Fees can be withdrawn to the canonical ATA of this wallet without the admin's input (withdraw_fees_permissionless). If pubkey default, the bank doesn't support this feature, and the fees must be collected manually (withdraw_fees).
cacheBankCacheCached bank metrics (interest rates, oracle price, etc.)
lending_position_counti32Number of user lending positions currently open in this bank * For banks created prior to 0.1.4, this is the number of positions opened/closed after 0.1.4 goes live, and may be negative. * For banks created in 0.1.4 or later, this is the number of positions open in total, and the bank may safely be closed if this is zero. Will never go negative.
borrowing_position_counti32Number of user borrowing positions currently open in this bank * For banks created prior to 0.1.4, this is the number of positions opened/closed after 0.1.4 goes live, and may be negative. * For banks created in 0.1.4 or later, this is the number of positions open in total, and the bank may safely be closed if this is zero. Will never go negative.
padding0[u8; 16]Reserved for future use
integration_acc1PubkeyIntegration account slot 1 (default Pubkey for non-integrations). - Kamino: reserve - Drift: spot market - Solend: reserve - JupLend: lending state
integration_acc2PubkeyIntegration account slot 2 (default Pubkey for non-integrations). - Kamino: obligation - Drift: user - Solend: obligation - JupLend: fToken vault
integration_acc3PubkeyIntegration account slot 3 (default Pubkey for non-integrations). - Drift: user stats - JupLend: withdraw intermediary ATA (ATA of liquidity_vault_authority for bank mint)
rate_limiterBankRateLimiterRate limiter for controlling withdraw/borrow outflow. Tracks net outflow (outflows - inflows) in native tokens.
pad0[u8; 16]
padding1[[u64; 2]; 7]

BankMetadata#

Discriminator 31cf1f2243e1a9ba · accounts::bank_metadata::BankMetadata.

FieldTypeDescription
bankPubkeyBank this metadata corresponds to
placeholderu64
ticker[u8; 64]The token's ticker name, e.g. USDC * utf-8
description[u8; 128]The token's plain english description, e.g US Dollar Coin * utf-8
data_blob[u8; 256]Reserved for future use. Room for a very small icon or something else cool
end_description_byteu16The last data byte in description (padding follows)
end_data_blobu16The last data byte in data_blob (padding follows)
end_ticker_byteu8The last data byte in ticker (padding follows)
bumpu8
pad0[u8; 2]

ExecuteOrderRecord#

Discriminator 06646b3ca4e23861 · accounts::execute_order_record::ExecuteOrderRecord.

FieldType
orderPubkey
executorPubkey
balance_states[ExecuteOrderBalanceRecord; 14]
active_balance_countu8
inactive_balance_countu8
reserved0[u8; 6]
order_start_healthWrappedI80F48

FeeState#

Discriminator 3fe01055c124ebdc · accounts::fee_state::FeeState.

FieldTypeDescription
keyPubkeyThe fee state's own key. A PDA derived from just b"feestate"
global_fee_adminPubkeyCan modify fees
global_fee_walletPubkeyThe base wallet for all protocol fees. All SOL fees go to this wallet. All non-SOL fees go to the cannonical ATA of this wallet for that asset.
placeholder0u64
bank_init_flat_sol_feeu32Flat fee assessed when a new bank is initialized, in lamports. * In SOL, in native decimals.
bump_seedu8
padding0[u8; 3]
liquidation_max_feeWrappedI80F48Liquidators can claim at this premium, when liquidating an asset in receivership liquidation, e.g. (1 + this) * amount repaid >= asset seized * A percentage
program_fee_fixedWrappedI80F48Fee collected by the program owner from all groups * A percentage
program_fee_rateWrappedI80F48Fee collected by the program owner from all groups * A percentage
panic_statePanicStateWhen the global admin pauses the protocol in the event of an emergency, information about the pause duration will be stored here and propagated to groups.
placeholder1u64
liquidation_flat_sol_feeu32Flat fee assessed for insurance/program use when a liquidation is executed * In SOL, in native decimals.
order_init_flat_sol_feeu32Flat fee assessed for preventing spam use when creating an order * In SOL, in native decimals.
order_execution_max_feeWrappedI80F48Take-profit Orders can be executed at this premium, which Keepers are allowed to keep (no pun intended) e.g. (1 + this) * amount repaid >= asset seized * A percentage
reserved1[u8; 32]

Lending#

Discriminator 87c75210f983b6f1 · accounts::lending::Lending.

FieldTypeDescription
mintPubkey
f_token_mintPubkey
lending_idu16
decimalsu8number of decimals for the fToken, same as underlying mint
rewards_rate_modelPubkeyPDA of rewards rate model (LRRM)
liquidity_exchange_priceu64exchange price in the liquidity layer (no rewards)
token_exchange_priceu64exchange price between fToken and underlying (with rewards)
last_update_timestampu64unix timestamp when exchange prices were updated last
token_reserves_liquidityPubkey
supply_position_on_liquidityPubkey
bumpu8

LiquidationRecord#

Discriminator 5f74178459d2f5a2 · accounts::liquidation_record::LiquidationRecord.

FieldTypeDescription
keyPubkeyThis account's own key. A PDA derived from marginfi_account
marginfi_accountPubkeyAccount this record tracks
record_payerPubkeyThe key that paid to create this account. At some point, we may allow this wallet to reclaim the rent paid to open a record.
liquidation_receiverPubkeyThe liquidator taking receivership of the marginfi_account to complete a liquidation. Pays the liquidation fee. * Always pubkey default unless actively within a liquidation event.
entries[LiquidationEntry; 4]Basic historical data for the last few liquidation events on this account
cacheLiquidationCache
reserved0[u8; 64]
reserved2[u8; 16]
reserved3[u8; 8]

MarginfiAccount#

Discriminator 43b2826d7e721c2a · accounts::marginfi_account::MarginfiAccount.

FieldTypeDescription
groupPubkey
authorityPubkey
lending_accountLendingAccount
account_flagsu64The flags that indicate the state of the account. This is u64 bitfield, where each bit represents a flag. Flags:MarginfiAccount - 1: ACCOUNT_DISABLED - Indicates that the account is disabled and no further actions can be taken on it. - 2: ACCOUNT_IN_FLASHLOAN - Only set when an account is within a flash loan, e.g. when start_flashloan is called, then unset when the flashloan ends. - 4: ACCOUNT_FLAG_DEPRECATED - Deprecated, available for future use - 8: ACCOUNT_TRANSFER_AUTHORITY_DEPRECATED - the admin has flagged with account to be moved, original owner can now call set_account_transfer_authority - 16: ACCOUNT_IN_RECEIVERSHIP - the account is eligible to be liquidated and has entered receivership, a liquidator is able to control borrows and withdraws until the end of the tx. This flag will only appear within a tx. - 32: ACCOUNT_IN_DELEVERAGE - the account is being deleveraged by the risk admin - 64: ACCOUNT_FROZEN` - the admin has frozen the account; only the group admin may perform actions until unfrozen.
emissions_destination_accountPubkeyWallet whose canonical ATA receives off-chain emissions distributions.
health_cacheHealthCache
migrated_fromPubkeyIf this account was migrated from another one, store the original account key
migrated_toPubkeyIf this account has been migrated to another one, store the destination account key
last_updateu64Unix timestamp (u64) of the last account interaction. Note: Bank.last_update uses i64.
account_indexu16If a PDA-based account, the account index, a seed used to derive the PDA that can be chosen arbitrarily (0.1.5 or later). Otherwise, does nothing.
third_party_indexu16If a PDA-based account (0.1.5 or later), a "vendor specific" id. Values < PDA_FREE_THRESHOLD can be used by anyone with no restrictions. Values >= PDA_FREE_THRESHOLD can only be used by a particular program via CPI. These values require being added to a list, contact us for more details. For legacy non-pda accounts, does nothing. Note: use a unique seed to tag accounts related to some particular program or campaign so you can easily fetch them all later.
bumpu8This account's bump, if a PDA-based account (0.1.5 or later). Otherwise, does nothing.
pad0[u8; 3]
liquidation_recordPubkeyStores information related to liquidations made against this account. A pda of this account's key, and "liq_record" * Typically pubkey default if this account has never been liquidated or close to liquidation * Opening this account is permissionless. Typically the liquidator pays, but e.g. we may also charge the user if they are opening a risky position on the front end.
padding0[u64; 7]

MarginfiGroup#

Discriminator b617adf097ceb643 · accounts::marginfi_group::MarginfiGroup.

FieldTypeDescription
adminPubkeyBroadly able to modify anything, and can set/remove other admins at will.
group_flagsu64Bitmask for group settings flags. * Bit 0 (1): PROGRAM_FEES_ENABLED — If set, program-level fees are enabled. * Bits 1-63: Reserved for future use.
fee_state_cacheFeeStateCacheCaches information from the global FeeState so the FeeState can be omitted on certain ixes
banksu16For groups initialized in versions 0.1.2 or greater, this is an authoritative count of the number of banks under this group. For groups initialized prior to 0.1.2, a non-authoritative count of the number of banks initiated after 0.1.2 went live.
pad0[u8; 6]
emode_adminPubkeyThis admin can configure collateral ratios above (but not below) the collateral ratio of certain banks, e.g. allow SOL to count as 90% collateral when borrowing an LST instead of the default rate.
delegate_curve_adminPubkeyCan modify the fields in config.interest_rate_config but nothing else, for every bank under this group
delegate_limit_adminPubkeyCan modify the deposit_limit, borrow_limit, total_asset_value_init_limit but nothing else, for every bank under this group
delegate_emissions_adminPubkeyCan modify the emissions flags, emissions_rate and emissions_mint, but nothing else, for every bank under this group
panic_state_cachePanicStateCacheWhen program keeper temporarily puts the program into panic mode, information about the duration of the lockup will be available here.
deleverage_withdraw_window_cacheWithdrawWindowCacheKeeps track of the liquidity withdrawn from the group over the day as a result of deleverages. Used as a protection mechanism against too big (and unwanted) withdrawals (e.g. when the risk admin is compromised).
risk_adminPubkeyCan run bankruptcy and forced deleverage ixes to e.g. sunset risky/illiquid assets
metadata_adminPubkeyCan modify a Bank's metadata, and nothing else.
emode_max_init_leverageu32Maximum leverage allowed for emode positions (initial margin), stored as u32 basis. Use u32_to_basis to convert to I80F48. Range: 1-100.
emode_max_maint_leverageu32Maximum leverage allowed for emode positions (maintenance margin), stored as u32 basis. Must be > emode_max_init_leverage. Range: 1-100.
padding[u8; 8]Reserved for future use
rate_limiterGroupRateLimiterRate limiter for controlling aggregate withdraw/borrow outflow across all banks. Tracks net outflow in USD.
rate_limiter_last_admin_update_slotu64Last slot covered by an admin group rate limiter aggregation update.
rate_limiter_last_admin_update_sequ64Monotonic sequence number for admin group rate limiter updates. This is used to enforce strict ordering and prevent duplicate/replayed batches when slot ranges overlap or multiple updates happen in the same slot.
deleverage_withdraw_last_admin_update_slotu64Last slot covered by an admin deleverage withdraw-limit aggregation update.
deleverage_withdraw_last_admin_update_sequ64Monotonic sequence number for admin deleverage withdraw-limit updates.
delegate_flow_adminPubkeyCan modify flow-control status for the group, i.e. update the withdraw caches with flow information from banks. Typically this is a hot wallet that lives in e.g. some cron job. If compromised, flow control can be effectively disabled until the admin is restored, which does not itself compromise any funds, and is merely annoying.
padding0[[u64; 2]; 2]
padding1[[u64; 2]; 32]

MinimalObligation#

Discriminator a8ce8d6a584caca7 · accounts::minimal_obligation::MinimalObligation.

FieldTypeDescription
tagu64
last_update_slotu64Kamino obligations are only good for one slot, e.g. refresh_obligation must have run within the same slot as any ix that needs a non-stale obligation e.g. withdraw.
last_update_staleu8True if the obligation is stale, which will cause various ixes like withdraw to fail. Typically set to true in any tx that modifies obligation balance, and set to false at the end of a successful refresh_obligation * 0 = false, 1 = true
last_update_price_statusu8Each bit represents a passed check in price status. * 63 = all checks passed Otherwise: * PRICE_LOADED = 0b_0000_0001; // 1 * PRICE_AGE_CHECKED = 0b_0000_0010; // 2 * TWAP_CHECKED = 0b_0000_0100; // 4 * TWAP_AGE_CHECKED = 0b_0000_1000; // 8 * HEURISTIC_CHECKED = 0b_0001_0000; // 16 * PRICE_USAGE_ALLOWED = 0b_0010_0000; // 32
last_update_placeholder[u8; 6]
lending_marketPubkey
ownerPubkeyFor mrgn banks, the bank's Liquidity Vault Authority (a pda which can be derived if the bank key is known)
deposits[MinimalObligationCollateral; 8]
lowest_reserve_deposit_liquidation_ltvu64
deposited_value_sf[u8; 16]
padding_part1[u8; 512]
padding_part2[u8; 512]
padding_part3[u8; 512]
padding_part4[u8; 512]
padding_part5a[u8; 64]
padding_part5c[u8; 24]

MinimalReserve#

Discriminator 2bf2ccca1af73b7f · accounts::minimal_reserve::MinimalReserve.

FieldTypeDescription
versionu64
slotu64Kamino reserves are only good for one slot, e.g. refresh_reserve must have run within the same slot as any ix that needs a non-stale reserve e.g. withdraw.
staleu8True if the reserve is stale, which will cause various ixes like withdraw to fail. Typically set to true in any tx that modifies reserve balance, and set to false at the end of a successful refresh_reserve * 0 = false, 1 = true
price_statusu8Each bit represents a passed check in price status. * 63 = all checks passed Otherwise: * PRICE_LOADED = 0b_0000_0001; // 1 * PRICE_AGE_CHECKED = 0b_0000_0010; // 2 * TWAP_CHECKED = 0b_0000_0100; // 4 * TWAP_AGE_CHECKED = 0b_0000_1000; // 8 * HEURISTIC_CHECKED = 0b_0001_0000; // 16 * PRICE_USAGE_ALLOWED = 0b_0010_0000; // 32
placeholder[u8; 6]
lending_marketPubkey
farm_collateralPubkey
farm_debtPubkey
mint_pubkeyPubkey
supply_vaultPubkey* A PDA
fee_vaultPubkey* A PDA
available_amountu64In simple terms: (amount in supply vault - outstanding borrows) * In token, with mint_decimals
borrowed_amount_sf[u8; 16]* In token, with mint_decimals * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
market_price_sf[u8; 16]* Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
market_price_last_updated_tsu64
mint_decimalsu64
deposit_limit_crossed_timestampu64
borrow_limit_crossed_timestampu64
cumulative_borrow_rate_bsf[u8; 48]
accumulated_protocol_fees_sf[u8; 16]* In token, with mint_decimals * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
accumulated_referrer_fees_sf[u8; 16]* In token, with mint_decimals * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
pending_referrer_fees_sf[u8; 16]* In token, with mint_decimals * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
absolute_referral_rate_sf[u8; 16]* In token, with mint_decimals * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino.
token_programPubkeyToken or Token22. If token22, note that Kamino does not support all Token22 extensions.
padding2_part1[u8; 256]
padding2_part2[u8; 128]
padding2_part3[u8; 24]
padding3[u8; 512]
padding_part1[u8; 512]
padding_part2[u8; 512]
padding_part3[u8; 128]
padding_part4[u8; 48]
collateral_mint_pubkeyPubkeyMints collateral tokens * A PDA * technically 6 decimals, but uses mint_decimals regardless for all purposes * authority = lending_market_authority
mint_total_supplyu64Total number of collateral tokens * uses mint_decimals, even though it's technically 6 decimals under the hood
collateral_supply_vaultPubkey* A PDA
padding1_reserve_collateral[u8; 512]
padding2_reserve_collateral[u8; 512]
padding4_part1[u8; 4096]
padding4_part2[u8; 512]
padding4_part3[u8; 256]
padding4_part4[u8; 64]
padding4_part5[u8; 32]
padding4_part6[u8; 8]

MinimalSpotMarket#

Discriminator 64b1086ba8414127 · accounts::minimal_spot_market::MinimalSpotMarket.

FieldTypeDescription
pubkeyPubkeyThe address of the spot market. It is a pda of the market index
oraclePubkeyThe oracle used to price the markets deposits/borrows
mintPubkeyThe token mint of the market
vaultPubkeyThe vault used to store the market's deposits
padding1[[u64; 4]; 9]
padding2[u8; 8]
deposit_balance[u8; 16]All the fields we need for testing (stored as raw bytes for simplicity)
borrow_balance[u8; 16]
cumulative_deposit_interest[u8; 16]
cumulative_borrow_interest[u8; 16]
padding3[u64; 9]
last_interest_tsu64Last time the cumulative deposit and borrow interest was updated Offset: 568 bytes from start of struct (including discriminator)
padding4[u64; 13]
decimalsu32
market_indexu16
padding5[u16; 24]
padding6[u8; 1]
pool_idu8
padding7[u64; 5]Padding to reach 776 bytes total (including discriminator)

MinimalUser#

Discriminator 9f755fe3ef973aec · accounts::minimal_user::MinimalUser.

FieldTypeDescription
authorityPubkeyThe owner/authority of the account
delegatePubkeyAn addresses that can control the account on the authority's behalf
name[u8; 32]Encoded display name for the account
spot_positions[SpotPosition; 8]The user's spot positions (8 positions)
padding1[u64; 256]Skip to the fields we need at the end
padding2[u64; 128]
padding3[u64; 64]
padding4[u64; 32]
padding5[u64; 8]
padding6[u64; 2]
padding7[u16; 1]
sub_account_idu16Sub account id for this user account
statusUserStatus
padding8[u8; 27]

Order#

Discriminator 86addfb94d561c33 · accounts::order::Order.

FieldTypeDescription
marginfi_accountPubkey
stop_lossWrappedI80F48
take_profitWrappedI80F48
placeholderu64Reserved for future use
max_slippageu32* a %, as u32, out of 100%, e.g. 50% = .5 * u32::MAX
pad0[u8; 4]
tags[u16; 2]Active tags (currently 2). Remaining capacity is stored in padding for layout compatibility. Padding byte ORDER_TAG_PADDING - 1 stores the tag count for forward compatibility. (u16 * 2 = 4 bytes)
pad1[u8; 4]
tags_padding[u8; 32]
triggerOrderTriggerTypeStop Loss (0), Take Profit (1), or Both (2)
bumpu8Bump to derive this pda
pad2[u8; 6]
reserved1[[u8; 32]; 4]

SolendMinimalReserve#

Discriminator 01 · accounts::solend_minimal_reserve::SolendMinimalReserve.

FieldTypeDescription
last_update_slotu64Last slot when supply and rates updated
last_update_staleu8True when marked stale
lending_marketPubkeyLending market address
liquidity_mint_pubkeyPubkey
liquidity_mint_decimalsu8
liquidity_supply_pubkeyPubkey
liquidity_pyth_oracle_pubkeyPubkey
liquidity_switchboard_oracle_pubkeyPubkey
liquidity_available_amountu64
liquidity_borrowed_amount_wads[u8; 16]
liquidity_cumulative_borrow_rate_wads[u8; 16]
liquidity_market_price[u8; 16]
collateral_mint_pubkeyPubkey
collateral_mint_total_supplyu64
collateral_supply_pubkeyPubkey
config_optimal_utilization_rateu8
config_loan_to_value_ratiou8
config_liquidation_bonusu8
config_liquidation_thresholdu8
padding_to_fees64[u8; 64]
padding_to_fees6[u8; 6]
liquidity_accumulated_protocol_fees_wads[u8; 16]
padding_final128[u8; 128]
padding_final64[u8; 64]
padding_final32[u8; 32]
padding_final6[u8; 6]

StakedSettings#

Discriminator 9d8c064d59adad7d · accounts::staked_settings::StakedSettings.

FieldTypeDescription
keyPubkeyThis account's own key. A PDA derived from marginfi_group and STAKED_SETTINGS_SEED
marginfi_groupPubkeyGroup for which these settings apply
oraclePubkeyGenerally, the Pyth push oracle for SOL
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
total_asset_value_init_limitu64
oracle_max_ageu16
risk_tierRiskTier
pad0[u8; 5]
reserved0[u8; 8]The following values are irrelevant because staked collateral positions do not support borrowing.
reserved1[u8; 32]
reserved2[u8; 64]

Events#

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

DeleverageEvent#

Discriminator a1086cccd1c60c1e · events::deleverage_event::DeleverageEventEvent.

FieldType
marginfi_accountPubkey
risk_adminPubkey
deleveragee_assets_seizedf64
deleveragee_liability_repaidf64

DeleverageWithdrawFlowEvent#

Discriminator 6d5a8bc80acc54b0 · events::deleverage_withdraw_flow_event::DeleverageWithdrawFlowEventEvent.

FieldTypeDescription
groupPubkey
bankPubkey
mintPubkey
outflow_usdu32Equity-denominated outflow value in USD, rounded to integer.
current_timestampi64Unix timestamp when the flow was recorded

EditStakedSettingsEvent#

Discriminator 1d3a9bbf4bdc91ce · events::edit_staked_settings_event::EditStakedSettingsEventEvent.

FieldType
groupPubkey
settingsStakedSettingsEditConfig

HealthPulseEvent#

Discriminator b79fda6e3ddc4101 · events::health_pulse_event::HealthPulseEventEvent.

FieldType
accountPubkey
health_cacheHealthCache

KeeperCloseOrderEvent#

Discriminator 2e980bae5c9d4d40 · events::keeper_close_order_event::KeeperCloseOrderEventEvent.

FieldType
headerAccountEventHeader
orderPubkey

LendingAccountBorrowEvent#

Discriminator df60510a9c631a3b · events::lending_account_borrow_event::LendingAccountBorrowEventEvent.

FieldType
headerAccountEventHeader
bankPubkey
mintPubkey
amountu64

LendingAccountDepositEvent#

Discriminator a136edd969f87a97 · events::lending_account_deposit_event::LendingAccountDepositEventEvent.

FieldType
headerAccountEventHeader
bankPubkey
mintPubkey
amountu64

LendingAccountLiquidateEvent#

Discriminator a6a0f99ab72717f2 · events::lending_account_liquidate_event::LendingAccountLiquidateEventEvent.

FieldType
headerAccountEventHeader
liquidatee_marginfi_accountPubkey
liquidatee_marginfi_account_authorityPubkey
asset_bankPubkey
asset_mintPubkey
liability_bankPubkey
liability_mintPubkey
liquidatee_pre_healthf64
liquidatee_post_healthf64
pre_balancesLiquidationBalances
post_balancesLiquidationBalances

LendingAccountRepayEvent#

Discriminator 10dc376f07501019 · events::lending_account_repay_event::LendingAccountRepayEventEvent.

FieldType
headerAccountEventHeader
bankPubkey
mintPubkey
amountu64
close_balancebool

LendingAccountWithdrawEvent#

Discriminator 03dc94f321f93658 · events::lending_account_withdraw_event::LendingAccountWithdrawEventEvent.

FieldType
headerAccountEventHeader
bankPubkey
mintPubkey
amountu64
close_balancebool

LendingPoolBankAccrueInterestEvent#

Discriminator 6875bb9c6f9a6aba · events::lending_pool_bank_accrue_interest_event::LendingPoolBankAccrueInterestEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey
deltau64
fees_collectedf64
insurance_collectedf64

LendingPoolBankCollectFeesEvent#

Discriminator 657761faa9af9cfd · events::lending_pool_bank_collect_fees_event::LendingPoolBankCollectFeesEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey
group_fees_collectedf64
group_fees_outstandingf64
insurance_fees_collectedf64
insurance_fees_outstandingf64

LendingPoolBankConfigureEvent#

Discriminator f623e96e5d98eb28 · events::lending_pool_bank_configure_event::LendingPoolBankConfigureEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey
configBankConfigOpt

LendingPoolBankConfigureFrozenEvent#

Discriminator 180a371231969db3 · events::lending_pool_bank_configure_frozen_event::LendingPoolBankConfigureFrozenEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey
deposit_limitu64
borrow_limitu64

LendingPoolBankConfigureOracleEvent#

Discriminator 778c6efd9640d23e · events::lending_pool_bank_configure_oracle_event::LendingPoolBankConfigureOracleEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
oracle_setupu8
oraclePubkey

LendingPoolBankCreateEvent#

Discriminator ecdcc93fef7e88f9 · events::lending_pool_bank_create_event::LendingPoolBankCreateEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey

LendingPoolBankHandleBankruptcyEvent#

Discriminator a64d298c245e0a39 · events::lending_pool_bank_handle_bankruptcy_event::LendingPoolBankHandleBankruptcyEventEvent.

FieldType
headerAccountEventHeader
bankPubkey
mintPubkey
bad_debtf64
covered_amountf64
socialized_amountf64

LendingPoolBankSetFixedOraclePriceEvent#

Discriminator 41480855e5145a1a · events::lending_pool_bank_set_fixed_oracle_price_event::LendingPoolBankSetFixedOraclePriceEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
priceWrappedI80F48

LendingPoolSuperAdminDepositEvent#

Discriminator 6398d31e3aa5d247 · events::lending_pool_super_admin_deposit_event::LendingPoolSuperAdminDepositEventEvent.

FieldTypeDescription
headerGroupEventHeader
bankPubkey
mintPubkey
transfer_amountu64Amount requested in SPL transfer instruction.
vault_inflow_amountu64Assumed vault inflow. Token-2022 transfer fees are not handled by this instruction path.

LendingPoolSuperAdminWithdrawEvent#

Discriminator 6ba8e8b590a1fc25 · events::lending_pool_super_admin_withdraw_event::LendingPoolSuperAdminWithdrawEventEvent.

FieldType
headerGroupEventHeader
bankPubkey
mintPubkey
vault_outflow_amountu64

LiquidationReceiverEvent#

Discriminator 2883e0dc975318e6 · events::liquidation_receiver_event::LiquidationReceiverEventEvent.

FieldType
marginfi_accountPubkey
liquidation_receiverPubkey
liquidatee_assets_seizedf64
liquidatee_liability_repaidf64
lamps_fee_paidu32

MarginfiAccountCloseOrderEvent#

Discriminator 9e227a621792e5d4 · events::marginfi_account_close_order_event::MarginfiAccountCloseOrderEventEvent.

FieldType
headerAccountEventHeader
orderPubkey

MarginfiAccountCreateEvent#

Discriminator b70575687ac74433 · events::marginfi_account_create_event::MarginfiAccountCreateEventEvent.

FieldType
headerAccountEventHeader

MarginfiAccountFreezeEvent#

Discriminator dbdb39b24b56927a · events::marginfi_account_freeze_event::MarginfiAccountFreezeEventEvent.

FieldType
headerAccountEventHeader
frozenbool

MarginfiAccountPlaceOrderEvent#

Discriminator 01694f1c8ef26391 · events::marginfi_account_place_order_event::MarginfiAccountPlaceOrderEventEvent.

FieldType
headerAccountEventHeader
orderPubkey
triggerOrderTriggerType
stop_lossWrappedI80F48
take_profitWrappedI80F48
tags[u16; 2]

MarginfiAccountTransferToNewAccount#

Discriminator 3b69ab6edf885059 · events::marginfi_account_transfer_to_new_account::MarginfiAccountTransferToNewAccountEvent.

FieldType
headerAccountEventHeader
old_accountPubkey
old_account_authorityPubkey
new_account_authorityPubkey

MarginfiGroupConfigureEvent#

Discriminator f168aca729c3c7aa · events::marginfi_group_configure_event::MarginfiGroupConfigureEventEvent.

FieldType
headerGroupEventHeader
adminOption<Pubkey>
flagsu64

MarginfiGroupCreateEvent#

Discriminator e97d3d0e62f088fd · events::marginfi_group_create_event::MarginfiGroupCreateEventEvent.

FieldType
headerGroupEventHeader

RateLimitFlowEvent#

Discriminator e50549c8006b696d · events::rate_limit_flow_event::RateLimitFlowEventEvent.

FieldTypeDescription
groupPubkey
bankPubkey
mintPubkey
flow_directionu80 = outflow (withdraw/borrow), 1 = inflow (deposit/repay)
native_amountu64Amount in native tokens
mint_decimalsu8
current_timestampi64Unix timestamp when the flow was recorded

SetKeeperCloseFlagsEvent#

Discriminator c1e65d8075576015 · events::set_keeper_close_flags_event::SetKeeperCloseFlagsEventEvent.

FieldType
headerAccountEventHeader
bank_keysOption<Vec<Pubkey>>

Types#

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

AccountEventHeader#

Struct types::AccountEventHeader.

FieldType
signerOption<Pubkey>
marginfi_accountPubkey
marginfi_account_authorityPubkey
marginfi_groupPubkey

Balance#

Struct types::Balance.

FieldTypeDescription
activeu8Whether this balance slot is in use (nonzero = active)
bank_pkPubkeyThe bank this balance corresponds to
bank_asset_tagu8Inherited from the bank when the position is first created and CANNOT BE CHANGED after that. Note that all balances created before the addition of this feature use ASSET_TAG_DEFAULT
tagu16Tag used by orders to reference this balance (0 means unused/unassigned). A tag may also have a non-zero value while having no orders.
pad0[u8; 4]
asset_sharesWrappedI80F48The user's asset (deposit) shares in the bank. Multiply by bank.asset_share_value for the token amount.
liability_sharesWrappedI80F48The user's liability (borrow) shares in the bank. Multiply by bank.liability_share_value for the token amount.
emissions_outstandingWrappedI80F48Unclaimed emissions rewards for this position
last_updateu64Unix timestamp (u64) of the last emissions calculation for this position
padding[u64; 1]Reserved for future use

BankCache#

From the program's IDL:

A read-only cache of the bank's key metrics, e.g. spot interest/fee rates.

Struct types::BankCache.

FieldTypeDescription
base_rateu32Actual (spot) interest/fee rates of the bank, based on utilization * APR (annual percentage rate) values * From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc
lending_rateu32Equivalent to base_rate * utilization * From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc
borrowing_rateu32Equivalent to base_rate * (1 + ir_fees) + fixed_fees * From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc
interest_accumulated_foru32* in seconds
accumulated_since_last_updateWrappedI80F48equivalent to (share value increase in the last interest_accumulated_for seconds * shares), i.e. the delta in asset_share_value, in token. * Note: if the tx that triggered this cache update increased or decreased the net shares, this value still reports using the PRE-CHANGE share amount, since interest is always earned on that amount. * in token, in native decimals, as I80F48
last_oracle_priceWrappedI80F48Oracle price used in the last instruction that consumed an oracle price * Only updated when instruction uses an oracle price, not updated for operations that don't require prices (e.g., deposit, repay) * Price in USD, with no price bias * Zero if never updated
last_oracle_price_timestampi64Unix timestamp (seconds) when last_oracle_price was last updated * Used to determine staleness of cached price * Zero if never updated
last_oracle_price_confidenceWrappedI80F48Confidence interval reported by the oracle when last_oracle_price was fetched * Always non-negative * Zero if never updated * Note: this value is the confidence reported by oracles, multiplied by STD_DEV_MULTIPLE
liq_cache_flagsu8Liquidation cache flags, set during receivership flow. * 1 (LIQ_CACHE_LOCKED_FLAG) - We "lock" the liquidation cache when writing to it in Start Liquidate as an additional safeguard, if the liquidation prices stored here were to be edited between start and end, it would completely break the risk engine. End validates that the lock is set, panics if not, and removes it - which prevents footguns if the cache was e.g. accidently set to default. The lock is also removed when a Balance is closed via withdraw_all, repay_all, or close_balance, but only when the account has ACCOUNT_IN_RECEIVERSHIP set, so that operations on unrelated accounts sharing the same bank do not interfere with an in-progress liquidation.
padding[u8; 23]
liquidation_price_rtWrappedI80F48Cached real-time price for receivership liquidation.
liquidation_price_rt_confidenceWrappedI80F48Cached real-time price confidence for receivership liquidation.
liquidation_price_twapWrappedI80F48Cached TWAP price for receivership liquidation.
liquidation_price_twap_confidenceWrappedI80F48Cached TWAP price confidence for receivership liquidation.

BankConfig#

Struct types::BankConfig.

FieldTypeDescription
asset_weight_initWrappedI80F48Discount factor for asset values in initial margin calculation (0 to 1). E.g., 0.8 means assets count as 80% of their value for borrowing purposes.
asset_weight_maintWrappedI80F48Discount factor for asset values in maintenance margin calculation (0 to 2). Used for liquidation eligibility. Generally >= asset_weight_init.
liability_weight_initWrappedI80F48Premium factor for liability values in initial margin calculation (>= 1). E.g., 1.2 means liabilities count as 120% of their value for borrowing purposes.
liability_weight_maintWrappedI80F48Premium factor for liability values in maintenance margin calculation (>= 1). Used for liquidation eligibility. Generally <= liability_weight_init.
deposit_limitu64Maximum total deposits allowed in this bank, in native token units (0 = no limit)
interest_rate_configInterestRateConfigInterest rate model configuration
operational_stateBankOperationalStateCurrent operational state of the bank (Paused, Operational, ReduceOnly, KilledByBankruptcy)
oracle_setupOracleSetupOracle type used for price feeds
oracle_keys[Pubkey; 5]Oracle account keys (usage depends on oracle_setup type)
pad0[u8; 6]
borrow_limitu64Maximum total borrows allowed in this bank, in native token units (0 = no limit)
risk_tierRiskTierRisk tier for this bank (Collateral or Isolated)
asset_tagu8Determines what kinds of assets users of this bank can interact with. Options: * ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset or with ASSET_TAG_SOL * ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with either ASSET_TAG_DEFAULT or ASSET_TAG_STAKED positions, but not both * ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit other STAKED assets or SOL (ASSET_TAG_SOL) and can only borrow SOL * ASSET_TAG_KAMINO (3) - Treated the same as ASSET_TAG_DEFAULT * ASSET_TAG_DRIFT (4) - Treated the same as ASSET_TAG_DEFAULT * ASSET_TAG_SOLEND (5) - Treated the same as ASSET_TAG_DEFAULT
config_flagsu8Flags for various config options * 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new pyth oracle setup from a prior version. Not set in 0.1.3 or earlier banks using pyth that have not yet migrated. Does nothing for banks that use switchboard. * 2, 4, 8, 16, etc - reserved for future use.
pad1[u8; 5]
total_asset_value_init_limitu64USD denominated limit for calculating asset value for initialization margin requirements. Example, if total SOL deposits are equal to $1M and the limit it set to $500K, then SOL assets will be discounted by 50%. In other words the max value of liabilities that can be backed by the asset is $500K. This is useful for limiting the damage of oracle attacks. Value is UI USD value, for example value 100 -> $100
oracle_max_ageu16Time window in seconds for the oracle price feed to be considered live.
padding0[u8; 2]
oracle_max_confidenceu32From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note: the confidence adjustment is capped at 5% regardless of this value. * 0 falls back to using the default 10% instead, i.e., U32_MAX_DIV_10 * A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.
fixed_priceWrappedI80F48Stored oracle price for OracleSetup::Fixed, otherwise does nothing
padding1[u8; 16]

BankConfigCompact#

Struct types::BankConfigCompact.

FieldTypeDescription
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
liability_weight_initWrappedI80F48
liability_weight_maintWrappedI80F48
deposit_limitu64
interest_rate_configInterestRateConfigCompact
operational_stateBankOperationalState
borrow_limitu64
risk_tierRiskTier
asset_tagu8Determines what kinds of assets users of this bank can interact with. Options: * ASSET_TAG_DEFAULT (0) - A regular asset that can be comingled with any other regular asset or with ASSET_TAG_SOL * ASSET_TAG_SOL (1) - Accounts with a SOL position can comingle with either ASSET_TAG_DEFAULT or ASSET_TAG_STAKED positions, but not both * ASSET_TAG_STAKED (2) - Staked SOL assets. Accounts with a STAKED position can only deposit other STAKED assets or SOL (ASSET_TAG_SOL) and can only borrow SOL * ASSET_TAG_KAMINO (3) - Treated the same as ASSET_TAG_DEFAULT * ASSET_TAG_DRIFT (4) - Treated the same as ASSET_TAG_DEFAULT * ASSET_TAG_SOLEND (5) - Treated the same as ASSET_TAG_DEFAULT
config_flagsu8Flags for various config options * 1 - Always set if bank created in 0.1.4 or later, or if migrated to the new oracle setup from a prior version. Not set in 0.1.3 or earlier banks that have not yet migrated. * 2, 4, 8, 16, etc - reserved for future use.
pad0[u8; 5]
total_asset_value_init_limitu64USD denominated limit for calculating asset value for initialization margin requirements. Example, if total SOL deposits are equal to $1M and the limit it set to $500K, then SOL assets will be discounted by 50%. In other words the max value of liabilities that can be backed by the asset is $500K. This is useful for limiting the damage of oracle attacks. Value is UI USD value, for example value 100 -> $100
oracle_max_ageu16Time window in seconds for the oracle price feed to be considered live.
oracle_max_confidenceu32From 0-100%, if the confidence exceeds this value, the oracle is considered invalid. Note: the confidence adjustment is capped at 5% regardless of this value. * 0% = use the default (10%) * A %, as u32, e.g. 100% = u32::MAX, 50% = u32::MAX/2, etc.

BankConfigOpt#

Struct types::BankConfigOpt.

FieldType
asset_weight_initOption<WrappedI80F48>
asset_weight_maintOption<WrappedI80F48>
liability_weight_initOption<WrappedI80F48>
liability_weight_maintOption<WrappedI80F48>
deposit_limitOption<u64>
borrow_limitOption<u64>
operational_stateOption<BankOperationalState>
interest_rate_configOption<InterestRateConfigOpt>
risk_tierOption<RiskTier>
asset_tagOption<u8>
total_asset_value_init_limitOption<u64>
oracle_max_confidenceOption<u32>
oracle_max_ageOption<u16>
permissionless_bad_debt_settlementOption<bool>
freeze_settingsOption<bool>
tokenless_repayments_allowedOption<bool>

BankOperationalState#

Enum types::BankOperationalState.

Variant
Paused
Operational
ReduceOnly
KilledByBankruptcy

BankRateLimiter#

From the program's IDL:

Per-bank rate limiting configuration and state.
Tracks net outflow in native tokens.

Struct types::BankRateLimiter.

FieldTypeDescription
hourlyRateLimitWindowHourly window rate limiter (native tokens).
dailyRateLimitWindowDaily window rate limiter (native tokens).

DeleverageEvent#

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

DeleverageWithdrawFlowEvent#

From the program's IDL:

Emitted for deleverage-only withdraw outflows.
The delegate flow admin aggregates these off-chain and updates the deleverage daily withdraws via update_deleverage_withdrawals.

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

DriftConfigCompact#

From the program's IDL:

Used to configure Drift banks. A simplified version of BankConfigCompact which omits most values related to interest since Drift banks cannot earn interest or be borrowed against.

Struct types::DriftConfigCompact.

FieldTypeDescription
oraclePubkey
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
oracle_setupOracleSetupEither DriftPythPull or DriftSwitchboardPull
operational_stateBankOperationalStateBank operational state - allows starting banks in paused state
risk_tierRiskTierRisk tier - determines if assets can be borrowed in isolation
config_flagsu8Config flags for future-proofing
total_asset_value_init_limitu64
oracle_max_ageu16
oracle_max_confidenceu32Oracle confidence threshold (0 = use default 10%)

EditStakedSettingsEvent#

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

EmodeConfig#

From the program's IDL:

An emode configuration. Each bank has one such configuration, but this may also be the intersection of many configurations (see reconcile_emode_configs). For example, the risk engine creates such an intersection from all the emode config of all banks the user is borrowing from.

Struct types::EmodeConfig.

FieldType
entries[EmodeEntry; 10]

EmodeEntry#

Struct types::EmodeEntry.

FieldTypeDescription
collateral_bank_emode_tagu16emode_tag of the bank(s) whose collateral you wish to treat preferentially.
flagsu8* APPLIES_TO_ISOLATED (1) - (NOT YET IMPLEMENTED) if set, isolated banks with this tag also benefit. If not set, isolated banks continue to offer zero collateral, even if they use this tag. * 2, 4, 8, 16, 32, etc - reserved for future use
pad0[u8; 5]
asset_weight_initWrappedI80F48Note: If set below the collateral bank's weight, does nothing.
asset_weight_maintWrappedI80F48Note: If set below the collateral bank's weight, does nothing.

EmodeSettings#

From the program's IDL:

Controls the bank's e-mode configuration, allowing certain collateral sources to be treated more favorably as collateral when used to borrow from this bank.

Struct types::EmodeSettings.

FieldTypeDescription
emode_tagu16This bank's NON-unique id that other banks will use to determine what emode rate to use when this bank is offered as collateral. For example, all stablecoin banks might share the same emode_tag, and in their entries, each such stablecoin bank will recognize that collateral sources with this "stable" tag get preferential weights. When a new stablecoin is added that is considered riskier, it may get a new, less favorable emode tag, and eventually get upgraded to the same one as the other stables * 0 is in an invalid tag and will do nothing.
pad0[u8; 6]
timestampi64Unix timestamp from the system clock when emode state was last updated
flagsu64EMODE_ON (1) - If set, at least one entry is configured 2, 4, 8, etc, Reserved for future use
emode_configEmodeConfig

ExecuteOrderBalanceRecord#

Struct types::ExecuteOrderBalanceRecord.

FieldType
bankPubkey
is_assetu8
pad0[u8; 5]
tagu16
sharesWrappedI80F48

FeeStateCache#

From the program's IDL:

Cached fee configuration propagated from the global FeeState

Struct types::FeeStateCache.

FieldTypeDescription
global_fee_walletPubkeyThe wallet that receives program-level fees
program_fee_fixedWrappedI80F48Fixed fee APR charged to borrowers (program-level)
program_fee_rateWrappedI80F48Proportional fee rate on interest (program-level)
last_updatei64Unix timestamp of the last fee state propagation

GroupEventHeader#

Struct types::GroupEventHeader.

FieldType
signerOption<Pubkey>
marginfi_groupPubkey

GroupRateLimiter#

From the program's IDL:

Per-group rate limiting configuration and state.
Tracks aggregate net outflow in USD.

Struct types::GroupRateLimiter.

FieldTypeDescription
hourlyRateLimitWindowHourly window rate limiter (USD).
dailyRateLimitWindowDaily window rate limiter (USD).

HealthCache#

From the program's IDL:

A read-only cache of the internal risk engine's information. Only valid in borrow/withdraw if the tx does not fail. To see the state in any context, e.g. to figure out if the risk engine is failing due to some bad price information, use pulse_health.

Struct types::HealthCache.

FieldTypeDescription
asset_valueWrappedI80F48Internal risk engine asset value, using initial weight (e.g. what is used for borrowing purposes), with all confidence adjustments, and other discounts on price. * Uses EMA price * In dollars
liability_valueWrappedI80F48Internal risk engine liability value, using initial weight (e.g. what is used for borrowing purposes), with all confidence adjustments, and other discounts on price. * Uses EMA price * In dollars
asset_value_maintWrappedI80F48Internal risk engine asset value, using maintenance weight (e.g. what is used for liquidation purposes), with all confidence adjustments. * Zero if the risk engine failed to load * Uses SPOT price * In dollars
liability_value_maintWrappedI80F48Internal risk engine liability value, using maintenance weight (e.g. what is used for liquidation purposes), with all confidence adjustments. * Zero if the risk engine failed to load * Uses SPOT price * In dollars
asset_value_equityWrappedI80F48The "true" value of assets without any confidence or weight adjustments. Internally, used only for bankruptcies. * Zero if the risk engine failed to load * Uses EMA price * In dollars
liability_value_equityWrappedI80F48The "true" value of liabilities without any confidence or weight adjustments. Internally, used only for bankruptcies. * Zero if the risk engine failed to load * Uses EMA price * In dollars
timestampi64Unix timestamp from the system clock when this cache was last updated
flagsu32The flags that indicate the state of the health cache. This is a u32 bitfield, where each bit represents a flag. * HEALTHY = 1 - If set, the account cannot be liquidated. If 0, the account is unhealthy and can be liquidated. * ENGINE STATUS = 2 - If set, the engine did not error during the last health pulse. If 0, the engine would have errored and this cache is likely invalid. RiskEngineInitRejected is ignored and will allow the flag to be set anyways. * ORACLE OK = 4 - If set, the engine did not error due to an oracle issue. If 0, engine was passed a bad bank or oracle account, or an oracle was stale. Check the order in which accounts were passed and ensure each balance has the correct banks/oracles, and that oracle cranks ran recently enough. Check internal_err and err_index for more details in some circumstances. Invalid if generated after borrow/withdraw (these instructions will ignore oracle issues if health is still satisfactory with some balance zeroed out). * 8, 16, 32, 64, 128, etc - reserved for future use
mrgn_erru32If the engine errored, look here for the error code. If the engine returns ok, you may also check here to see if the risk engine rejected this tx (3009).
prices[[u8; 8]; 16]Each price corresponds to that index of Balances in the LendingAccount. Useful for debugging or liquidator consumption, to determine how a user's position is priced internally. * An f64 stored as bytes
internal_erru32Errors in asset oracles are ignored (with prices treated as zero). If you see a zero price and the ORACLE_OK flag is not set, check here to see what error was ignored internally.
err_indexu8Index in balances where internal_err appeared
program_versionu8Since 0.1.3, the version will be encoded here. See PROGRAM_VERSION.
pad0[u8; 2]
internal_liq_erru32Error code from the liquidation health check during the last health pulse (0 if none)
internal_bankruptcy_erru32Error code from the bankruptcy check during the last health pulse (0 if none)
reserved0[u8; 32]
reserved1[u8; 16]

HealthPulseEvent#

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

InterestRateConfig#

Struct types::InterestRateConfig.

FieldTypeDescription
optimal_utilization_rateWrappedI80F48
plateau_interest_rateWrappedI80F48
max_interest_rateWrappedI80F48
insurance_fee_fixed_aprWrappedI80F48Goes to insurance, funds collected_insurance_fees_outstanding
insurance_ir_feeWrappedI80F48Goes to insurance, funds collected_insurance_fees_outstanding
protocol_fixed_fee_aprWrappedI80F48Earned by the group, goes to collected_group_fees_outstanding
protocol_ir_feeWrappedI80F48Earned by the group, goes to collected_group_fees_outstanding
protocol_origination_feeWrappedI80F48
zero_util_rateu32The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
hundred_util_rateu32The base rate at utilization = 100 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
points[RatePoint; 5]The base rate at various points between 0 and 100%, exclusive. Essentially a piece-wise linear curve. * always in ascending order, e.g. points[0] = first kink point, points[1] = second kink point, and so forth. * points where util = 0 are unused
curve_typeu8Determines which interest rate curve implementation is active. 0 (INTEREST_CURVE_LEGACY) = legacy three point curve, 1 (INTEREST_CURVE_SEVEN_POINT) = multi-point curve.
pad0[u8; 7]
padding1[u8; 32]
padding2[u8; 16]
padding3[u8; 8]

InterestRateConfigCompact#

Struct types::InterestRateConfigCompact.

FieldTypeDescription
insurance_fee_fixed_aprWrappedI80F48
insurance_ir_feeWrappedI80F48
protocol_fixed_fee_aprWrappedI80F48
protocol_ir_feeWrappedI80F48
protocol_origination_feeWrappedI80F48
zero_util_rateu32The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
hundred_util_rateu32The base rate at utilization = 100 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
points[RatePoint; 5]The base rate at various points between 0 and 100%, exclusive. Essentially a piece-wise linear curve. * always in ascending order, e.g. points[0] = first kink point, points[1] = second kink point, and so forth. * points where util = 0 are unused

InterestRateConfigOpt#

Struct types::InterestRateConfigOpt.

FieldTypeDescription
insurance_fee_fixed_aprOption<WrappedI80F48>
insurance_ir_feeOption<WrappedI80F48>
protocol_fixed_fee_aprOption<WrappedI80F48>
protocol_ir_feeOption<WrappedI80F48>
protocol_origination_feeOption<WrappedI80F48>
zero_util_rateOption<u32>The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
hundred_util_rateOption<u32>The base rate at utilization = 100 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX
pointsOption<[RatePoint; 5]>The base rate at various points between 0 and 100%, exclusive. Essentially a piece-wise linear curve. * always in ascending order, e.g. points[0] = first kink point, points[1] = second kink point, and so forth. * points where util = 0 are unused

JuplendConfigCompact#

From the program's IDL:

Used to configure JupLend banks. A simplified version of BankConfigCompact which omits most values related to interest since JupLend banks cannot earn interest or be borrowed against. Note: JupLend banks do not take an
Operational State, they always start in Paused state and are set to Operational via juplend_init_position (seed deposit + protocol fToken vault).

Struct types::JuplendConfigCompact.

FieldTypeDescription
oraclePubkey
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
oracle_setupOracleSetupEither JuplendPythPull or JuplendSwitchboardPull
risk_tierRiskTierIsolated or Collateral
config_flagsu8Config flags for future-proofing, currently ignored
total_asset_value_init_limitu64In $
oracle_max_ageu16In seconds
oracle_max_confidenceu32Oracle confidence threshold (0 = use default 10%)

KaminoConfigCompact#

From the program's IDL:

Used to configure Kamino banks. A simplified version of BankConfigCompact which omits most values related to interest since Kamino banks cannot earn interest or be borrowed against.

Struct types::KaminoConfigCompact.

FieldTypeDescription
oraclePubkey
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
oracle_setupOracleSetupEither KaminoPythPush or KaminoSwitchboardPull
operational_stateBankOperationalStateBank operational state - allows starting banks in paused state
risk_tierRiskTierRisk tier - determines if assets can be borrowed in isolation
config_flagsu8Config flags for future-proofing
total_asset_value_init_limitu64
oracle_max_ageu16Currently unused: Kamino's oracle age applies to kamino banks.
oracle_max_confidenceu32Oracle confidence threshold (0 = use default 10%)

KeeperCloseOrderEvent#

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

LendingAccount#

From the program's IDL:

The lending account holds up to 16 balance positions for a user.

Struct types::LendingAccount.

FieldTypeDescription
balances[Balance; 16]Array of balance positions (max 16). Sorted in descending order by bank_pk.
last_tag_usedu16Last allocated balance tag (u16), used to find the next unused tag.
pad1[u8; 6]Reserved for future use
padding[u64; 7]Reserved for future use

LendingAccountBorrowEvent#

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

LendingAccountDepositEvent#

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

LendingAccountLiquidateEvent#

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

LendingAccountRepayEvent#

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

LendingAccountWithdrawEvent#

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

LendingPoolBankAccrueInterestEvent#

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

LendingPoolBankCollectFeesEvent#

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

LendingPoolBankConfigureEvent#

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

LendingPoolBankConfigureFrozenEvent#

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

LendingPoolBankConfigureOracleEvent#

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

LendingPoolBankCreateEvent#

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

LendingPoolBankHandleBankruptcyEvent#

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

LendingPoolBankSetFixedOraclePriceEvent#

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

LendingPoolSuperAdminDepositEvent#

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

LendingPoolSuperAdminWithdrawEvent#

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

LiquidationBalances#

Struct types::LiquidationBalances.

FieldType
liquidatee_asset_balancef64
liquidatee_liability_balancef64
liquidator_asset_balancef64
liquidator_liability_balancef64

LiquidationCache#

Struct types::LiquidationCache.

FieldTypeDescription
asset_value_maintWrappedI80F48Internal risk engine asset value snapshot taken when liquidation begins, using maintenance weight with all confidence adjustments. * Uses SPOT price * In dollars
liability_value_maintWrappedI80F48Internal risk engine liability value snapshot taken when liquidation begins, using maintenance weight with all confidence adjustments. * Uses SPOT price * In dollars
asset_value_equityWrappedI80F48Actual cash value of assets pre-liquidation (inclusive of price adjustment for oracle confidence, but without any weights) * Liquidator is allowed to seize up to liability_value_equity - this amount * Uses EMA price * In dollars
liability_value_equityWrappedI80F48Actual cash value of liabilities pre-liquidation (inclusive of price adjustment for oracle confidence, but without any weights) * Liquidator is allowed to seize up to this amount - asset_value_equity * Uses EMA price * In dollars
placeholderu64
reserved0[u8; 32]

LiquidationEntry#

From the program's IDL:

Used to record key details of the last few liquidation events on the account

Struct types::LiquidationEntry.

FieldTypeDescription
asset_amount_seized[u8; 8]Dollar amount seized * An f64 stored as bytes
liab_amount_repaid[u8; 8]Dollar amount repaid * An f64 stored as bytes
placeholder0u64
timestampi64
reserved0[u8; 16]

LiquidationReceiverEvent#

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

MarginfiAccountCloseOrderEvent#

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

MarginfiAccountCreateEvent#

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

MarginfiAccountFreezeEvent#

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

MarginfiAccountPlaceOrderEvent#

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

MarginfiAccountTransferToNewAccount#

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

MarginfiGroupConfigureEvent#

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

MarginfiGroupCreateEvent#

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

MinimalObligationCollateral#

Struct types::MinimalObligationCollateral.

FieldTypeDescription
deposit_reservePubkey
deposited_amountu64In collateral token (NOT liquidity token), use collateral_to_liquidity to convert back to liquidity token! * Always 6 decimals
market_value_sf[u8; 16]* In dollars, based on last oracle price update * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. * A float (arbitrary decimals)
borrowed_amount_against_this_collateral_in_elevation_groupu64
padding[u64; 9]

OracleSetup#

Enum types::OracleSetup.

Variant
None
PythLegacy
SwitchboardV2
PythPushOracle
SwitchboardPull
StakedWithPythPush
KaminoPythPush
KaminoSwitchboardPull
Fixed
DriftPythPull
DriftSwitchboardPull
SolendPythPull
SolendSwitchboardPull
FixedKamino
FixedDrift
JuplendPythPull
JuplendSwitchboardPull
FixedJuplend

OrderTrigger#

Enum types::OrderTrigger.

VariantFields
StopLossthreshold: WrappedI80F48, max_slippage: u32
TakeProfitthreshold: WrappedI80F48, max_slippage: u32
Bothstop_loss: WrappedI80F48, take_profit: WrappedI80F48, max_slippage: u32

OrderTriggerType#

Enum types::OrderTriggerType.

Variant
StopLoss
TakeProfit
Both

PanicState#

From the program's IDL:

Panic state for emergency protocol pausing

Struct types::PanicState.

FieldTypeDescription
pause_flagsu8Whether the protocol is currently paused (1 = paused, 0 = not paused)
daily_pause_countu8Number of times paused today (resets every 24 hours)
consecutive_pause_countu8Number of consecutive pauses (resets when unpause happens)
reserved[u8; 5]
pause_start_timestampi64Timestamp when the current pause started (0 if not paused) * When a pause is extended before expiring, this could be in the future.
last_daily_reset_timestampi64Timestamp of the last daily reset (for tracking daily pause count)
reserved_space[u8; 8]Reserved for future use (making total struct 32 bytes)

PanicStateCache#

From the program's IDL:

Cached panic state information for fast checking during user operations

Struct types::PanicStateCache.

FieldTypeDescription
pause_flagsu8Whether the protocol is currently paused (1 = paused, 0 = not paused)
reserved[u8; 7]
pause_start_timestampi64Timestamp when the current pause started (0 if not paused)
last_cache_updatei64Timestamp when this cache was last updated

RateLimitFlowEvent#

From the program's IDL:

Emitted when a bank-level inflow or outflow is recorded.
The delegate flow admin aggregates these off-chain and updates the group rate limiter via update_group_rate_limiter.

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

RateLimitWindow#

From the program's IDL:

A sliding window rate limiter that tracks net outflow over a time window.
Uses weighted blend of previous and current windows for smooth transitions.
Net outflow = (withdraws + borrows) - (deposits + repays).
A negative net outflow increases remaining capacity for subsequent outflows.

Struct types::RateLimitWindow.

FieldTypeDescription
max_outflowu64Maximum net outflow allowed per window (0 = disabled). For bank-level: denominated in native tokens. For group-level: denominated in USD.
window_durationu64Window duration in seconds (e.g., 3600 for hourly, 86400 for daily).
window_starti64Unix timestamp when the current window started.
prev_window_outflowi64Net outflow accumulated in the previous window. Signed to allow tracking when inflows exceed outflows.
cur_window_outflowi64Net outflow accumulated in the current window. Signed to allow tracking when inflows exceed outflows.

RatePoint#

Struct types::RatePoint.

FieldTypeDescription
utilu32The utilization rate where rate applies * a %, as u32, out of 100%, e.g. 50% = .5 * u32::MAX
rateu32The base rate that applies * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX

RiskTier#

Enum types::RiskTier.

Variant
Collateral
Isolated

SetKeeperCloseFlagsEvent#

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

SolendConfigCompact#

From the program's IDL:

Used to configure Solend banks. A simplified version of BankConfigCompact which omits most values related to interest since Solend banks cannot earn interest or be borrowed against.

Struct types::SolendConfigCompact.

FieldTypeDescription
oraclePubkey
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
oracle_setupOracleSetupEither SolendPythPull or SolendSwitchboardPull
operational_stateBankOperationalStateBank operational state - allows starting banks in paused state
risk_tierRiskTierRisk tier - determines if assets can be borrowed in isolation
config_flagsu8Config flags for future-proofing
total_asset_value_init_limitu64
oracle_max_ageu16
oracle_max_confidenceu32Oracle confidence threshold (0 = use default 10%)

SpotBalanceType#

Enum types::SpotBalanceType.

Variant
Deposit
Borrow

SpotPosition#

From the program's IDL:

Minimal representation of a spot position within a User account

Struct types::SpotPosition.

FieldTypeDescription
scaled_balanceu64The scaled balance of the position. * Precision: SPOT_BALANCE_PRECISION
open_bidsi64How many spot bids the user has open * Precision: token mint precision
open_asksi64How many spot asks the user has open * Precision: token mint precision
cumulative_depositsi64The cumulative deposits/borrows a user has made * Precision: token mint precision
market_indexu16The market index of the corresponding spot market
balance_typeSpotBalanceTypeWhether the position is deposit or borrow
open_ordersu8Number of open orders
padding[u8; 4]Padding

StakedSettingsConfig#

Struct types::StakedSettingsConfig.

FieldTypeDescription
oraclePubkey
asset_weight_initWrappedI80F48
asset_weight_maintWrappedI80F48
deposit_limitu64
total_asset_value_init_limitu64
oracle_max_ageu16
risk_tierRiskTierWARN: You almost certainly want "Collateral", using Isolated risk tier makes the asset worthless as collateral, and is generally useful only when creating a staked collateral pool for rewards purposes only.

StakedSettingsEditConfig#

Struct types::StakedSettingsEditConfig.

FieldTypeDescription
oracleOption<Pubkey>
asset_weight_initOption<WrappedI80F48>
asset_weight_maintOption<WrappedI80F48>
deposit_limitOption<u64>
total_asset_value_init_limitOption<u64>
oracle_max_ageOption<u16>
risk_tierOption<RiskTier>WARN: You almost certainly want "Collateral", using Isolated risk tier makes the asset worthless as collateral, making all outstanding accounts eligible to be liquidated, and is generally useful only when creating a staked collateral pool for rewards purposes only.

UserStatus#

Enum types::UserStatus.

Variant
Active
BeingLiquidated
Bankrupt
ReduceOnly
AdvancedLp
ProtectedMakerOrders

WithdrawWindowCache#

From the program's IDL:

Tracks deleverage withdrawal limits to protect against compromised risk admin

Struct types::WithdrawWindowCache.

FieldTypeDescription
daily_limitu32Maximum USD value that can be withdrawn per day via deleverage (0 = no limit)
withdrawn_todayu32USD value withdrawn today via deleverage (approximate, rounded)
last_daily_reset_timestampi64Unix timestamp of the last daily counter reset

WrappedI80F48#

Struct types::WrappedI80F48.

FieldType
value[u8; 16]

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.