StakePool

Struct StakePool 

Source
#[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: AccountType

Account type, must be StakePool currently

§manager: Pubkey

Manager authority, allows for updating the staker, manager, and fee account

§staker: Pubkey

Staker authority, allows for adding and removing validators, and managing stake distribution

§stake_deposit_authority: Pubkey

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: u8

Stake withdrawal authority bump seed for create_program_address(&[state::StakePool account, "withdrawal"])

§validator_list: Pubkey

Validator stake list storage account

§reserve_stake: Pubkey

Reserve stake account, holds deactivated stake

§pool_mint: Pubkey

Pool Mint

§manager_fee_account: Pubkey

Manager fee account

§token_program_id: Pubkey

Pool token program id

§total_lamports: u64

Total 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: u64

Total supply of pool tokens (should always match the supply in the Pool Mint)

§last_update_epoch: u64

Last epoch the total_lamports field was updated

§lockup: Lockup

Lockup that all stakes in the pool must have

§epoch_fee: Fee

Fee 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: Fee

Fee assessed on stake deposits

§stake_withdrawal_fee: Fee

Fee assessed on withdrawals

§next_stake_withdrawal_fee: FutureEpoch<Fee>

Future stake withdrawal fee, to be set for the following epoch

§stake_referral_fee: u8

Fees 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

§sol_deposit_authority: Option<Pubkey>

Toggles whether the DepositSol instruction requires a signature from this sol_deposit_authority

§sol_deposit_fee: Fee

Fee assessed on SOL deposits

§sol_referral_fee: u8

Fees 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

§sol_withdraw_authority: Option<Pubkey>

Toggles whether the WithdrawSol instruction requires a signature from the deposit_authority

§sol_withdrawal_fee: Fee

Fee 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: u64

Last epoch’s total pool tokens, used only for APR estimation

§last_epoch_total_lamports: u64

Last epoch’s total lamports, used only for APR estimation

Implementations§

Source§

impl StakePool

Source

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

Source

pub fn calc_lamports_withdraw_amount(&self, pool_tokens: u64) -> Option<u64>

calculate lamports amount on withdrawal

Source

pub fn calc_pool_tokens_stake_withdrawal_fee( &self, pool_tokens: u64, ) -> Option<u64>

calculate pool tokens to be deducted as withdrawal fees

Source

pub fn calc_pool_tokens_sol_withdrawal_fee( &self, pool_tokens: u64, ) -> Option<u64>

calculate pool tokens to be deducted as withdrawal fees

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn get_lamports_per_pool_token(&self) -> Option<u64>

Get the current value of pool tokens, rounded up

Source

pub fn check_validator_list( &self, validator_list_info: &AccountInfo<'_>, ) -> Result<(), ProgramError>

Check the validator list is valid

Source

pub fn check_reserve_stake( &self, reserve_stake_info: &AccountInfo<'_>, ) -> Result<(), ProgramError>

Check the reserve stake is valid

Source

pub fn is_valid(&self) -> bool

Check if StakePool is actually initialized as a stake pool

Source

pub fn is_uninitialized(&self) -> bool

Check if StakePool is currently uninitialized

Source

pub fn update_fee(&mut self, fee: &FeeType) -> Result<(), StakePoolError>

Updates one of the StakePool’s fees.

Trait Implementations§

Source§

impl BorshDeserialize for StakePool

Source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

Source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
Source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSchema for StakePool

Source§

fn declaration() -> Declaration

Get the name of the type without brackets.
Source§

fn add_definitions_recursively( definitions: &mut BTreeMap<Declaration, Definition>, )

Recursively, using DFS, add type definitions required for this type. Type definition partially explains how to serialize/deserialize a type.
Source§

impl BorshSerialize for StakePool

Source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

Source§

impl Clone for StakePool

Source§

fn clone(&self) -> StakePool

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StakePool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StakePool

Source§

fn default() -> StakePool

Returns the “default value” for a type. Read more
Source§

impl PartialEq for StakePool

Source§

fn eq(&self, other: &StakePool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StakePool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V