Kamino Farms decoder
Decode Kamino Farms instructions and accounts in Rust with carbon-kamino-farms-decoder 2.0.0. Program ID FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr.
On this page
carbon-kamino-farms-decoder decodes the instructions and accounts of the Kamino Farms program (FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr): 26 instructions, 4 account types. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.
| Crate | carbon-kamino-farms-decoder 2.0.0 |
| Install | cargo add carbon-kamino-farms-decoder@2. |
| Program ID | FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr (carbon_) |
| Category | Other |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-kamino-farms-decoder/2.0.0 |
| Source | decoders/kamino-farms-decoder |
More program decoders without a category: Jupiter DCA, Pump Fees, Raydium Liquidity Locking, Swig. To decode several in one pipeline, see other program 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 Kamino Farms transactions from the public RPC and prints every decoded AddRewards instruction. Add the dependencies:
cargo add carbon-core@2.0.0 carbon-kamino-farms-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_kamino_farms_decoder::{
instructions::KaminoFarmsInstruction, KaminoFarmsDecoder, 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(KaminoFarmsDecoder, InstructionLogger)
.build()?
.run()
.await
}
struct InstructionLogger;
impl Processor<InstructionProcessorInputType<'_, KaminoFarmsInstruction>> for InstructionLogger {
async fn process(
&mut self,
input: &InstructionProcessorInputType<'_, KaminoFarmsInstruction>,
) -> CarbonResult<()> {
let signature = input.metadata.transaction_metadata.signature;
if let KaminoFarmsInstruction::AddRewards { data, accounts, .. } = input.decoded_instruction {
println!("add_rewards {signature}: {data:?} payer={}", accounts.payer);
}
Ok(())
}
}RUST_LOG=info cargo runEach AddRewards instruction prints one line with the transaction signature and the decoded AddRewards 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.
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 GlobalConfig 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_kamino_farms_decoder::{accounts::KaminoFarmsAccount, KaminoFarmsDecoder, 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(KaminoFarmsDecoder, AccountLogger)
.build()?
.run()
.await
}
struct AccountLogger;
impl Processor<AccountProcessorInputType<'_, KaminoFarmsAccount>> for AccountLogger {
async fn process(
&mut self,
input: &AccountProcessorInputType<'_, KaminoFarmsAccount>,
) -> CarbonResult<()> {
if let KaminoFarmsAccount::GlobalConfig(global_config) = &input.decoded_account.data {
println!("global_config {}: {global_config:?}", input.metadata.pubkey);
}
Ok(())
}
}RUST_LOG=info cargo runEach update to a GlobalConfig 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 KaminoFarmsInstruction. Each is KaminoFarmsInstruction::, 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
FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr. - 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.
AddRewards#
Discriminator 58ba19e326895117 · data AddRewards · accounts AddRewardsInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
reward_ | u64 |
Required accounts: 8; extras go to remaining.
Fields of AddRewardsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | reward_mint | Pubkey |
| 3 | reward_ | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | payer_ | Pubkey |
| 6 | scope_ | Option< |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
DepositToFarmVault#
Discriminator 83a6405e6cd572b7 · data DepositToFarmVault · accounts DepositToFarmVaultInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 5; extras go to remaining.
Fields of DepositToFarmVaultInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | depositor | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | farm_vault | Pubkey |
| 3 | depositor_ | Pubkey |
| 4 | token_ | Pubkey |
| 5… | remaining | Vec< |
HarvestReward#
Discriminator 44c8e4e9b820e2bc · data HarvestReward · accounts HarvestRewardInstructionAccounts.
| Field | Type |
|---|---|
reward_ | u64 |
Required accounts: 11; extras go to remaining.
Fields of HarvestRewardInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | user_state | Pubkey |
| 2 | farm_state | Pubkey |
| 3 | global_ | Pubkey |
| 4 | reward_mint | Pubkey |
| 5 | user_ | Pubkey |
| 6 | rewards_ | Pubkey |
| 7 | rewards_ | Pubkey |
| 8 | farm_ | Pubkey |
| 9 | scope_ | Option< |
| 10 | token_ | Pubkey |
| 11… | remaining | Vec< |
IdlMissingTypes#
Discriminator 8250269950d4b6fd · data IdlMissingTypes · accounts IdlMissingTypesInstructionAccounts.
| Field | Type |
|---|---|
global_ | GlobalConfigOption |
farm_ | FarmConfigOption |
time_unit | TimeUnit |
locking_ | LockingMode |
reward_type | RewardType |
Required accounts: 2; extras go to remaining.
Fields of IdlMissingTypesInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | global_ | Pubkey |
| 2… | remaining | Vec< |
InitializeFarm#
Discriminator fc1cb9acf44a75a5 · data InitializeFarm · accounts InitializeFarmInstructionAccounts.
No data fields.
Required accounts: 9; extras go to remaining.
Fields of InitializeFarmInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | farm_admin | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | global_ | Pubkey |
| 3 | farm_vault | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | token_mint | Pubkey |
| 6 | token_ | Pubkey |
| 7 | system_ | Pubkey |
| 8 | rent | Pubkey |
| 9… | remaining | Vec< |
InitializeFarmDelegated#
Discriminator fa546519334dcc5b · data InitializeFarmDelegated · accounts InitializeFarmDelegatedInstructionAccounts.
No data fields.
Required accounts: 7; extras go to remaining.
Fields of InitializeFarmDelegatedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | farm_admin | Pubkey |
| 1 | farm_ | Pubkey |
| 2 | farm_state | Pubkey |
| 3 | global_ | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | system_ | Pubkey |
| 6 | rent | Pubkey |
| 7… | remaining | Vec< |
InitializeGlobalConfig#
Discriminator 71d87a83e1d11637 · data InitializeGlobalConfig · accounts InitializeGlobalConfigInstructionAccounts.
No data fields.
Required accounts: 4; extras go to remaining.
Fields of InitializeGlobalConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | global_ | Pubkey |
| 2 | treasury_ | Pubkey |
| 3 | system_ | Pubkey |
| 4… | remaining | Vec< |
InitializeReward#
Discriminator 5f87c0c4f281e644 · data InitializeReward · accounts InitializeRewardInstructionAccounts.
No data fields.
Required accounts: 11; extras go to remaining.
Fields of InitializeRewardInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | farm_admin | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | global_ | Pubkey |
| 3 | reward_mint | Pubkey |
| 4 | reward_ | Pubkey |
| 5 | reward_ | Pubkey |
| 6 | farm_ | Pubkey |
| 7 | treasury_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | system_ | Pubkey |
| 10 | rent | Pubkey |
| 11… | remaining | Vec< |
InitializeUser#
Discriminator 6f11b9fa3c7a26fe · data InitializeUser · accounts InitializeUserInstructionAccounts.
No data fields.
Required accounts: 8; extras go to remaining.
Fields of InitializeUserInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | authority | Pubkey |
| 1 | payer | Pubkey |
| 2 | owner | Pubkey |
| 3 | delegatee | Pubkey |
| 4 | user_state | Pubkey |
| 5 | farm_state | Pubkey |
| 6 | system_ | Pubkey |
| 7 | rent | Pubkey |
| 8… | remaining | Vec< |
RefreshFarm#
Discriminator d6838ab790c2ac2a · data RefreshFarm · accounts RefreshFarmInstructionAccounts.
No data fields.
Required accounts: 1 (2 listed); extras go to remaining.
Fields of RefreshFarmInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | farm_state | Pubkey |
| 1 | scope_ | Option< |
| 2… | remaining | Vec< |
RefreshUserState#
Discriminator 01870c3ef38c4d6c · data RefreshUserState · accounts RefreshUserStateInstructionAccounts.
No data fields.
Required accounts: 2 (3 listed); extras go to remaining.
Fields of RefreshUserStateInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | user_state | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | scope_ | Option< |
| 3… | remaining | Vec< |
RewardUserOnce#
Discriminator db8939165eba6072 · data RewardUserOnce · accounts RewardUserOnceInstructionAccounts.
| Field | Type |
|---|---|
reward_ | u64 |
amount | u64 |
expected_ | u64 |
Required accounts: 3; extras go to remaining.
Fields of RewardUserOnceInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | delegate_ | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | user_state | Pubkey |
| 3… | remaining | Vec< |
SetStakeDelegated#
Discriminator 49abb84b1e38c6df · data SetStakeDelegated · accounts SetStakeDelegatedInstructionAccounts.
| Field | Type |
|---|---|
new_amount | u64 |
Required accounts: 3; extras go to remaining.
Fields of SetStakeDelegatedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | delegate_ | Pubkey |
| 1 | user_state | Pubkey |
| 2 | farm_state | Pubkey |
| 3… | remaining | Vec< |
Stake#
Discriminator ceb0ca12c8d1b36c · data Stake · accounts StakeInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 8; extras go to remaining.
Fields of StakeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | user_state | Pubkey |
| 2 | farm_state | Pubkey |
| 3 | farm_vault | Pubkey |
| 4 | user_ata | Pubkey |
| 5 | token_mint | Pubkey |
| 6 | scope_ | Option< |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
TransferOwnership#
Discriminator 41b1d749352d632f · data TransferOwnership · accounts TransferOwnershipInstructionAccounts.
No data fields.
Required accounts: 9; extras go to remaining.
Fields of TransferOwnershipInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | old_owner | Pubkey |
| 1 | payer | Pubkey |
| 2 | new_owner | Pubkey |
| 3 | old_ | Pubkey |
| 4 | new_ | Pubkey |
| 5 | farm_state | Pubkey |
| 6 | scope_ | Option< |
| 7 | system_ | Pubkey |
| 8 | rent | Pubkey |
| 9… | remaining | Vec< |
Unstake#
Discriminator 5a5f6b2acd7c32e1 · data Unstake · accounts UnstakeInstructionAccounts.
| Field | Type |
|---|---|
stake_ | u128 |
Required accounts: 3 (4 listed); extras go to remaining.
Fields of UnstakeInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | user_state | Pubkey |
| 2 | farm_state | Pubkey |
| 3 | scope_ | Option< |
| 4… | remaining | Vec< |
UpdateFarmAdmin#
Discriminator 142588137aef2482 · data UpdateFarmAdmin · accounts UpdateFarmAdminInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of UpdateFarmAdminInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | pending_ | Pubkey |
| 1 | farm_state | Pubkey |
| 2… | remaining | Vec< |
UpdateFarmConfig#
Discriminator d6b0bcf4cb3be6cf · data UpdateFarmConfig · accounts UpdateFarmConfigInstructionAccounts.
| Field | Type |
|---|---|
mode | u16 |
data | Vec<u8> |
Required accounts: 2 (3 listed); extras go to remaining.
Fields of UpdateFarmConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | signer | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | scope_ | Option< |
| 3… | remaining | Vec< |
UpdateGlobalConfig#
Discriminator a45482bd6f3afac8 · data UpdateGlobalConfig · accounts UpdateGlobalConfigInstructionAccounts.
| Field | Type |
|---|---|
mode | u8 |
value | [u8; 32] |
Required accounts: 2; extras go to remaining.
Fields of UpdateGlobalConfigInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | global_ | Pubkey |
| 2… | remaining | Vec< |
UpdateGlobalConfigAdmin#
Discriminator b85717c19ceeaf77 · data UpdateGlobalConfigAdmin · accounts UpdateGlobalConfigAdminInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of UpdateGlobalConfigAdminInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | pending_ | Pubkey |
| 1 | global_ | Pubkey |
| 2… | remaining | Vec< |
UpdateSecondDelegatedAuthority#
Discriminator 7f1a06b5cbf87540 · data UpdateSecondDelegatedAuthority · accounts UpdateSecondDelegatedAuthorityInstructionAccounts.
No data fields.
Required accounts: 4; extras go to remaining.
Fields of UpdateSecondDelegatedAuthorityInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | global_ | Pubkey |
| 3 | new_ | Pubkey |
| 4… | remaining | Vec< |
WithdrawFromFarmVault#
Discriminator 165280fa564f7c4e · data WithdrawFromFarmVault · accounts WithdrawFromFarmVaultInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 6; extras go to remaining.
Fields of WithdrawFromFarmVaultInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | withdraw_ | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | withdrawer_ | Pubkey |
| 3 | farm_vault | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | token_ | Pubkey |
| 6… | remaining | Vec< |
WithdrawReward#
Discriminator bfbbb0890919bbf4 · data WithdrawReward · accounts WithdrawRewardInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
reward_ | u64 |
Required accounts: 8; extras go to remaining.
Fields of WithdrawRewardInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | farm_admin | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | reward_mint | Pubkey |
| 3 | reward_ | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | admin_ | Pubkey |
| 6 | scope_ | Option< |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
WithdrawSlashedAmount#
Discriminator cad9434aac168cd8 · data WithdrawSlashedAmount · accounts WithdrawSlashedAmountInstructionAccounts.
No data fields.
Required accounts: 6; extras go to remaining.
Fields of WithdrawSlashedAmountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | crank | Pubkey |
| 1 | farm_state | Pubkey |
| 2 | slashed_ | Pubkey |
| 3 | farm_vault | Pubkey |
| 4 | farm_ | Pubkey |
| 5 | token_ | Pubkey |
| 6… | remaining | Vec< |
WithdrawTreasury#
Discriminator 283f7a9e90d85360 · data WithdrawTreasury · accounts WithdrawTreasuryInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 7; extras go to remaining.
Fields of WithdrawTreasuryInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | global_ | Pubkey |
| 1 | global_ | Pubkey |
| 2 | reward_mint | Pubkey |
| 3 | reward_ | Pubkey |
| 4 | treasury_ | Pubkey |
| 5 | withdraw_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
WithdrawUnstakedDeposits#
Discriminator 2466bb31dc248443 · data WithdrawUnstakedDeposits · accounts WithdrawUnstakedDepositsInstructionAccounts.
No data fields.
Required accounts: 7; extras go to remaining.
Fields of WithdrawUnstakedDepositsInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | owner | Pubkey |
| 1 | user_state | Pubkey |
| 2 | farm_state | Pubkey |
| 3 | user_ata | Pubkey |
| 4 | farm_vault | Pubkey |
| 5 | farm_ | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
Accounts#
Variants of KaminoFarmsAccount. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
FarmState#
Discriminator c666d84a3f42a3be · accounts::.
| Field | Type | Description |
|---|---|---|
farm_admin | Pubkey | |
global_ | Pubkey | |
token | TokenInfo | |
reward_ | [RewardInfo; 10] | |
num_ | u64 | |
num_users | u64 | Data used to calculate the rewards of the user |
total_ | u64 | The number of token in the farm_vault staked (getting rewards and fees) Set such as farm_ |
farm_vault | Pubkey | |
farm_ | Pubkey | |
farm_ | u64 | |
delegate_ | Pubkey | Only used for delegate farms Set to default() otherwise |
time_unit | u8 | Raw representation of a TimeUnit Seconds = 0, Slots = 1 |
is_ | u8 | Automatically set to true in case of a full authority withdrawal If true, the farm is frozen and no more deposits are allowed |
is_ | u8 | Indicates if the farm is a delegate farm If true, the farm is a delegate farm and the delegate_ is set* |
is_ | u8 | If set to 1, indicates that the "reward user once" feature is enabled |
is_ | u8 | |
padding0 | [u8; 3] | |
withdraw_ | Pubkey | Withdraw authority for the farm, allowed to lock deposited funds and withdraw them Set to default() if unused (only the depositors can withdraw their funds) |
deposit_ | u32 | Delay between a user deposit and the moment it is considered as staked 0 if unused |
withdrawal_ | u32 | Delay between a user unstake and the ability to withdraw his deposit. |
total_ | u128 | Total active stake of tokens in the farm (scaled from Decimal representation). |
total_ | u128 | Total pending stake of tokens in the farm (scaled from Decimal representation). (can be used by withdraw_ but don't get rewards or fees) |
total_ | u64 | Total pending amount of tokens in the farm |
slashed_ | u64 | Slashed amounts from early withdrawal |
slashed_ | u64 | |
slashed_ | Pubkey | |
locking_ | u64 | Locking stake |
locking_ | u64 | |
locking_ | u64 | |
locking_ | u64 | |
deposit_ | u64 | |
scope_ | Pubkey | |
scope_ | u64 | |
scope_ | u64 | |
pending_ | Pubkey | |
strategy_id | Pubkey | |
delegated_ | Pubkey | |
vault_id | Pubkey | |
second_ | Pubkey | |
padding | [u64; 74] |
GlobalConfig#
Discriminator 95089ccaa0fcb0d9 · accounts::.
| Field | Type |
|---|---|
global_ | Pubkey |
treasury_ | u64 |
treasury_ | Pubkey |
treasury_ | u64 |
pending_ | Pubkey |
padding1 | [u128; 126] |
OraclePrices#
Discriminator 598076dd0648b492 · accounts::.
| Field | Type |
|---|---|
oracle_ | Pubkey |
prices | [DatedPrice; 512] |
UserState#
Discriminator 48b155f94ca7ba7e · accounts::.
| Field | Type | Description |
|---|---|---|
user_id | u64 | |
farm_state | Pubkey | |
owner | Pubkey | |
is_ | u8 | Indicate if this user state is part of a delegated farm |
padding0 | [u8; 7] | |
rewards_ | [u128; 10] | Rewards tally used for computation of gained rewards (scaled from Decimal representation). |
rewards_ | [u64; 10] | Number of reward tokens ready for claim |
last_ | [u64; 10] | |
active_ | u128 | User stake deposited and usable, generating rewards and fees. (scaled from Decimal representation). |
pending_ | u128 | User stake deposited but not usable and not generating rewards yet. (scaled from Decimal representation). |
pending_ | u64 | After this timestamp, pending user stake can be moved to user stake Initialized to now() + delayed user stake period |
pending_ | u128 | User deposits unstaked, pending for withdrawal, not usable and not generating rewards. (scaled from Decimal representation). |
pending_ | u64 | After this timestamp, user can withdraw their deposit. |
bump | u64 | User bump used for account address validation |
delegatee | Pubkey | Delegatee used for initialisation - useful to check against |
last_ | u64 | |
rewards_ | [u64; 10] | Cumulative rewards issued to the user - ONLY used for stats/analytics DO NOT USE IN ANY CALCULATIONS Old userStates will have this field populated only from the point of release not reflecting any historical data before this was released |
padding1 | [u64; 40] |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
DatedPrice#
Struct types::.
| Field | Type |
|---|---|
price | Price |
last_ | u64 |
unix_ | u64 |
reserved | [u64; 2] |
reserved2 | [u16; 3] |
index | u16 |
FarmConfigOption#
Enum types::.
| Variant |
|---|
UpdateRewardRps |
UpdateRewardMinClaimDuration |
WithdrawAuthority |
DepositWarmupPeriod |
WithdrawCooldownPeriod |
RewardType |
RpsDecimals |
LockingMode |
LockingStartTimestamp |
LockingDuration |
LockingEarlyWithdrawalPenaltyBps |
DepositCapAmount |
SlashedAmountSpillAddress |
ScopePricesAccount |
ScopeOraclePriceId |
ScopeOracleMaxAge |
UpdateRewardScheduleCurvePoints |
UpdatePendingFarmAdmin |
UpdateStrategyId |
UpdateDelegatedRpsAdmin |
UpdateVaultId |
UpdateExtraDelegatedAuthority |
UpdateIsRewardUserOnceEnabled |
UpdateDelegatedAuthority |
UpdateIsHarvestingPermissionless |
GlobalConfigOption#
Enum types::.
| Variant |
|---|
SetPendingGlobalAdmin |
SetTreasuryFeeBps |
LockingMode#
Enum types::.
| Variant |
|---|
None |
Continuous |
WithExpiry |
Price#
Struct types::.
| Field | Type |
|---|---|
value | u64 |
exp | u64 |
RewardInfo#
Struct types::.
| Field | Type |
|---|---|
token | TokenInfo |
rewards_ | Pubkey |
rewards_ | u64 |
reward_ | RewardScheduleCurve |
min_ | u64 |
last_ | u64 |
rewards_ | u64 |
rewards_ | u64 |
reward_ | u128 |
placeholder0 | u64 |
reward_type | u8 |
rewards_ | u8 |
padding0 | [u8; 6] |
padding1 | [u64; 20] |
RewardPerTimeUnitPoint#
Struct types::.
| Field | Type |
|---|---|
ts_start | u64 |
reward_ | u64 |
RewardScheduleCurve#
Struct types::.
| Field | Type | Description |
|---|---|---|
points | [RewardPerTimeUnitPoint; 20] | This is a stepwise function, meaning that each point represents how many rewards are issued per time unit since the beginning of that point until the beginning of the next point. This is not a linear curve, there is no interpolation going on. A curve can be [[t0, 100], [t1, 50], [t2, 0]] meaning that from t0 to t1, 100 rewards are issued per time unit, from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops Another curve, can be [[t0, 100], [u64::max, 0]] meaning that from t0 to u64::max, 100 rewards are issued per time unit |
RewardType#
Enum types::.
| Variant |
|---|
Proportional |
Constant |
TimeUnit#
Enum types::.
| Variant |
|---|
Seconds |
Slots |
TokenInfo#
Struct types::.
| Field | Type |
|---|---|
mint | Pubkey |
decimals | u64 |
token_ | Pubkey |
padding | [u64; 6] |