#[repr(C)]pub struct StakePool {Show 30 fields
pub account_type: AccountType,
pub manager: Pubkey,
pub staker: Pubkey,
pub stake_deposit_authority: Pubkey,
pub stake_withdraw_bump_seed: u8,
pub validator_list: Pubkey,
pub reserve_stake: Pubkey,
pub pool_mint: Pubkey,
pub manager_fee_account: Pubkey,
pub token_program_id: Pubkey,
pub total_lamports: u64,
pub pool_token_supply: u64,
pub last_update_epoch: u64,
pub lockup: Lockup,
pub epoch_fee: Fee,
pub next_epoch_fee: FutureEpoch<Fee>,
pub preferred_deposit_validator_vote_address: Option<Pubkey>,
pub preferred_withdraw_validator_vote_address: Option<Pubkey>,
pub stake_deposit_fee: Fee,
pub stake_withdrawal_fee: Fee,
pub next_stake_withdrawal_fee: FutureEpoch<Fee>,
pub stake_referral_fee: u8,
pub sol_deposit_authority: Option<Pubkey>,
pub sol_deposit_fee: Fee,
pub sol_referral_fee: u8,
pub sol_withdraw_authority: Option<Pubkey>,
pub sol_withdrawal_fee: Fee,
pub next_sol_withdrawal_fee: FutureEpoch<Fee>,
pub last_epoch_pool_token_supply: u64,
pub last_epoch_total_lamports: u64,
}Expand description
Initialized program details.
Fields§
§account_type: AccountTypeAccount type, must be StakePool currently
manager: PubkeyManager authority, allows for updating the staker, manager, and fee account
staker: PubkeyStaker authority, allows for adding and removing validators, and managing stake distribution
Stake deposit authority
If a depositor pubkey is specified on initialization, then deposits must
be signed by this authority. If no deposit authority is specified,
then the stake pool will default to the result of:
Pubkey::find_program_address( &[&stake_pool_address.as_ref(), b"deposit"], program_id, )
stake_withdraw_bump_seed: u8Stake withdrawal authority bump seed
for create_program_address(&[state::StakePool account, "withdrawal"])
validator_list: PubkeyValidator stake list storage account
reserve_stake: PubkeyReserve stake account, holds deactivated stake
pool_mint: PubkeyPool Mint
manager_fee_account: PubkeyManager fee account
token_program_id: PubkeyPool token program id
total_lamports: u64Total stake under management.
Note that if last_update_epoch does not match the current epoch then
this field may not be accurate
pool_token_supply: u64Total supply of pool tokens (should always match the supply in the Pool Mint)
last_update_epoch: u64Last epoch the total_lamports field was updated
lockup: LockupLockup that all stakes in the pool must have
epoch_fee: FeeFee taken as a proportion of rewards each epoch
next_epoch_fee: FutureEpoch<Fee>Fee for next epoch
preferred_deposit_validator_vote_address: Option<Pubkey>Preferred deposit validator vote account pubkey
preferred_withdraw_validator_vote_address: Option<Pubkey>Preferred withdraw validator vote account pubkey
stake_deposit_fee: FeeFee assessed on stake deposits
stake_withdrawal_fee: FeeFee assessed on withdrawals
next_stake_withdrawal_fee: FutureEpoch<Fee>Future stake withdrawal fee, to be set for the following epoch
stake_referral_fee: u8Fees paid out to referrers on referred stake deposits.
Expressed as a percentage (0 - 100) of deposit fees.
i.e. stake_deposit_fee% of stake deposited is collected as deposit
fees for every deposit and stake_referral_fee% of the collected
stake deposit fees is paid out to the referrer
Toggles whether the DepositSol instruction requires a signature from
this sol_deposit_authority
sol_deposit_fee: FeeFee assessed on SOL deposits
sol_referral_fee: u8Fees paid out to referrers on referred SOL deposits.
Expressed as a percentage (0 - 100) of SOL deposit fees.
i.e. sol_deposit_fee% of SOL deposited is collected as deposit fees
for every deposit and sol_referral_fee% of the collected SOL
deposit fees is paid out to the referrer
Toggles whether the WithdrawSol instruction requires a signature from
the deposit_authority
sol_withdrawal_fee: FeeFee assessed on SOL withdrawals
next_sol_withdrawal_fee: FutureEpoch<Fee>Future SOL withdrawal fee, to be set for the following epoch
last_epoch_pool_token_supply: u64Last epoch’s total pool tokens, used only for APR estimation
last_epoch_total_lamports: u64Last epoch’s total lamports, used only for APR estimation
Implementations§
Source§impl StakePool
impl StakePool
Sourcepub fn calc_pool_tokens_for_deposit(&self, stake_lamports: u64) -> Option<u64>
pub fn calc_pool_tokens_for_deposit(&self, stake_lamports: u64) -> Option<u64>
calculate the pool tokens that should be minted for a deposit of
stake_lamports
Sourcepub fn calc_lamports_withdraw_amount(&self, pool_tokens: u64) -> Option<u64>
pub fn calc_lamports_withdraw_amount(&self, pool_tokens: u64) -> Option<u64>
calculate lamports amount on withdrawal
Sourcepub fn calc_pool_tokens_stake_withdrawal_fee(
&self,
pool_tokens: u64,
) -> Option<u64>
pub fn calc_pool_tokens_stake_withdrawal_fee( &self, pool_tokens: u64, ) -> Option<u64>
calculate pool tokens to be deducted as withdrawal fees
Sourcepub fn calc_pool_tokens_sol_withdrawal_fee(
&self,
pool_tokens: u64,
) -> Option<u64>
pub fn calc_pool_tokens_sol_withdrawal_fee( &self, pool_tokens: u64, ) -> Option<u64>
calculate pool tokens to be deducted as withdrawal fees
Sourcepub fn calc_pool_tokens_stake_deposit_fee(
&self,
pool_tokens_minted: u64,
) -> Option<u64>
pub fn calc_pool_tokens_stake_deposit_fee( &self, pool_tokens_minted: u64, ) -> Option<u64>
calculate pool tokens to be deducted as stake deposit fees
Sourcepub fn calc_pool_tokens_stake_referral_fee(
&self,
stake_deposit_fee: u64,
) -> Option<u64>
pub fn calc_pool_tokens_stake_referral_fee( &self, stake_deposit_fee: u64, ) -> Option<u64>
calculate pool tokens to be deducted from deposit fees as referral fees
Sourcepub fn calc_pool_tokens_sol_deposit_fee(
&self,
pool_tokens_minted: u64,
) -> Option<u64>
pub fn calc_pool_tokens_sol_deposit_fee( &self, pool_tokens_minted: u64, ) -> Option<u64>
calculate pool tokens to be deducted as SOL deposit fees
Sourcepub fn calc_pool_tokens_sol_referral_fee(
&self,
sol_deposit_fee: u64,
) -> Option<u64>
pub fn calc_pool_tokens_sol_referral_fee( &self, sol_deposit_fee: u64, ) -> Option<u64>
calculate pool tokens to be deducted from SOL deposit fees as referral fees
Sourcepub fn calc_epoch_fee_amount(&self, reward_lamports: u64) -> Option<u64>
pub fn calc_epoch_fee_amount(&self, reward_lamports: u64) -> Option<u64>
Calculate the fee in pool tokens that goes to the manager
This function assumes that reward_lamports has not already been added
to the stake pool’s total_lamports
Sourcepub fn get_lamports_per_pool_token(&self) -> Option<u64>
pub fn get_lamports_per_pool_token(&self) -> Option<u64>
Get the current value of pool tokens, rounded up
Sourcepub fn check_validator_list(
&self,
validator_list_info: &AccountInfo<'_>,
) -> Result<(), ProgramError>
pub fn check_validator_list( &self, validator_list_info: &AccountInfo<'_>, ) -> Result<(), ProgramError>
Check the validator list is valid
Sourcepub fn check_reserve_stake(
&self,
reserve_stake_info: &AccountInfo<'_>,
) -> Result<(), ProgramError>
pub fn check_reserve_stake( &self, reserve_stake_info: &AccountInfo<'_>, ) -> Result<(), ProgramError>
Check the reserve stake is valid
Sourcepub fn is_uninitialized(&self) -> bool
pub fn is_uninitialized(&self) -> bool
Check if StakePool is currently uninitialized
Sourcepub fn update_fee(&mut self, fee: &FeeType) -> Result<(), StakePoolError>
pub fn update_fee(&mut self, fee: &FeeType) -> Result<(), StakePoolError>
Updates one of the StakePool’s fees.
Trait Implementations§
Source§impl BorshDeserialize for StakePool
impl BorshDeserialize for StakePool
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSchema for StakePool
impl BorshSchema for StakePool
Source§fn declaration() -> Declaration
fn declaration() -> Declaration
Source§fn add_definitions_recursively(
definitions: &mut BTreeMap<Declaration, Definition>,
)
fn add_definitions_recursively( definitions: &mut BTreeMap<Declaration, Definition>, )
Source§impl BorshSerialize for StakePool
impl BorshSerialize for StakePool
impl StructuralPartialEq for StakePool
Auto Trait Implementations§
impl Freeze for StakePool
impl RefUnwindSafe for StakePool
impl Send for StakePool
impl Sync for StakePool
impl Unpin for StakePool
impl UnwindSafe for StakePool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more