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.
| Crate | carbon-marginfi-v2-decoder 2.0.0 |
| Install | cargo add carbon-marginfi-v2-decoder@2. |
| Program ID | MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA (carbon_) |
| Category | Lending |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Event enum | instructions:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-marginfi-v2-decoder/2.0.0 |
| Source | decoders/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:
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/fulluse {
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(())
}
}RUST_LOG=info cargo runEach 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:: (import instructions::); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_.
Decode accounts#
The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with programSubscribe on the public WebSocket endpoint and prints every decoded MarginfiAccount account as it changes. Add the datasource and the Solana RPC types it takes:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
carbon_core::{
account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_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(())
}
}RUST_LOG=info cargo runEach 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::, where data and accounts are the types listed under the variant, exported from carbon_. Discriminators are the leading bytes of the instruction data, in hex.
How an instruction decodes. The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:
- The instruction's program ID is
MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).
Accounts. They are matched by position, in the order listed. An account marked optional is None only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for Some(PROGRAM_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.
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.
| Field | Type |
|---|---|
enable_ | bool |
Required accounts: 3; extras go to remaining.
Fields of ConfigGroupFeeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | global_ | Pubkey |
| 2 | fee_state | Pubkey |
| 3… | remaining | Vec< |
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.
| Field | Type |
|---|---|
hourly_ | Option<u64> |
daily_ | Option<u64> |
Required accounts: 3; extras go to remaining.
Fields of ConfigureBankRateLimitsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
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.
| Field | Type |
|---|---|
limit | u32 |
Required accounts: 2; extras go to remaining.
Fields of ConfigureDeleverageWithdrawalLimitInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2… | remaining | Vec< |
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.
| Field | Type |
|---|---|
hourly_ | Option<u64> |
daily_ | Option<u64> |
Required accounts: 2; extras go to remaining.
Fields of ConfigureGroupRateLimitsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 17; extras go to remaining.
Fields of DriftDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | drift_ | Option< |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | signer_ | Pubkey |
| 8 | drift_state | Pubkey |
| 9 | integration_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | integration_ | Pubkey |
| 12 | drift_ | Pubkey |
| 13 | mint | Pubkey |
| 14 | drift_ | Pubkey |
| 15 | token_ | Pubkey |
| 16 | system_ | Pubkey |
| 17… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | bank | Pubkey |
| 1 | fee_state | Pubkey |
| 2 | liquidity_ | Pubkey |
| 3 | intermediary_ | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | drift_state | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | harvest_ | Pubkey |
| 9 | harvest_ | Pubkey |
| 10 | drift_ | Pubkey |
| 11 | reward_mint | Pubkey |
| 12 | drift_ | Pubkey |
| 13 | token_ | Pubkey |
| 14… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 16; extras go to remaining.
Fields of DriftInitUserInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | fee_payer | Pubkey |
| 1 | signer_ | Pubkey |
| 2 | bank | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | mint | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | drift_state | Pubkey |
| 9 | integration_ | Pubkey |
| 10 | drift_ | Pubkey |
| 11 | drift_ | Option< |
| 12 | drift_ | Pubkey |
| 13 | token_ | Pubkey |
| 14 | rent | Pubkey |
| 15 | system_ | Pubkey |
| 16… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
withdraw_ | Option< |
Required accounts: 24; extras go to remaining.
Fields of DriftWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | drift_ | Option< |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | destination_ | Pubkey |
| 8 | drift_state | Pubkey |
| 9 | integration_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | integration_ | Pubkey |
| 12 | drift_ | Pubkey |
| 13 | drift_ | Option< |
| 14 | drift_ | Option< |
| 15 | drift_ | Option< |
| 16 | drift_ | Option< |
| 17 | drift_ | Option< |
| 18 | drift_ | Option< |
| 19 | drift_ | Pubkey |
| 20 | mint | Pubkey |
| 21 | drift_ | Pubkey |
| 22 | token_ | Pubkey |
| 23 | system_ | Pubkey |
| 24… | remaining | Vec< |
EditGlobalFeeState#
From the program's IDL:
(global fee admin only) Adjust fees, admin, or the destination wallet
Discriminator 343e23815d45a5ca · data EditGlobalFeeState · accounts EditGlobalFeeStateInstructionAccounts.
| Field | Type |
|---|---|
admin | Pubkey |
fee_wallet | Pubkey |
bank_ | u32 |
liquidation_ | u32 |
order_ | u32 |
program_ | WrappedI80F48 |
program_ | WrappedI80F48 |
liquidation_ | WrappedI80F48 |
order_ | WrappedI80F48 |
Required accounts: 2; extras go to remaining.
Fields of EditGlobalFeeStateInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | fee_state | Pubkey |
| 2… | remaining | Vec< |
EditStakedSettings#
From the program's IDL:
(admin only) Edit the staked collateral settings for the group.
Discriminator 0b6cd757f00942f1 · data EditStakedSettings · accounts EditStakedSettingsInstructionAccounts.
| Field | Type |
|---|---|
settings | StakedSettingsEditConfig |
Required accounts: 3; extras go to remaining.
Fields of EditStakedSettingsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | staked_ | Pubkey |
| 3… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | liquidation_ | Pubkey |
| 2 | group | Pubkey |
| 3 | risk_admin | Pubkey |
| 4… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | liquidation_ | Pubkey |
| 2 | liquidation_ | Pubkey |
| 3 | fee_state | Pubkey |
| 4 | global_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | bank | Pubkey |
| 1 | fee_payer | Pubkey |
| 2 | metadata | Pubkey |
| 3 | system_ | Pubkey |
| 4… | remaining | Vec< |
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.
| Field | Type |
|---|---|
admin | Pubkey |
fee_wallet | Pubkey |
bank_ | u32 |
liquidation_ | u32 |
order_ | u32 |
program_ | WrappedI80F48 |
program_ | WrappedI80F48 |
liquidation_ | WrappedI80F48 |
order_ | WrappedI80F48 |
Required accounts: 3; extras go to remaining.
Fields of InitGlobalFeeStateInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | fee_state | Pubkey |
| 2 | system_ | Pubkey |
| 3… | remaining | Vec< |
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_. Running this ix effectively opts the group into the staked collateral feature.pool_ permissionless
Discriminator 3423952c45564550 · data InitStakedSettings · accounts InitStakedSettingsInstructionAccounts.
| Field | Type |
|---|---|
settings | StakedSettingsConfig |
Required accounts: 5; extras go to remaining.
Fields of InitStakedSettingsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | staked_ | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 23; extras go to remaining.
Fields of JuplendDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | signer_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | mint | Pubkey |
| 8 | integration_ | Pubkey |
| 9 | f_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | lending_ | Pubkey |
| 12 | supply_ | Pubkey |
| 13 | lending_ | Pubkey |
| 14 | rate_model | Pubkey |
| 15 | vault | Pubkey |
| 16 | liquidity | Pubkey |
| 17 | liquidity_ | Pubkey |
| 18 | rewards_ | Pubkey |
| 19 | juplend_ | Pubkey |
| 20 | token_ | Pubkey |
| 21 | associated_ | Pubkey |
| 22 | system_ | Pubkey |
| 23… | remaining | Vec< |
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 fromPausedtoOperational.
Discriminator b0ff976a05cf4ad7 · data JuplendInitPosition · accounts JuplendInitPositionInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 21; extras go to remaining.
Fields of JuplendInitPositionInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | fee_payer | Pubkey |
| 1 | signer_ | Pubkey |
| 2 | bank | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | mint | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | f_ | Pubkey |
| 8 | integration_ | Pubkey |
| 9 | lending_ | Pubkey |
| 10 | supply_ | Pubkey |
| 11 | lending_ | Pubkey |
| 12 | rate_model | Pubkey |
| 13 | vault | Pubkey |
| 14 | liquidity | Pubkey |
| 15 | liquidity_ | Pubkey |
| 16 | rewards_ | Pubkey |
| 17 | juplend_ | Pubkey |
| 18 | token_ | Pubkey |
| 19 | associated_ | Pubkey |
| 20 | system_ | Pubkey |
| 21… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
withdraw_ | Option< |
Required accounts: 24; extras go to remaining.
Fields of JuplendWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | mint | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | f_ | Pubkey |
| 9 | integration_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | lending_ | Pubkey |
| 12 | supply_ | Pubkey |
| 13 | lending_ | Pubkey |
| 14 | rate_model | Pubkey |
| 15 | vault | Pubkey |
| 16 | claim_ | Pubkey |
| 17 | liquidity | Pubkey |
| 18 | liquidity_ | Pubkey |
| 19 | rewards_ | Pubkey |
| 20 | juplend_ | Pubkey |
| 21 | token_ | Pubkey |
| 22 | associated_ | Pubkey |
| 23 | system_ | Pubkey |
| 24… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 22; extras go to remaining.
Fields of KaminoDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | signer_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | lending_ | Pubkey |
| 9 | lending_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | mint | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | reserve_ | Pubkey |
| 14 | reserve_ | Pubkey |
| 15 | obligation_ | Option< |
| 16 | reserve_ | Option< |
| 17 | kamino_ | Pubkey |
| 18 | farms_ | Pubkey |
| 19 | collateral_ | Pubkey |
| 20 | liquidity_ | Pubkey |
| 21 | instruction_ | Pubkey |
| 22… | remaining | Vec< |
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 of the reward token in the Kamino Farm's reward listindex
Discriminator a3caf88d6a147405 · data KaminoHarvestReward · accounts KaminoHarvestRewardInstructionAccounts.
| Field | Type |
|---|---|
reward_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of KaminoHarvestRewardInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | bank | Pubkey |
| 1 | fee_state | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | user_state | Pubkey |
| 5 | farm_state | Pubkey |
| 6 | global_ | Pubkey |
| 7 | reward_mint | Pubkey |
| 8 | user_ | Pubkey |
| 9 | rewards_ | Pubkey |
| 10 | rewards_ | Pubkey |
| 11 | farm_ | Pubkey |
| 12 | scope_ | Option< |
| 13 | farms_ | Pubkey |
| 14 | token_ | Pubkey |
| 15… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 27; extras go to remaining.
Fields of KaminoInitObligationInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | fee_payer | Pubkey |
| 1 | bank | Pubkey |
| 2 | signer_ | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | user_ | Pubkey |
| 7 | lending_ | Pubkey |
| 8 | lending_ | Pubkey |
| 9 | integration_ | Pubkey |
| 10 | mint | Pubkey |
| 11 | reserve_ | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | reserve_ | Pubkey |
| 14 | pyth_oracle | Option< |
| 15 | switchboard_ | Option< |
| 16 | switchboard_ | Option< |
| 17 | scope_ | Option< |
| 18 | obligation_ | Option< |
| 19 | reserve_ | Option< |
| 20 | kamino_ | Pubkey |
| 21 | farms_ | Pubkey |
| 22 | collateral_ | Pubkey |
| 23 | liquidity_ | Pubkey |
| 24 | instruction_ | Pubkey |
| 25 | rent | Pubkey |
| 26 | system_ | Pubkey |
| 27… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
withdraw_ | Option< |
Required accounts: 22; extras go to remaining.
Fields of KaminoWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | lending_ | Pubkey |
| 9 | lending_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | mint | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | reserve_ | Pubkey |
| 14 | reserve_ | Pubkey |
| 15 | obligation_ | Option< |
| 16 | reserve_ | Option< |
| 17 | kamino_ | Pubkey |
| 18 | farms_ | Pubkey |
| 19 | collateral_ | Pubkey |
| 20 | liquidity_ | Pubkey |
| 21 | instruction_ | Pubkey |
| 22… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 8; extras go to remaining.
Fields of LendingAccountBorrowInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | bank_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
LendingAccountClearEmissions#
From the program's IDL:
(permissionless) Zero out
emissions_on a balance after emissions are disabled on the bank.outstanding
Discriminator ef04dd622da7c9f4 · data LendingAccountClearEmissions · accounts LendingAccountClearEmissionsInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of LendingAccountClearEmissionsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | bank | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
deposit_ | Option< |
Required accounts: 7; extras go to remaining.
Fields of LendingAccountDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | signer_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2… | remaining | Vec< |
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 of collateral to liquidateamount liquidatee_- number of remaining accounts for the liquidateeaccounts liquidator_- number of remaining accounts for the liquidatoraccounts
Discriminator d6a997d5fba756db · data LendingAccountLiquidate · accounts LendingAccountLiquidateInstructionAccounts.
| Field | Type |
|---|---|
asset_ | u64 |
liquidatee_ | u8 |
liquidator_ | u8 |
Required accounts: 10; extras go to remaining.
Fields of LendingAccountLiquidateInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | asset_bank | Pubkey |
| 2 | liab_bank | Pubkey |
| 3 | liquidator_ | Pubkey |
| 4 | authority | Pubkey |
| 5 | liquidatee_ | Pubkey |
| 6 | bank_ | Pubkey |
| 7 | bank_ | Pubkey |
| 8 | bank_ | Pubkey |
| 9 | token_ | Pubkey |
| 10… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
repay_all | Option< |
Required accounts: 7; extras go to remaining.
Fields of LendingAccountRepayInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | signer_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
LendingAccountStartFlashloan#
From the program's IDL:
(account authority) Start a flash loan. Must have a corresponding
end_ix in the same tx. Health checks are skipped until the flash loan ends.flashloan
Discriminator 0e8321dc51bab46b · data LendingAccountStartFlashloan · accounts LendingAccountStartFlashloanInstructionAccounts.
| Field | Type |
|---|---|
end_index | u64 |
Required accounts: 3; extras go to remaining.
Fields of LendingAccountStartFlashloanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2 | ixs_sysvar | Pubkey |
| 3… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
withdraw_ | Option< |
Required accounts: 8; extras go to remaining.
Fields of LendingAccountWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | bank_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2… | remaining | Vec< |
LendingPoolAddBank#
From the program's IDL:
(admin only) Add a new bank to the lending pool
Discriminator d744484ed0da67b6 · data LendingPoolAddBank · accounts LendingPoolAddBankInstructionAccounts.
| Field | Type |
|---|---|
bank_config | BankConfigCompact |
Required accounts: 15; extras go to remaining.
Fields of LendingPoolAddBankInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | fee_state | Pubkey |
| 4 | global_ | Pubkey |
| 5 | bank_mint | Pubkey |
| 6 | bank | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | fee_vault | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
LendingPoolAddBankDrift#
From the program's IDL:
(group admin only) Add a Drift bank to the group.
Discriminator 3e3f31304c376c9b · data LendingPoolAddBankDrift · accounts LendingPoolAddBankDriftInstructionAccounts.
| Field | Type |
|---|---|
bank_config | DriftConfigCompact |
bank_seed | u64 |
Required accounts: 16; extras go to remaining.
Fields of LendingPoolAddBankDriftInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | bank | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | liquidity_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | insurance_ | Pubkey |
| 12 | fee_ | Pubkey |
| 13 | fee_vault | Pubkey |
| 14 | token_ | Pubkey |
| 15 | system_ | Pubkey |
| 16… | remaining | Vec< |
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)
- JupLend
Lendingstate
Discriminator 12d0755a356fc329 · data LendingPoolAddBankJuplend · accounts LendingPoolAddBankJuplendInstructionAccounts.
| Field | Type |
|---|---|
bank_config | JuplendConfigCompact |
bank_seed | u64 |
Required accounts: 16; extras go to remaining.
Fields of LendingPoolAddBankJuplendInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | bank | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | insurance_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | fee_ | Pubkey |
| 11 | fee_vault | Pubkey |
| 12 | f_ | Pubkey |
| 13 | integration_ | Pubkey |
| 14 | token_ | Pubkey |
| 15 | system_ | Pubkey |
| 16… | remaining | Vec< |
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.
| Field | Type |
|---|---|
bank_config | KaminoConfigCompact |
bank_seed | u64 |
Required accounts: 15; extras go to remaining.
Fields of LendingPoolAddBankKaminoInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | bank | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | fee_vault | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
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.
| Field | Type |
|---|---|
bank_seed | u64 |
Required accounts: 15; extras go to remaining.
Fields of LendingPoolAddBankPermissionlessInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | staked_ | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | sol_pool | Pubkey |
| 5 | stake_pool | Pubkey |
| 6 | bank | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | fee_vault | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
LendingPoolAddBankSolend#
From the program's IDL:
(admin) Add a Solend bank to the marginfi group
Discriminator 51e9cbc72fe20044 · data LendingPoolAddBankSolend · accounts LendingPoolAddBankSolendInstructionAccounts.
| Field | Type |
|---|---|
bank_config | SolendConfigCompact |
bank_seed | u64 |
Required accounts: 15; extras go to remaining.
Fields of LendingPoolAddBankSolendInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | bank | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | integration_ | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | fee_vault | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
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.
| Field | Type |
|---|---|
bank_config | BankConfigCompact |
bank_seed | u64 |
Required accounts: 15; extras go to remaining.
Fields of LendingPoolAddBankWithSeedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | fee_state | Pubkey |
| 4 | global_ | Pubkey |
| 5 | bank_mint | Pubkey |
| 6 | bank | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | liquidity_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | insurance_ | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | fee_vault | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
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.
| Field | Type |
|---|---|
bank_seed | u64 |
Required accounts: 14; extras go to remaining.
Fields of LendingPoolCloneBankInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | bank_mint | Pubkey |
| 4 | source_bank | Pubkey |
| 5 | bank | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | liquidity_ | Pubkey |
| 8 | insurance_ | Pubkey |
| 9 | insurance_ | Pubkey |
| 10 | fee_ | Pubkey |
| 11 | fee_vault | Pubkey |
| 12 | token_ | Pubkey |
| 13 | system_ | Pubkey |
| 14… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | signer | Pubkey |
| 2 | copy_ | Pubkey |
| 3 | copy_ | Pubkey |
| 4… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | admin | Pubkey |
| 3… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | liquidity_ | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | insurance_ | Pubkey |
| 5 | fee_vault | Pubkey |
| 6 | fee_state | Pubkey |
| 7 | fee_ata | Pubkey |
| 8 | token_ | Pubkey |
| 9… | remaining | Vec< |
LendingPoolConfigureBank#
From the program's IDL:
(admin only) Configure bank parameters. If the bank has
FREEZE_, only deposit/borrow limits are updated and all other config changes are silently ignored.SETTINGS
Discriminator 79ad9c285d9438ed · data LendingPoolConfigureBank · accounts LendingPoolConfigureBankInstructionAccounts.
| Field | Type |
|---|---|
bank_ | BankConfigOpt |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolConfigureBankInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
LendingPoolConfigureBankEmode#
From the program's IDL:
(emode_admin only)
Discriminator 11af5b39ef563147 · data LendingPoolConfigureBankEmode · accounts LendingPoolConfigureBankEmodeInstructionAccounts.
| Field | Type |
|---|---|
emode_tag | u16 |
entries | [EmodeEntry; 10] |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolConfigureBankEmodeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | emode_admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
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.
| Field | Type |
|---|---|
interest_ | InterestRateConfigOpt |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolConfigureBankInterestOnlyInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | delegate_ | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
LendingPoolConfigureBankLimitsOnly#
From the program's IDL:
(delegate_limit_admin only) Update deposit/borrow/init limits only.
Discriminator 9dc4ddc8ca3e5415 · data LendingPoolConfigureBankLimitsOnly · accounts LendingPoolConfigureBankLimitsOnlyInstructionAccounts.
| Field | Type |
|---|---|
deposit_ | Option<u64> |
borrow_ | Option<u64> |
total_ | Option<u64> |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolConfigureBankLimitsOnlyInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | delegate_ | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
LendingPoolConfigureBankOracle#
From the program's IDL:
(admin only)
Discriminator d152ffab7c154751 · data LendingPoolConfigureBankOracle · accounts LendingPoolConfigureBankOracleInstructionAccounts.
| Field | Type |
|---|---|
setup | u8 |
oracle | Pubkey |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolConfigureBankOracleInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | risk_admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
LendingPoolHandleBankruptcy#
From the program's IDL:
(risk_admin or admin, unless
PERMISSIONLESS_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.BAD_ DEBT_ SETTLEMENT_ FLAG
Discriminator a20b388b5a8046ad · data LendingPoolHandleBankruptcy · accounts LendingPoolHandleBankruptcyInstructionAccounts.
No data fields.
Required accounts: 8; extras go to remaining.
Fields of LendingPoolHandleBankruptcyInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | signer | Pubkey |
| 2 | bank | Pubkey |
| 3 | marginfi_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | insurance_ | Pubkey |
| 6 | insurance_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | emissions_ | Pubkey |
| 3 | emissions_ | Pubkey |
| 4 | emissions_ | Pubkey |
| 5 | fee_state | Pubkey |
| 6 | destination_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
LendingPoolSetFixedOraclePrice#
From the program's IDL:
(admin only)
Discriminator 1c7e7f7f3c25d37d · data LendingPoolSetFixedOraclePrice · accounts LendingPoolSetFixedOraclePriceInstructionAccounts.
| Field | Type |
|---|---|
price | WrappedI80F48 |
Required accounts: 3; extras go to remaining.
Fields of LendingPoolSetFixedOraclePriceInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | admin | Pubkey |
| 3 | destination_ | Pubkey |
| 4… | remaining | Vec< |
LendingPoolWithdrawFees#
From the program's IDL:
(admin only) Withdraw collected group fees from the fee vault.
Discriminator 5c8cd7feaa0053ae · data LendingPoolWithdrawFees · accounts LendingPoolWithdrawFeesInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 7; extras go to remaining.
Fields of LendingPoolWithdrawFeesInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | admin | Pubkey |
| 3 | fee_vault | Pubkey |
| 4 | fee_ | Pubkey |
| 5 | dst_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
LendingPoolWithdrawFeesPermissionless#
From the program's IDL:
(permissionless) Withdraw group fees to the pre-configured
fees_.destination_ account
Discriminator 39f501d082129171 · data LendingPoolWithdrawFeesPermissionless · accounts LendingPoolWithdrawFeesPermissionlessInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 6; extras go to remaining.
Fields of LendingPoolWithdrawFeesPermissionlessInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | fee_vault | Pubkey |
| 3 | fee_ | Pubkey |
| 4 | fees_ | Pubkey |
| 5 | token_ | Pubkey |
| 6… | remaining | Vec< |
LendingPoolWithdrawInsurance#
From the program's IDL:
(admin only) Withdraw from the insurance vault.
Discriminator 6c3c3cf6684f9ff3 · data LendingPoolWithdrawInsurance · accounts LendingPoolWithdrawInsuranceInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 7; extras go to remaining.
Fields of LendingPoolWithdrawInsuranceInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | admin | Pubkey |
| 3 | insurance_ | Pubkey |
| 4 | insurance_ | Pubkey |
| 5 | dst_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2 | fee_payer | Pubkey |
| 3… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2 | order | Pubkey |
| 3 | fee_ | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
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.
StartExecuteOrdermust 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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | executor | Pubkey |
| 3 | fee_ | Pubkey |
| 4 | order | Pubkey |
| 5 | execute_ | Pubkey |
| 6 | fee_state | Pubkey |
| 7… | remaining | Vec< |
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_instead, or create the account manually and useaccount_ initialize_ pda transfer_to gift it to the owner you wish.to_ new_ account
Discriminator 2b4e3dff9434f99a · data MarginfiAccountInitialize · accounts MarginfiAccountInitializeInstructionAccounts.
No data fields.
Required accounts: 5; extras go to remaining.
Fields of MarginfiAccountInitializeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | fee_payer | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
MarginfiAccountInitializePda#
From the program's IDL:
The same as
marginfi_, except the created marginfi account uses a PDA (Program Derived Address) seeds:account_ initialize
- 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 beused freely. For a dedicated seed used by just your program (via CPI), contact us.
Discriminator 57b15b50da77f51f · data MarginfiAccountInitializePda · accounts MarginfiAccountInitializePdaInstructionAccounts.
| Field | Type |
|---|---|
account_ | u16 |
third_ | Option<u16> |
Required accounts: 6; extras go to remaining.
Fields of MarginfiAccountInitializePdaInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | fee_payer | Pubkey |
| 4 | instructions_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | fee_payer | Pubkey |
| 2 | liquidation_ | Pubkey |
| 3 | system_ | Pubkey |
| 4… | remaining | Vec< |
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_. Keeper keeps the rent.account_ set_ keeper_ close_ flags
Discriminator 8072472ec247ba6a · data MarginfiAccountKeeperCloseOrder · accounts MarginfiAccountKeeperCloseOrderInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of MarginfiAccountKeeperCloseOrderInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | fee_ | Pubkey |
| 2 | order | Pubkey |
| 3… | remaining | Vec< |
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.
| Field | Type |
|---|---|
bank_keys | Vec<Pubkey> |
trigger | OrderTrigger |
Required accounts: 8; extras go to remaining.
Fields of MarginfiAccountPlaceOrderInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | authority | Pubkey |
| 4 | order | Pubkey |
| 5 | fee_state | Pubkey |
| 6 | global_ | Pubkey |
| 7 | system_ | Pubkey |
| 8… | remaining | Vec< |
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.
| Field | Type |
|---|---|
frozen | bool |
Required accounts: 3; extras go to remaining.
Fields of MarginfiAccountSetFreezeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | admin | Pubkey |
| 3… | remaining | Vec< |
MarginfiAccountSetKeeperCloseFlags#
From the program's IDL:
(user) Purge flags from some balances, enabling a Keeper to call
marginfi_on associated Orders. Typically, useaccount_ keeper_ close_ order marginfi_instead if trying to close an Order.account_ close_ order
Discriminator 52a3a5ded4ff21d2 · data MarginfiAccountSetKeeperCloseFlags · accounts MarginfiAccountSetKeeperCloseFlagsInstructionAccounts.
| Field | Type |
|---|---|
bank_ | Option< |
Required accounts: 2; extras go to remaining.
Fields of MarginfiAccountSetKeeperCloseFlagsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2… | remaining | Vec< |
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
StartExecuteOrderis allowed per tx- Must appear before
EndExecuteOrderin the tx, and before any instructions except certainallowed ones (compute budget, kamino refresh, etc)
EndExecuteOrdermust 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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | fee_payer | Pubkey |
| 3 | executor | Pubkey |
| 4 | order | Pubkey |
| 5 | execute_ | Pubkey |
| 6 | instruction_ | Pubkey |
| 7 | system_ | Pubkey |
| 8… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | authority | Pubkey |
| 2 | destination_ | Pubkey |
| 3… | remaining | Vec< |
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,Noneto leave unchanged.
Discriminator 3ec7514e210dec3d · data MarginfiGroupConfigure · accounts MarginfiGroupConfigureInstructionAccounts.
| Field | Type |
|---|---|
new_admin | Option< |
new_ | Option< |
new_ | Option< |
new_ | Option< |
new_ | Option< |
new_ | Option< |
new_ | Option< |
new_ | Option< |
emode_ | Option< |
emode_ | Option< |
Required accounts: 2; extras go to remaining.
Fields of MarginfiGroupConfigureInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | admin | Pubkey |
| 2 | fee_state | Pubkey |
| 3 | system_ | Pubkey |
| 4… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | bank | Pubkey |
| 1… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | fee_state | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | fee_state | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | fee_state | Pubkey |
| 1… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | fee_state | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | staked_ | Pubkey |
| 2 | bank | Pubkey |
| 3… | remaining | Vec< |
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_andREPAYMENTS_ ALLOWED TOKENLESS_. used to purge remaining lending assets in a now-worthless bank before it is fully sunset.REPAYMENTS_ COMPLETE
Discriminator 84bb1995b53bfd88 · data PurgeDeleverageBalance · accounts PurgeDeleverageBalanceInstructionAccounts.
No data fields.
Required accounts: 4; extras go to remaining.
Fields of PurgeDeleverageBalanceInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | risk_admin | Pubkey |
| 3 | bank | Pubkey |
| 4… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 20; extras go to remaining.
Fields of SolendDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | signer_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | lending_ | Pubkey |
| 9 | lending_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | mint | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | reserve_ | Pubkey |
| 14 | reserve_ | Pubkey |
| 15 | user_ | Pubkey |
| 16 | pyth_price | Pubkey |
| 17 | switchboard_ | Pubkey |
| 18 | solend_ | Pubkey |
| 19 | token_ | Pubkey |
| 20… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 20; extras go to remaining.
Fields of SolendInitObligationInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | fee_payer | Pubkey |
| 1 | bank | Pubkey |
| 2 | signer_ | Pubkey |
| 3 | liquidity_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | integration_ | Pubkey |
| 6 | lending_ | Pubkey |
| 7 | lending_ | Pubkey |
| 8 | integration_ | Pubkey |
| 9 | mint | Pubkey |
| 10 | reserve_ | Pubkey |
| 11 | reserve_ | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | user_ | Pubkey |
| 14 | pyth_price | Pubkey |
| 15 | switchboard_ | Pubkey |
| 16 | solend_ | Pubkey |
| 17 | token_ | Pubkey |
| 18 | rent | Pubkey |
| 19 | system_ | Pubkey |
| 20… | remaining | Vec< |
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.
| Field | Type |
|---|---|
amount | u64 |
withdraw_ | Option< |
Required accounts: 18; extras go to remaining.
Fields of SolendWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | marginfi_ | Pubkey |
| 2 | authority | Pubkey |
| 3 | bank | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | liquidity_ | Pubkey |
| 7 | integration_ | Pubkey |
| 8 | lending_ | Pubkey |
| 9 | lending_ | Pubkey |
| 10 | integration_ | Pubkey |
| 11 | mint | Pubkey |
| 12 | reserve_ | Pubkey |
| 13 | reserve_ | Pubkey |
| 14 | reserve_ | Pubkey |
| 15 | user_ | Pubkey |
| 16 | solend_ | Pubkey |
| 17 | token_ | Pubkey |
| 18… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | liquidation_ | Pubkey |
| 2 | group | Pubkey |
| 3 | risk_admin | Pubkey |
| 4 | instruction_ | Pubkey |
| 5… | remaining | Vec< |
StartLiquidation#
From the program's IDL:
(permissionless) Begin receivership liquidation on an unhealthy account.
Snapshots health and marks the account in receivership. Must haveend_as the last ix in the tx.liquidation
Discriminator f45d5ad6c0a6bf15 · data StartLiquidation · accounts StartLiquidationInstructionAccounts.
No data fields.
Required accounts: 4; extras go to remaining.
Fields of StartLiquidationInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | liquidation_ | Pubkey |
| 2 | liquidation_ | Pubkey |
| 3 | instruction_ | Pubkey |
| 4… | remaining | Vec< |
SuperAdminDeposit#
From the program's IDL:
(primary admin only) Deposit directly into a bank liquidity vault and raise
asset_proportionally. No marginfi account is involved.share_ value
Discriminator f1bdc711cfe1404b · data SuperAdminDeposit · accounts SuperAdminDepositInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 6; extras go to remaining.
Fields of SuperAdminDepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3 | admin_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | token_ | Pubkey |
| 6… | remaining | Vec< |
SuperAdminWithdraw#
From the program's IDL:
(primary admin only) Withdraw directly from a bank liquidity vault and lower
asset_proportionally. No marginfi account is involved.share_ value
Discriminator ca43557e688a4fc5 · data SuperAdminWithdraw · accounts SuperAdminWithdrawInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 7; extras go to remaining.
Fields of SuperAdminWithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | admin | Pubkey |
| 2 | bank | Pubkey |
| 3 | destination_ | Pubkey |
| 4 | liquidity_ | Pubkey |
| 5 | liquidity_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | old_ | Pubkey |
| 2 | new_ | Pubkey |
| 3 | authority | Pubkey |
| 4 | fee_payer | Pubkey |
| 5 | new_ | Pubkey |
| 6 | global_ | Pubkey |
| 7 | system_ | Pubkey |
| 8… | remaining | Vec< |
TransferToNewAccountPda#
From the program's IDL:
(account authority) Same as
transfer_except the resulting account is a PDA seeds:to_ new_ account
- 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 beused freely. For a dedicated seed used by just your program (via CPI), contact us.
Discriminator acd2e0dc92d4fd31 · data TransferToNewAccountPda · accounts TransferToNewAccountPdaInstructionAccounts.
| Field | Type |
|---|---|
account_ | u16 |
third_ | Option<u16> |
Required accounts: 9; extras go to remaining.
Fields of TransferToNewAccountPdaInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | old_ | Pubkey |
| 2 | new_ | Pubkey |
| 3 | authority | Pubkey |
| 4 | fee_payer | Pubkey |
| 5 | new_ | Pubkey |
| 6 | global_ | Pubkey |
| 7 | instructions_ | Pubkey |
| 8 | system_ | Pubkey |
| 9… | remaining | Vec< |
UpdateDeleverageWithdrawals#
From the program's IDL:
(delegate_flow_admin only) Update the deleverage daily withdraw outflow with aggregated data. The delegate flow admin aggregates
DeleverageWithdrawFlowEventevents off-chain and calls this instruction at intervals.
Discriminator 3803b5761bf7cfe3 · data UpdateDeleverageWithdrawals · accounts UpdateDeleverageWithdrawalsInstructionAccounts.
| Field | Type |
|---|---|
outflow_usd | u32 |
update_seq | u64 |
event_ | u64 |
event_ | u64 |
Required accounts: 2; extras go to remaining.
Fields of UpdateDeleverageWithdrawalsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | delegate_ | Pubkey |
| 2… | remaining | Vec< |
UpdateGroupRateLimiter#
From the program's IDL:
(delegate_flow_admin only) Update the group rate limiter with aggregated inflow/outflow. The delegate flow admin aggregates
RateLimitFlowEventevents off-chain, converts to USD, and calls this instruction at intervals to update group rate limiter state.
Discriminator 174e3c8bbb2c8125 · data UpdateGroupRateLimiter · accounts UpdateGroupRateLimiterInstructionAccounts.
| Field | Type |
|---|---|
outflow_usd | Option<u64> |
inflow_usd | Option<u64> |
update_seq | u64 |
event_ | u64 |
event_ | u64 |
Required accounts: 2; extras go to remaining.
Fields of UpdateGroupRateLimiterInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | marginfi_ | Pubkey |
| 1 | delegate_ | Pubkey |
| 2… | remaining | Vec< |
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.
| Field | Type |
|---|---|
ticker | Option< |
description | Option< |
Required accounts: 4; extras go to remaining.
Fields of WriteBankMetadataInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | group | Pubkey |
| 1 | bank | Pubkey |
| 2 | metadata_ | Pubkey |
| 3 | metadata | Pubkey |
| 4… | remaining | Vec< |
CpiEvent#
Anchor self-CPI that carries one of the program's events. data is the CpiEvent enum.
Discriminator e445a52e51cb9a1d · data CpiEvent · accounts CpiEventInstructionAccounts.
Required accounts: 2; extras go to remaining.
Fields of CpiEventInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | program | Pubkey |
| 1 | event_ | Pubkey |
| 2… | remaining | Vec< |
Accounts#
Variants of MarginfiV2Account. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
Bank#
Discriminator 8e31a6f2324261bc · accounts::.
| Field | Type | Description |
|---|---|---|
mint | Pubkey | The SPL token mint this bank manages |
mint_ | u8 | Number of decimals of the mint. Must be < 24. |
group | Pubkey | The MarginfiGroup this bank belongs to |
_pad0 | [u8; 7] | |
asset_ | WrappedI80F48 | Monotonically 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_ | WrappedI80F48 | Monotonically 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_ | Pubkey | The SPL token account holding deposited liquidity |
liquidity_ | u8 | PDA bump for the liquidity vault |
liquidity_ | u8 | PDA bump for the liquidity vault authority |
insurance_ | Pubkey | The SPL token account holding insurance fund tokens |
insurance_ | u8 | PDA bump for the insurance vault |
insurance_ | u8 | PDA bump for the insurance vault authority |
pad1 | [u8; 4] | |
collected_ | WrappedI80F48 | Fees collected and pending withdraw for the insurance_ |
fee_vault | Pubkey | The SPL token account holding collected group fees |
fee_ | u8 | PDA bump for the fee vault |
fee_ | u8 | PDA bump for the fee vault authority |
pad2 | [u8; 6] | |
collected_ | WrappedI80F48 | Fees collected and pending withdraw for the fee_vault |
total_ | WrappedI80F48 | Sum of all liability shares held by all borrowers in this bank. Multiply by liability_ to get the total liability amount in native token units. |
total_ | WrappedI80F48 | Sum of all asset shares held by all depositors in this bank. Multiply by asset_ 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_, though the mint itself will always show (6) decimals exactly (i.e Kamino ignores this and treats it as if it was using mint_) |
last_update | i64 | Unix timestamp (i64) of the last interest accrual |
config | BankConfig | The bank's configuration parameters (weights, limits, oracle setup, interest rate config) |
flags | u64 | Bank flags bitfield (u64). - Bit 0 (1): EMISSIONS_ — borrow-side emissions are active - Bit 1 (2): EMISSIONS_ — lending-side emissions are active - Bit 2 (4): PERMISSIONLESS_ — anyone can settle bad debt - Bit 3 (8): FREEZE_ — bank configuration is frozen (only limits can change) - Bit 4 (16): CLOSE_ — bank can be closed (set at creation for banks >= 0.1.4) - Bit 5 (32): TOKENLESS_ — risk admin can repay debt without tokens - Bit 6 (64): TOKENLESS_ — all debt cleared, lender purge enabled |
emissions_ | u64 | Emissions APR. Number of emitted tokens (emissions_mint) per 1e(bank.mint_decimal) tokens (bank mint) (native amount) per 1 YEAR. |
emissions_ | WrappedI80F48 | Remaining emissions tokens available for distribution |
emissions_ | Pubkey | The SPL token mint used for emissions rewards |
collected_ | WrappedI80F48 | Fees collected and pending withdraw for the FeeState.'s canonical ATA for mint |
emode | EmodeSettings | Controls this bank's emode configuration, which enables some banks to treat the assets of certain other banks more preferentially as collateral. |
fees_ | Pubkey | Set with update_. 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). |
cache | BankCache | Cached bank metrics (interest rates, oracle price, etc.) |
lending_ | i32 | Number 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_ | i32 | Number 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_ | Pubkey | Integration account slot 1 (default Pubkey for non-integrations). - Kamino: reserve - Drift: spot market - Solend: reserve - JupLend: lending state |
integration_ | Pubkey | Integration account slot 2 (default Pubkey for non-integrations). - Kamino: obligation - Drift: user - Solend: obligation - JupLend: fToken vault |
integration_ | Pubkey | Integration account slot 3 (default Pubkey for non-integrations). - Drift: user stats - JupLend: withdraw intermediary ATA (ATA of liquidity_vault_authority for bank mint) |
rate_ | BankRateLimiter | Rate 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::.
| Field | Type | Description |
|---|---|---|
bank | Pubkey | Bank this metadata corresponds to |
placeholder | u64 | |
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_ | u16 | The last data byte in description (padding follows) |
end_ | u16 | The last data byte in data_blob (padding follows) |
end_ | u8 | The last data byte in ticker (padding follows) |
bump | u8 | |
pad0 | [u8; 2] |
ExecuteOrderRecord#
Discriminator 06646b3ca4e23861 · accounts::.
| Field | Type |
|---|---|
order | Pubkey |
executor | Pubkey |
balance_ | [ExecuteOrderBalanceRecord; 14] |
active_ | u8 |
inactive_ | u8 |
reserved0 | [u8; 6] |
order_ | WrappedI80F48 |
FeeState#
Discriminator 3fe01055c124ebdc · accounts::.
| Field | Type | Description |
|---|---|---|
key | Pubkey | The fee state's own key. A PDA derived from just b"feestate" |
global_ | Pubkey | Can modify fees |
global_ | Pubkey | The 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. |
placeholder0 | u64 | |
bank_ | u32 | Flat fee assessed when a new bank is initialized, in lamports. * In SOL, in native decimals. |
bump_seed | u8 | |
padding0 | [u8; 3] | |
liquidation_ | WrappedI80F48 | Liquidators can claim at this premium, when liquidating an asset in receivership liquidation, e.g. (1 + this) * amount repaid >= asset seized * A percentage |
program_ | WrappedI80F48 | Fee collected by the program owner from all groups * A percentage |
program_ | WrappedI80F48 | Fee collected by the program owner from all groups * A percentage |
panic_state | PanicState | When 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. |
placeholder1 | u64 | |
liquidation_ | u32 | Flat fee assessed for insurance/program use when a liquidation is executed * In SOL, in native decimals. |
order_ | u32 | Flat fee assessed for preventing spam use when creating an order * In SOL, in native decimals. |
order_ | WrappedI80F48 | Take-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::.
| Field | Type | Description |
|---|---|---|
mint | Pubkey | |
f_ | Pubkey | |
lending_id | u16 | |
decimals | u8 | number of decimals for the fToken, same as underlying mint |
rewards_ | Pubkey | PDA of rewards rate model (LRRM) |
liquidity_ | u64 | exchange price in the liquidity layer (no rewards) |
token_ | u64 | exchange price between fToken and underlying (with rewards) |
last_ | u64 | unix timestamp when exchange prices were updated last |
token_ | Pubkey | |
supply_ | Pubkey | |
bump | u8 |
LiquidationRecord#
Discriminator 5f74178459d2f5a2 · accounts::.
| Field | Type | Description |
|---|---|---|
key | Pubkey | This account's own key. A PDA derived from marginfi_ |
marginfi_ | Pubkey | Account this record tracks |
record_ | Pubkey | The 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_ | Pubkey | The liquidator taking receivership of the marginfi_ 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 |
cache | LiquidationCache | |
reserved0 | [u8; 64] | |
reserved2 | [u8; 16] | |
reserved3 | [u8; 8] |
MarginfiAccount#
Discriminator 43b2826d7e721c2a · accounts::.
| Field | Type | Description |
|---|---|---|
group | Pubkey | |
authority | Pubkey | |
lending_ | LendingAccount | |
account_ | u64 | The flags that indicate the state of the account. This is u64 bitfield, where each bit represents a flag. Flags:MarginfiAccount - 1: ACCOUNT_ - Indicates that the account is disabled and no further actions can be taken on it. - 2: ACCOUNT_ - 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_ - Deprecated, available for future use - 8: ACCOUNT_ - the admin has flagged with account to be moved, original owner can now call set_ - 16: ACCOUNT_ - 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_ACCOUNT_FROZEN` - the admin has frozen the account; only the group admin may perform actions until unfrozen. |
emissions_ | Pubkey | Wallet whose canonical ATA receives off-chain emissions distributions. |
health_ | HealthCache | |
migrated_ | Pubkey | If this account was migrated from another one, store the original account key |
migrated_to | Pubkey | If this account has been migrated to another one, store the destination account key |
last_update | u64 | Unix timestamp (u64) of the last account interaction. Note: Bank.last_update uses i64. |
account_ | u16 | If 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_ | u16 | If 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. |
bump | u8 | This account's bump, if a PDA-based account (0.1.5 or later). Otherwise, does nothing. |
pad0 | [u8; 3] | |
liquidation_ | Pubkey | Stores 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::.
| Field | Type | Description |
|---|---|---|
admin | Pubkey | Broadly able to modify anything, and can set/remove other admins at will. |
group_flags | u64 | Bitmask for group settings flags. * Bit 0 (1): PROGRAM_ — If set, program-level fees are enabled. * Bits 1-63: Reserved for future use. |
fee_ | FeeStateCache | Caches information from the global FeeState so the FeeState can be omitted on certain ixes |
banks | u16 | For 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_admin | Pubkey | This 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_ | Pubkey | Can modify the fields in config. but nothing else, for every bank under this group |
delegate_ | Pubkey | Can modify the deposit_, borrow_, total_ but nothing else, for every bank under this group |
delegate_ | Pubkey | Can modify the emissions flags, emissions_ and emissions_, but nothing else, for every bank under this group |
panic_ | PanicStateCache | When program keeper temporarily puts the program into panic mode, information about the duration of the lockup will be available here. |
deleverage_ | WithdrawWindowCache | Keeps 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_admin | Pubkey | Can run bankruptcy and forced deleverage ixes to e.g. sunset risky/illiquid assets |
metadata_ | Pubkey | Can modify a Bank's metadata, and nothing else. |
emode_ | u32 | Maximum leverage allowed for emode positions (initial margin), stored as u32 basis. Use u32_ to convert to I80F48. Range: 1-100. |
emode_ | u32 | Maximum 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_ | GroupRateLimiter | Rate limiter for controlling aggregate withdraw/borrow outflow across all banks. Tracks net outflow in USD. |
rate_ | u64 | Last slot covered by an admin group rate limiter aggregation update. |
rate_ | u64 | Monotonic 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_ | u64 | Last slot covered by an admin deleverage withdraw-limit aggregation update. |
deleverage_ | u64 | Monotonic sequence number for admin deleverage withdraw-limit updates. |
delegate_ | Pubkey | Can 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::.
| Field | Type | Description |
|---|---|---|
tag | u64 | |
last_ | u64 | Kamino obligations are only good for one slot, e.g. refresh_ must have run within the same slot as any ix that needs a non-stale obligation e.g. withdraw. |
last_ | u8 | True 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_ * 0 = false, 1 = true |
last_ | u8 | Each 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_ | [u8; 6] | |
lending_ | Pubkey | |
owner | Pubkey | For mrgn banks, the bank's Liquidity Vault Authority (a pda which can be derived if the bank key is known) |
deposits | [MinimalObligationCollateral; 8] | |
lowest_ | u64 | |
deposited_ | [u8; 16] | |
padding_ | [u8; 512] | |
padding_ | [u8; 512] | |
padding_ | [u8; 512] | |
padding_ | [u8; 512] | |
padding_ | [u8; 64] | |
padding_ | [u8; 24] |
MinimalReserve#
Discriminator 2bf2ccca1af73b7f · accounts::.
| Field | Type | Description |
|---|---|---|
version | u64 | |
slot | u64 | Kamino reserves are only good for one slot, e.g. refresh_ must have run within the same slot as any ix that needs a non-stale reserve e.g. withdraw. |
stale | u8 | True 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_ * 0 = false, 1 = true |
price_ | u8 | Each 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_ | Pubkey | |
farm_ | Pubkey | |
farm_debt | Pubkey | |
mint_pubkey | Pubkey | |
supply_ | Pubkey | * A PDA |
fee_vault | Pubkey | * A PDA |
available_ | u64 | In simple terms: (amount in supply vault - outstanding borrows) * In token, with mint_ |
borrowed_ | [u8; 16] | * In token, with mint_ * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
market_ | [u8; 16] | * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
market_ | u64 | |
mint_ | u64 | |
deposit_ | u64 | |
borrow_ | u64 | |
cumulative_ | [u8; 48] | |
accumulated_ | [u8; 16] | * In token, with mint_ * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
accumulated_ | [u8; 16] | * In token, with mint_ * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
pending_ | [u8; 16] | * In token, with mint_ * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
absolute_ | [u8; 16] | * In token, with mint_ * Actually an I68F60, stored as a u128 (i.e. BN) in Kamino. |
token_ | Pubkey | Token or Token22. If token22, note that Kamino does not support all Token22 extensions. |
padding2_ | [u8; 256] | |
padding2_ | [u8; 128] | |
padding2_ | [u8; 24] | |
padding3 | [u8; 512] | |
padding_ | [u8; 512] | |
padding_ | [u8; 512] | |
padding_ | [u8; 128] | |
padding_ | [u8; 48] | |
collateral_ | Pubkey | Mints collateral tokens * A PDA * technically 6 decimals, but uses mint_ regardless for all purposes * authority = lending_market_authority |
mint_ | u64 | Total number of collateral tokens * uses mint_, even though it's technically 6 decimals under the hood |
collateral_ | Pubkey | * A PDA |
padding1_ | [u8; 512] | |
padding2_ | [u8; 512] | |
padding4_ | [u8; 4096] | |
padding4_ | [u8; 512] | |
padding4_ | [u8; 256] | |
padding4_ | [u8; 64] | |
padding4_ | [u8; 32] | |
padding4_ | [u8; 8] |
MinimalSpotMarket#
Discriminator 64b1086ba8414127 · accounts::.
| Field | Type | Description |
|---|---|---|
pubkey | Pubkey | The address of the spot market. It is a pda of the market index |
oracle | Pubkey | The oracle used to price the markets deposits/borrows |
mint | Pubkey | The token mint of the market |
vault | Pubkey | The vault used to store the market's deposits |
padding1 | [[u64; 4]; 9] | |
padding2 | [u8; 8] | |
deposit_ | [u8; 16] | All the fields we need for testing (stored as raw bytes for simplicity) |
borrow_ | [u8; 16] | |
cumulative_ | [u8; 16] | |
cumulative_ | [u8; 16] | |
padding3 | [u64; 9] | |
last_ | u64 | Last time the cumulative deposit and borrow interest was updated Offset: 568 bytes from start of struct (including discriminator) |
padding4 | [u64; 13] | |
decimals | u32 | |
market_ | u16 | |
padding5 | [u16; 24] | |
padding6 | [u8; 1] | |
pool_id | u8 | |
padding7 | [u64; 5] | Padding to reach 776 bytes total (including discriminator) |
MinimalUser#
Discriminator 9f755fe3ef973aec · accounts::.
| Field | Type | Description |
|---|---|---|
authority | Pubkey | The owner/authority of the account |
delegate | Pubkey | An addresses that can control the account on the authority's behalf |
name | [u8; 32] | Encoded display name for the account |
spot_ | [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_ | u16 | Sub account id for this user account |
status | UserStatus | |
padding8 | [u8; 27] |
Order#
Discriminator 86addfb94d561c33 · accounts::.
| Field | Type | Description |
|---|---|---|
marginfi_ | Pubkey | |
stop_loss | WrappedI80F48 | |
take_profit | WrappedI80F48 | |
placeholder | u64 | Reserved for future use |
max_ | u32 | * 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_ stores the tag count for forward compatibility. (u16 * 2 = 4 bytes) |
pad1 | [u8; 4] | |
tags_ | [u8; 32] | |
trigger | OrderTriggerType | Stop Loss (0), Take Profit (1), or Both (2) |
bump | u8 | Bump to derive this pda |
pad2 | [u8; 6] | |
reserved1 | [[u8; 32]; 4] |
SolendMinimalReserve#
Discriminator 01 · accounts::.
| Field | Type | Description |
|---|---|---|
last_ | u64 | Last slot when supply and rates updated |
last_ | u8 | True when marked stale |
lending_ | Pubkey | Lending market address |
liquidity_ | Pubkey | |
liquidity_ | u8 | |
liquidity_ | Pubkey | |
liquidity_ | Pubkey | |
liquidity_ | Pubkey | |
liquidity_ | u64 | |
liquidity_ | [u8; 16] | |
liquidity_ | [u8; 16] | |
liquidity_ | [u8; 16] | |
collateral_ | Pubkey | |
collateral_ | u64 | |
collateral_ | Pubkey | |
config_ | u8 | |
config_ | u8 | |
config_ | u8 | |
config_ | u8 | |
padding_ | [u8; 64] | |
padding_ | [u8; 6] | |
liquidity_ | [u8; 16] | |
padding_ | [u8; 128] | |
padding_ | [u8; 64] | |
padding_ | [u8; 32] | |
padding_ | [u8; 6] |
StakedSettings#
Discriminator 9d8c064d59adad7d · accounts::.
| Field | Type | Description |
|---|---|---|
key | Pubkey | This account's own key. A PDA derived from marginfi_ and STAKED_ |
marginfi_ | Pubkey | Group for which these settings apply |
oracle | Pubkey | Generally, the Pyth push oracle for SOL |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
total_ | u64 | |
oracle_ | u16 | |
risk_tier | RiskTier | |
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::, decoded from the CpiEvent instruction. Each wraps a struct from carbon_. The discriminator is the 8-byte event discriminator that follows the e445a52e51cb9a1d CPI-event tag.
DeleverageEvent#
Discriminator a1086cccd1c60c1e · events::.
| Field | Type |
|---|---|
marginfi_ | Pubkey |
risk_admin | Pubkey |
deleveragee_ | f64 |
deleveragee_ | f64 |
DeleverageWithdrawFlowEvent#
Discriminator 6d5a8bc80acc54b0 · events::.
| Field | Type | Description |
|---|---|---|
group | Pubkey | |
bank | Pubkey | |
mint | Pubkey | |
outflow_usd | u32 | Equity-denominated outflow value in USD, rounded to integer. |
current_ | i64 | Unix timestamp when the flow was recorded |
EditStakedSettingsEvent#
Discriminator 1d3a9bbf4bdc91ce · events::.
| Field | Type |
|---|---|
group | Pubkey |
settings | StakedSettingsEditConfig |
HealthPulseEvent#
Discriminator b79fda6e3ddc4101 · events::.
| Field | Type |
|---|---|
account | Pubkey |
health_ | HealthCache |
KeeperCloseOrderEvent#
Discriminator 2e980bae5c9d4d40 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
order | Pubkey |
LendingAccountBorrowEvent#
Discriminator df60510a9c631a3b · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank | Pubkey |
mint | Pubkey |
amount | u64 |
LendingAccountDepositEvent#
Discriminator a136edd969f87a97 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank | Pubkey |
mint | Pubkey |
amount | u64 |
LendingAccountLiquidateEvent#
Discriminator a6a0f99ab72717f2 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
liquidatee_ | Pubkey |
liquidatee_ | Pubkey |
asset_bank | Pubkey |
asset_mint | Pubkey |
liability_ | Pubkey |
liability_ | Pubkey |
liquidatee_ | f64 |
liquidatee_ | f64 |
pre_ | LiquidationBalances |
post_ | LiquidationBalances |
LendingAccountRepayEvent#
Discriminator 10dc376f07501019 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank | Pubkey |
mint | Pubkey |
amount | u64 |
close_ | bool |
LendingAccountWithdrawEvent#
Discriminator 03dc94f321f93658 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank | Pubkey |
mint | Pubkey |
amount | u64 |
close_ | bool |
LendingPoolBankAccrueInterestEvent#
Discriminator 6875bb9c6f9a6aba · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
delta | u64 |
fees_ | f64 |
insurance_ | f64 |
LendingPoolBankCollectFeesEvent#
Discriminator 657761faa9af9cfd · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
group_ | f64 |
group_ | f64 |
insurance_ | f64 |
insurance_ | f64 |
LendingPoolBankConfigureEvent#
Discriminator f623e96e5d98eb28 · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
config | BankConfigOpt |
LendingPoolBankConfigureFrozenEvent#
Discriminator 180a371231969db3 · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
deposit_ | u64 |
borrow_ | u64 |
LendingPoolBankConfigureOracleEvent#
Discriminator 778c6efd9640d23e · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
oracle_ | u8 |
oracle | Pubkey |
LendingPoolBankCreateEvent#
Discriminator ecdcc93fef7e88f9 · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
LendingPoolBankHandleBankruptcyEvent#
Discriminator a64d298c245e0a39 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank | Pubkey |
mint | Pubkey |
bad_debt | f64 |
covered_ | f64 |
socialized_ | f64 |
LendingPoolBankSetFixedOraclePriceEvent#
Discriminator 41480855e5145a1a · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
price | WrappedI80F48 |
LendingPoolSuperAdminDepositEvent#
Discriminator 6398d31e3aa5d247 · events::.
| Field | Type | Description |
|---|---|---|
header | GroupEventHeader | |
bank | Pubkey | |
mint | Pubkey | |
transfer_ | u64 | Amount requested in SPL transfer instruction. |
vault_ | u64 | Assumed vault inflow. Token-2022 transfer fees are not handled by this instruction path. |
LendingPoolSuperAdminWithdrawEvent#
Discriminator 6ba8e8b590a1fc25 · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
bank | Pubkey |
mint | Pubkey |
vault_ | u64 |
LiquidationReceiverEvent#
Discriminator 2883e0dc975318e6 · events::.
| Field | Type |
|---|---|
marginfi_ | Pubkey |
liquidation_ | Pubkey |
liquidatee_ | f64 |
liquidatee_ | f64 |
lamps_ | u32 |
MarginfiAccountCloseOrderEvent#
Discriminator 9e227a621792e5d4 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
order | Pubkey |
MarginfiAccountCreateEvent#
Discriminator b70575687ac74433 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
MarginfiAccountFreezeEvent#
Discriminator dbdb39b24b56927a · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
frozen | bool |
MarginfiAccountPlaceOrderEvent#
Discriminator 01694f1c8ef26391 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
order | Pubkey |
trigger | OrderTriggerType |
stop_loss | WrappedI80F48 |
take_profit | WrappedI80F48 |
tags | [u16; 2] |
MarginfiAccountTransferToNewAccount#
Discriminator 3b69ab6edf885059 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
old_account | Pubkey |
old_ | Pubkey |
new_ | Pubkey |
MarginfiGroupConfigureEvent#
Discriminator f168aca729c3c7aa · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
admin | Option< |
flags | u64 |
MarginfiGroupCreateEvent#
Discriminator e97d3d0e62f088fd · events::.
| Field | Type |
|---|---|
header | GroupEventHeader |
RateLimitFlowEvent#
Discriminator e50549c8006b696d · events::.
| Field | Type | Description |
|---|---|---|
group | Pubkey | |
bank | Pubkey | |
mint | Pubkey | |
flow_ | u8 | 0 = outflow (withdraw/borrow), 1 = inflow (deposit/repay) |
native_ | u64 | Amount in native tokens |
mint_ | u8 | |
current_ | i64 | Unix timestamp when the flow was recorded |
SetKeeperCloseFlagsEvent#
Discriminator c1e65d8075576015 · events::.
| Field | Type |
|---|---|
header | AccountEventHeader |
bank_keys | Option< |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
AccountEventHeader#
Struct types::.
| Field | Type |
|---|---|
signer | Option< |
marginfi_ | Pubkey |
marginfi_ | Pubkey |
marginfi_ | Pubkey |
Balance#
Struct types::.
| Field | Type | Description |
|---|---|---|
active | u8 | Whether this balance slot is in use (nonzero = active) |
bank_pk | Pubkey | The bank this balance corresponds to |
bank_ | u8 | Inherited 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 | u16 | Tag 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_ | WrappedI80F48 | The user's asset (deposit) shares in the bank. Multiply by bank. for the token amount. |
liability_ | WrappedI80F48 | The user's liability (borrow) shares in the bank. Multiply by bank. for the token amount. |
emissions_ | WrappedI80F48 | Unclaimed emissions rewards for this position |
last_update | u64 | Unix 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::.
| Field | Type | Description |
|---|---|---|
base_rate | u32 | Actual (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_ | u32 | Equivalent to base_rate * utilization * From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc |
borrowing_ | u32 | Equivalent to base_rate * (1 + ir_fees) + fixed_fees * From 0-1000%, as u32, e.g. u32::MAX = 1000%, u32::MAX/2 = 500%, etc |
interest_ | u32 | * in seconds |
accumulated_ | WrappedI80F48 | equivalent to (share value increase in the last interest_ seconds * shares), i.e. the delta in asset_, 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_ | WrappedI80F48 | Oracle 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_ | i64 | Unix timestamp (seconds) when last_oracle_price was last updated * Used to determine staleness of cached price * Zero if never updated |
last_ | WrappedI80F48 | Confidence 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_ |
liq_ | u8 | Liquidation 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_ | WrappedI80F48 | Cached real-time price for receivership liquidation. |
liquidation_ | WrappedI80F48 | Cached real-time price confidence for receivership liquidation. |
liquidation_ | WrappedI80F48 | Cached TWAP price for receivership liquidation. |
liquidation_ | WrappedI80F48 | Cached TWAP price confidence for receivership liquidation. |
BankConfig#
Struct types::.
| Field | Type | Description |
|---|---|---|
asset_ | WrappedI80F48 | Discount 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_ | WrappedI80F48 | Discount factor for asset values in maintenance margin calculation (0 to 2). Used for liquidation eligibility. Generally >= asset_weight_init. |
liability_ | WrappedI80F48 | Premium 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_ | WrappedI80F48 | Premium factor for liability values in maintenance margin calculation (>= 1). Used for liquidation eligibility. Generally <= liability_weight_init. |
deposit_ | u64 | Maximum total deposits allowed in this bank, in native token units (0 = no limit) |
interest_ | InterestRateConfig | Interest rate model configuration |
operational_ | BankOperationalState | Current operational state of the bank (Paused, Operational, ReduceOnly, KilledByBankruptcy) |
oracle_ | OracleSetup | Oracle type used for price feeds |
oracle_keys | [Pubkey; 5] | Oracle account keys (usage depends on oracle_setup type) |
pad0 | [u8; 6] | |
borrow_ | u64 | Maximum total borrows allowed in this bank, in native token units (0 = no limit) |
risk_tier | RiskTier | Risk tier for this bank (Collateral or Isolated) |
asset_tag | u8 | Determines what kinds of assets users of this bank can interact with. Options: * ASSET_ (0) - A regular asset that can be comingled with any other regular asset or with ASSET_ * ASSET_ (1) - Accounts with a SOL position can comingle with either ASSET_ or ASSET_ positions, but not both * ASSET_ (2) - Staked SOL assets. Accounts with a STAKED position can only deposit other STAKED assets or SOL (ASSET_) and can only borrow SOL * ASSET_ (3) - Treated the same as ASSET_ * ASSET_ (4) - Treated the same as ASSET_ * ASSET_ (5) - Treated the same as ASSET_ |
config_ | u8 | Flags 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_ | u64 | USD 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_ | u16 | Time window in seconds for the oracle price feed to be considered live. |
padding0 | [u8; 2] | |
oracle_ | u32 | From 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_price | WrappedI80F48 | Stored oracle price for OracleSetup::, otherwise does nothing |
padding1 | [u8; 16] |
BankConfigCompact#
Struct types::.
| Field | Type | Description |
|---|---|---|
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
liability_ | WrappedI80F48 | |
liability_ | WrappedI80F48 | |
deposit_ | u64 | |
interest_ | InterestRateConfigCompact | |
operational_ | BankOperationalState | |
borrow_ | u64 | |
risk_tier | RiskTier | |
asset_tag | u8 | Determines what kinds of assets users of this bank can interact with. Options: * ASSET_ (0) - A regular asset that can be comingled with any other regular asset or with ASSET_ * ASSET_ (1) - Accounts with a SOL position can comingle with either ASSET_ or ASSET_ positions, but not both * ASSET_ (2) - Staked SOL assets. Accounts with a STAKED position can only deposit other STAKED assets or SOL (ASSET_) and can only borrow SOL * ASSET_ (3) - Treated the same as ASSET_ * ASSET_ (4) - Treated the same as ASSET_ * ASSET_ (5) - Treated the same as ASSET_ |
config_ | u8 | Flags 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_ | u64 | USD 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_ | u16 | Time window in seconds for the oracle price feed to be considered live. |
oracle_ | u32 | From 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::.
| Field | Type |
|---|---|
asset_ | Option< |
asset_ | Option< |
liability_ | Option< |
liability_ | Option< |
deposit_ | Option<u64> |
borrow_ | Option<u64> |
operational_ | Option< |
interest_ | Option< |
risk_tier | Option< |
asset_tag | Option<u8> |
total_ | Option<u64> |
oracle_ | Option<u32> |
oracle_ | Option<u16> |
permissionless_ | Option< |
freeze_ | Option< |
tokenless_ | Option< |
BankOperationalState#
Enum types::.
| 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::.
| Field | Type | Description |
|---|---|---|
hourly | RateLimitWindow | Hourly window rate limiter (native tokens). |
daily | RateLimitWindow | Daily window rate limiter (native tokens). |
DeleverageEvent#
Struct types::. 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 viaupdate_.deleverage_ withdrawals
Struct types::. Same fields as the DeleverageWithdrawFlowEvent event.
DriftConfigCompact#
From the program's IDL:
Used to configure Drift banks. A simplified version of
BankConfigCompactwhich omits most values related to interest since Drift banks cannot earn interest or be borrowed against.
Struct types::.
| Field | Type | Description |
|---|---|---|
oracle | Pubkey | |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
oracle_ | OracleSetup | Either DriftPythPull or DriftSwitchboardPull |
operational_ | BankOperationalState | Bank operational state - allows starting banks in paused state |
risk_tier | RiskTier | Risk tier - determines if assets can be borrowed in isolation |
config_ | u8 | Config flags for future-proofing |
total_ | u64 | |
oracle_ | u16 | |
oracle_ | u32 | Oracle confidence threshold (0 = use default 10%) |
EditStakedSettingsEvent#
Struct types::. 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_). For example, the risk engine creates such an intersection from all the emode config of all banks the user is borrowing from.emode_ configs
Struct types::.
| Field | Type |
|---|---|
entries | [EmodeEntry; 10] |
EmodeEntry#
Struct types::.
| Field | Type | Description |
|---|---|---|
collateral_ | u16 | emode_tag of the bank(s) whose collateral you wish to treat preferentially. |
flags | u8 | * 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_ | WrappedI80F48 | Note: If set below the collateral bank's weight, does nothing. |
asset_ | WrappedI80F48 | Note: 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::.
| Field | Type | Description |
|---|---|---|
emode_tag | u16 | This 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] | |
timestamp | i64 | Unix timestamp from the system clock when emode state was last updated |
flags | u64 | EMODE_ON (1) - If set, at least one entry is configured 2, 4, 8, etc, Reserved for future use |
emode_ | EmodeConfig |
ExecuteOrderBalanceRecord#
Struct types::.
| Field | Type |
|---|---|
bank | Pubkey |
is_asset | u8 |
pad0 | [u8; 5] |
tag | u16 |
shares | WrappedI80F48 |
FeeStateCache#
From the program's IDL:
Cached fee configuration propagated from the global FeeState
Struct types::.
| Field | Type | Description |
|---|---|---|
global_ | Pubkey | The wallet that receives program-level fees |
program_ | WrappedI80F48 | Fixed fee APR charged to borrowers (program-level) |
program_ | WrappedI80F48 | Proportional fee rate on interest (program-level) |
last_update | i64 | Unix timestamp of the last fee state propagation |
GroupEventHeader#
Struct types::.
| Field | Type |
|---|---|
signer | Option< |
marginfi_ | Pubkey |
GroupRateLimiter#
From the program's IDL:
Per-group rate limiting configuration and state.
Tracks aggregate net outflow in USD.
Struct types::.
| Field | Type | Description |
|---|---|---|
hourly | RateLimitWindow | Hourly window rate limiter (USD). |
daily | RateLimitWindow | Daily 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::.
| Field | Type | Description |
|---|---|---|
asset_value | WrappedI80F48 | Internal 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_ | WrappedI80F48 | Internal 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_ | WrappedI80F48 | Internal 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_ | WrappedI80F48 | Internal 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_ | WrappedI80F48 | The "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_ | WrappedI80F48 | The "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 |
timestamp | i64 | Unix timestamp from the system clock when this cache was last updated |
flags | u32 | The 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_ 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_err | u32 | If 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_ | u32 | Errors 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_index | u8 | Index in balances where internal_ appeared |
program_ | u8 | Since 0.1.3, the version will be encoded here. See PROGRAM_VERSION. |
pad0 | [u8; 2] | |
internal_ | u32 | Error code from the liquidation health check during the last health pulse (0 if none) |
internal_ | u32 | Error code from the bankruptcy check during the last health pulse (0 if none) |
reserved0 | [u8; 32] | |
reserved1 | [u8; 16] |
HealthPulseEvent#
Struct types::. Same fields as the HealthPulseEvent event.
InterestRateConfig#
Struct types::.
| Field | Type | Description |
|---|---|---|
optimal_ | WrappedI80F48 | |
plateau_ | WrappedI80F48 | |
max_ | WrappedI80F48 | |
insurance_ | WrappedI80F48 | Goes to insurance, funds collected_ |
insurance_ | WrappedI80F48 | Goes to insurance, funds collected_ |
protocol_ | WrappedI80F48 | Earned by the group, goes to collected_ |
protocol_ | WrappedI80F48 | Earned by the group, goes to collected_ |
protocol_ | WrappedI80F48 | |
zero_ | u32 | The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX |
hundred_ | u32 | The 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_type | u8 | Determines 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::.
| Field | Type | Description |
|---|---|---|
insurance_ | WrappedI80F48 | |
insurance_ | WrappedI80F48 | |
protocol_ | WrappedI80F48 | |
protocol_ | WrappedI80F48 | |
protocol_ | WrappedI80F48 | |
zero_ | u32 | The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX |
hundred_ | u32 | The 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::.
| Field | Type | Description |
|---|---|---|
insurance_ | Option< | |
insurance_ | Option< | |
protocol_ | Option< | |
protocol_ | Option< | |
protocol_ | Option< | |
zero_ | Option<u32> | The base rate at utilization = 0 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX |
hundred_ | Option<u32> | The base rate at utilization = 100 * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX |
points | Option< | 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
BankConfigCompactwhich 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 inPausedstate and are set toOperationalviajuplend_(seed deposit + protocol fToken vault).init_ position
Struct types::.
| Field | Type | Description |
|---|---|---|
oracle | Pubkey | |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
oracle_ | OracleSetup | Either JuplendPythPull or JuplendSwitchboardPull |
risk_tier | RiskTier | Isolated or Collateral |
config_ | u8 | Config flags for future-proofing, currently ignored |
total_ | u64 | In $ |
oracle_ | u16 | In seconds |
oracle_ | u32 | Oracle confidence threshold (0 = use default 10%) |
KaminoConfigCompact#
From the program's IDL:
Used to configure Kamino banks. A simplified version of
BankConfigCompactwhich omits most values related to interest since Kamino banks cannot earn interest or be borrowed against.
Struct types::.
| Field | Type | Description |
|---|---|---|
oracle | Pubkey | |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
oracle_ | OracleSetup | Either KaminoPythPush or KaminoSwitchboardPull |
operational_ | BankOperationalState | Bank operational state - allows starting banks in paused state |
risk_tier | RiskTier | Risk tier - determines if assets can be borrowed in isolation |
config_ | u8 | Config flags for future-proofing |
total_ | u64 | |
oracle_ | u16 | Currently unused: Kamino's oracle age applies to kamino banks. |
oracle_ | u32 | Oracle confidence threshold (0 = use default 10%) |
KeeperCloseOrderEvent#
Struct types::. 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::.
| Field | Type | Description |
|---|---|---|
balances | [Balance; 16] | Array of balance positions (max 16). Sorted in descending order by bank_pk. |
last_ | u16 | Last 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::. Same fields as the LendingAccountBorrowEvent event.
LendingAccountDepositEvent#
Struct types::. Same fields as the LendingAccountDepositEvent event.
LendingAccountLiquidateEvent#
Struct types::. Same fields as the LendingAccountLiquidateEvent event.
LendingAccountRepayEvent#
Struct types::. Same fields as the LendingAccountRepayEvent event.
LendingAccountWithdrawEvent#
Struct types::. Same fields as the LendingAccountWithdrawEvent event.
LendingPoolBankAccrueInterestEvent#
Struct types::. Same fields as the LendingPoolBankAccrueInterestEvent event.
LendingPoolBankCollectFeesEvent#
Struct types::. Same fields as the LendingPoolBankCollectFeesEvent event.
LendingPoolBankConfigureEvent#
Struct types::. Same fields as the LendingPoolBankConfigureEvent event.
LendingPoolBankConfigureFrozenEvent#
Struct types::. Same fields as the LendingPoolBankConfigureFrozenEvent event.
LendingPoolBankConfigureOracleEvent#
Struct types::. Same fields as the LendingPoolBankConfigureOracleEvent event.
LendingPoolBankCreateEvent#
Struct types::. Same fields as the LendingPoolBankCreateEvent event.
LendingPoolBankHandleBankruptcyEvent#
Struct types::. Same fields as the LendingPoolBankHandleBankruptcyEvent event.
LendingPoolBankSetFixedOraclePriceEvent#
Struct types::. Same fields as the LendingPoolBankSetFixedOraclePriceEvent event.
LendingPoolSuperAdminDepositEvent#
Struct types::. Same fields as the LendingPoolSuperAdminDepositEvent event.
LendingPoolSuperAdminWithdrawEvent#
Struct types::. Same fields as the LendingPoolSuperAdminWithdrawEvent event.
LiquidationBalances#
Struct types::.
| Field | Type |
|---|---|
liquidatee_ | f64 |
liquidatee_ | f64 |
liquidator_ | f64 |
liquidator_ | f64 |
LiquidationCache#
Struct types::.
| Field | Type | Description |
|---|---|---|
asset_ | WrappedI80F48 | Internal risk engine asset value snapshot taken when liquidation begins, using maintenance weight with all confidence adjustments. * Uses SPOT price * In dollars |
liability_ | WrappedI80F48 | Internal risk engine liability value snapshot taken when liquidation begins, using maintenance weight with all confidence adjustments. * Uses SPOT price * In dollars |
asset_ | WrappedI80F48 | Actual 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_ - this amount * Uses EMA price * In dollars |
liability_ | WrappedI80F48 | Actual 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_ * Uses EMA price * In dollars |
placeholder | u64 | |
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::.
| Field | Type | Description |
|---|---|---|
asset_ | [u8; 8] | Dollar amount seized * An f64 stored as bytes |
liab_ | [u8; 8] | Dollar amount repaid * An f64 stored as bytes |
placeholder0 | u64 | |
timestamp | i64 | |
reserved0 | [u8; 16] |
LiquidationReceiverEvent#
Struct types::. Same fields as the LiquidationReceiverEvent event.
MarginfiAccountCloseOrderEvent#
Struct types::. Same fields as the MarginfiAccountCloseOrderEvent event.
MarginfiAccountCreateEvent#
Struct types::. Same fields as the MarginfiAccountCreateEvent event.
MarginfiAccountFreezeEvent#
Struct types::. Same fields as the MarginfiAccountFreezeEvent event.
MarginfiAccountPlaceOrderEvent#
Struct types::. Same fields as the MarginfiAccountPlaceOrderEvent event.
MarginfiAccountTransferToNewAccount#
Struct types::. Same fields as the MarginfiAccountTransferToNewAccount event.
MarginfiGroupConfigureEvent#
Struct types::. Same fields as the MarginfiGroupConfigureEvent event.
MarginfiGroupCreateEvent#
Struct types::. Same fields as the MarginfiGroupCreateEvent event.
MinimalObligationCollateral#
Struct types::.
| Field | Type | Description |
|---|---|---|
deposit_ | Pubkey | |
deposited_ | u64 | In collateral token (NOT liquidity token), use collateral_ to convert back to liquidity token! * Always 6 decimals |
market_ | [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_ | u64 | |
padding | [u64; 9] |
OracleSetup#
Enum types::.
| Variant |
|---|
None |
PythLegacy |
SwitchboardV2 |
PythPushOracle |
SwitchboardPull |
StakedWithPythPush |
KaminoPythPush |
KaminoSwitchboardPull |
Fixed |
DriftPythPull |
DriftSwitchboardPull |
SolendPythPull |
SolendSwitchboardPull |
FixedKamino |
FixedDrift |
JuplendPythPull |
JuplendSwitchboardPull |
FixedJuplend |
OrderTrigger#
Enum types::.
| Variant | Fields |
|---|---|
StopLoss | threshold: WrappedI80F48, max_: u32 |
TakeProfit | threshold: WrappedI80F48, max_: u32 |
Both | stop_loss: WrappedI80F48, take_profit: WrappedI80F48, max_: u32 |
OrderTriggerType#
Enum types::.
| Variant |
|---|
StopLoss |
TakeProfit |
Both |
PanicState#
From the program's IDL:
Panic state for emergency protocol pausing
Struct types::.
| Field | Type | Description |
|---|---|---|
pause_flags | u8 | Whether the protocol is currently paused (1 = paused, 0 = not paused) |
daily_ | u8 | Number of times paused today (resets every 24 hours) |
consecutive_ | u8 | Number of consecutive pauses (resets when unpause happens) |
reserved | [u8; 5] | |
pause_ | i64 | Timestamp when the current pause started (0 if not paused) * When a pause is extended before expiring, this could be in the future. |
last_ | i64 | Timestamp of the last daily reset (for tracking daily pause count) |
reserved_ | [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::.
| Field | Type | Description |
|---|---|---|
pause_flags | u8 | Whether the protocol is currently paused (1 = paused, 0 = not paused) |
reserved | [u8; 7] | |
pause_ | i64 | Timestamp when the current pause started (0 if not paused) |
last_ | i64 | Timestamp 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 viaupdate_.group_ rate_ limiter
Struct types::. 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::.
| Field | Type | Description |
|---|---|---|
max_outflow | u64 | Maximum net outflow allowed per window (0 = disabled). For bank-level: denominated in native tokens. For group-level: denominated in USD. |
window_ | u64 | Window duration in seconds (e.g., 3600 for hourly, 86400 for daily). |
window_ | i64 | Unix timestamp when the current window started. |
prev_ | i64 | Net outflow accumulated in the previous window. Signed to allow tracking when inflows exceed outflows. |
cur_ | i64 | Net outflow accumulated in the current window. Signed to allow tracking when inflows exceed outflows. |
RatePoint#
Struct types::.
| Field | Type | Description |
|---|---|---|
util | u32 | The utilization rate where rate applies * a %, as u32, out of 100%, e.g. 50% = .5 * u32::MAX |
rate | u32 | The base rate that applies * a %, as u32, out of 1000%, e.g. 100% = 0.1 * u32::MAX |
RiskTier#
Enum types::.
| Variant |
|---|
Collateral |
Isolated |
SetKeeperCloseFlagsEvent#
Struct types::. Same fields as the SetKeeperCloseFlagsEvent event.
SolendConfigCompact#
From the program's IDL:
Used to configure Solend banks. A simplified version of
BankConfigCompactwhich omits most values related to interest since Solend banks cannot earn interest or be borrowed against.
Struct types::.
| Field | Type | Description |
|---|---|---|
oracle | Pubkey | |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
oracle_ | OracleSetup | Either SolendPythPull or SolendSwitchboardPull |
operational_ | BankOperationalState | Bank operational state - allows starting banks in paused state |
risk_tier | RiskTier | Risk tier - determines if assets can be borrowed in isolation |
config_ | u8 | Config flags for future-proofing |
total_ | u64 | |
oracle_ | u16 | |
oracle_ | u32 | Oracle confidence threshold (0 = use default 10%) |
SpotBalanceType#
Enum types::.
| Variant |
|---|
Deposit |
Borrow |
SpotPosition#
From the program's IDL:
Minimal representation of a spot position within a User account
Struct types::.
| Field | Type | Description |
|---|---|---|
scaled_ | u64 | The scaled balance of the position. * Precision: SPOT_BALANCE_PRECISION |
open_bids | i64 | How many spot bids the user has open * Precision: token mint precision |
open_asks | i64 | How many spot asks the user has open * Precision: token mint precision |
cumulative_ | i64 | The cumulative deposits/borrows a user has made * Precision: token mint precision |
market_ | u16 | The market index of the corresponding spot market |
balance_ | SpotBalanceType | Whether the position is deposit or borrow |
open_orders | u8 | Number of open orders |
padding | [u8; 4] | Padding |
StakedSettingsConfig#
Struct types::.
| Field | Type | Description |
|---|---|---|
oracle | Pubkey | |
asset_ | WrappedI80F48 | |
asset_ | WrappedI80F48 | |
deposit_ | u64 | |
total_ | u64 | |
oracle_ | u16 | |
risk_tier | RiskTier | WARN: 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::.
| Field | Type | Description |
|---|---|---|
oracle | Option< | |
asset_ | Option< | |
asset_ | Option< | |
deposit_ | Option<u64> | |
total_ | Option<u64> | |
oracle_ | Option<u16> | |
risk_tier | Option< | 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::.
| 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::.
| Field | Type | Description |
|---|---|---|
daily_limit | u32 | Maximum USD value that can be withdrawn per day via deleverage (0 = no limit) |
withdrawn_ | u32 | USD value withdrawn today via deleverage (approximate, rounded) |
last_ | i64 | Unix timestamp of the last daily counter reset |
WrappedI80F48#
Struct types::.
| Field | Type |
|---|---|
value | [u8; 16] |