#[repr(C)]
pub enum StakePoolInstruction {
Show 17 variants
Initialize {
fee: Fee,
withdrawal_fee: Fee,
deposit_fee: Fee,
referral_fee: u8,
max_validators: u32,
},
AddValidatorToPool,
RemoveValidatorFromPool,
DecreaseValidatorStake {
lamports: u64,
transient_stake_seed: u64,
},
IncreaseValidatorStake {
lamports: u64,
transient_stake_seed: u64,
},
SetPreferredValidator {
validator_type: PreferredValidatorType,
validator_vote_address: Option<Pubkey>,
},
UpdateValidatorListBalance {
start_index: u32,
no_merge: bool,
},
UpdateStakePoolBalance,
CleanupRemovedValidatorEntries,
DepositStake,
WithdrawStake(u64),
SetManager,
SetFee {
fee: FeeType,
},
SetStaker,
DepositSol(u64),
SetFundingAuthority(FundingType),
WithdrawSol(u64),
}
Expand description
Instructions supported by the StakePool program.
Variants
Initialize
Fields
fee: Fee
Fee assessed as percentage of perceived rewards
withdrawal_fee: Fee
Fee charged per withdrawal as percentage of withdrawal
deposit_fee: Fee
Fee charged per deposit as percentage of deposit
referral_fee: u8
Percentage [0-100] of deposit_fee that goes to referrer
max_validators: u32
Maximum expected number of validators
Initializes a new StakePool.
[w]
New StakePool to create.[s]
Manager[]
Staker[]
Stake pool withdraw authority[w]
Uninitialized validator stake list storage account[]
Reserve stake account must be initialized, have zero balance, and staker / withdrawer authority set to pool withdraw authority.[]
Pool token mint. Must have zero supply, owned by withdraw authority.[]
Pool account to deposit the generated fee for manager.[]
Token program id[]
(Optional) Deposit authority that must sign all deposits. Defaults to the program address generated usingfind_deposit_authority_program_address
, making deposits permissionless.
AddValidatorToPool
(Staker only) Adds stake account delegated to validator to the pool’s list of managed validators.
The stake account will have the rent-exempt amount plus
crate::MINIMUM_ACTIVE_STAKE
(currently 0.001 SOL).
[w]
Stake pool[s]
Staker[ws]
Funding account (must be a system account)[]
Stake pool withdraw authority[w]
Validator stake list storage account[w]
Stake account to add to the pool[]
Validator this stake account will be delegated to[]
Rent sysvar[]
Clock sysvar- ‘[]’ Stake history sysvar
- ‘[]’ Stake config sysvar
[]
System program[]
Stake program
RemoveValidatorFromPool
(Staker only) Removes validator from the pool
Only succeeds if the validator stake account has the minimum of
crate::MINIMUM_ACTIVE_STAKE
(currently 0.001 SOL) plus the rent-exempt
amount.
[w]
Stake pool[s]
Staker[]
Stake pool withdraw authority[]
New withdraw/staker authority to set in the stake account[w]
Validator stake list storage account[w]
Stake account to remove from the pool[]
Transient stake account, to check that that we’re not trying to activate[w]
Destination stake account, to receive the minimum SOL from the validator stake account[]
Sysvar clock[]
Stake program id,
DecreaseValidatorStake
Fields
lamports: u64
amount of lamports to split into the transient stake account
transient_stake_seed: u64
seed used to create transient stake account
(Staker only) Decrease active stake on a validator, eventually moving it to the reserve
Internally, this instruction splits a validator stake account into its corresponding transient stake account and deactivates it.
In order to rebalance the pool without taking custody, the staker needs a way of reducing the stake on a stake account. This instruction splits some amount of stake, up to the total activated stake, from the canonical validator stake account, into its “transient” stake account.
The instruction only succeeds if the transient stake account does not exist. The amount of lamports to move must be at least rent-exemption plus 1 lamport.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Canonical stake account to split from[w]
Transient stake account to receive split[]
Clock sysvar[]
Rent sysvar[]
System program[]
Stake program
IncreaseValidatorStake
Fields
lamports: u64
amount of lamports to increase on the given validator
transient_stake_seed: u64
seed used to create transient stake account
(Staker only) Increase stake on a validator from the reserve account
Internally, this instruction splits reserve stake into a transient stake
account and delegate to the appropriate validator. UpdateValidatorListBalance
will do the work of merging once it’s ready.
This instruction only succeeds if the transient stake account does not exist.
The minimum amount to move is rent-exemption plus crate::MINIMUM_ACTIVE_STAKE
(currently 0.001 SOL) in order to avoid issues on credits observed when
merging active stakes later.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Stake pool reserve stake[w]
Transient stake account[]
Validator vote account to delegate to- ‘[]’ Clock sysvar
- ‘[]’ Rent sysvar
[]
Stake History sysvar[]
Stake Config sysvar[]
System program[]
Stake program userdata: amount of lamports to increase on the given validator. The actual amount split into the transient stake account is:lamports + stake_rent_exemption
The rent-exemption of the stake account is withdrawn back to the reserve after it is merged.
SetPreferredValidator
Fields
validator_type: PreferredValidatorType
Affected operation (deposit or withdraw)
(Staker only) Set the preferred deposit or withdraw stake account for the stake pool
In order to avoid users abusing the stake pool as a free conversion between SOL staked on different validators, the staker can force all deposits and/or withdraws to go to one chosen account, or unset that account.
[w]
Stake pool[s]
Stake pool staker[]
Validator list
Fails if the validator is not part of the stake pool.
UpdateValidatorListBalance
Fields
start_index: u32
Index to start updating on the validator list
no_merge: bool
If true, don’t try merging transient stake accounts into the reserve or validator stake account. Useful for testing or if a particular stake account is in a bad state, but we still want to update
Updates balances of validator and transient stake accounts in the pool
While going through the pairs of validator and transient stake accounts, if the transient stake is inactive, it is merged into the reserve stake account. If the transient stake is active and has matching credits observed, it is merged into the canonical validator stake account. In all other states, nothing is done, and the balance is simply added to the canonical stake account balance.
[]
Stake pool[]
Stake pool withdraw authority[w]
Validator stake list storage account[w]
Reserve stake account[]
Sysvar clock[]
Sysvar stake history[]
Stake program- ..7+N ` [] N pairs of validator and transient stake accounts
UpdateStakePoolBalance
Updates total pool balance based on balances in the reserve and validator list
[w]
Stake pool[]
Stake pool withdraw authority[w]
Validator stake list storage account[]
Reserve stake account[w]
Account to receive pool fee tokens[w]
Pool mint account[]
Pool token program
CleanupRemovedValidatorEntries
Cleans up validator stake account entries marked as ReadyForRemoval
[]
Stake pool[w]
Validator stake list storage account
DepositStake
Deposit some stake into the pool. The output is a “pool” token representing ownership into the pool. Inputs are converted to the current ratio.
[w]
Stake pool[w]
Validator stake list storage account[s]/[]
Stake pool deposit authority[]
Stake pool withdraw authority[w]
Stake account to join the pool (withdraw authority for the stake account should be first set to the stake pool deposit authority)[w]
Validator stake account for the stake account to be merged with[w]
Reserve stake account, to withdraw rent exempt reserve[w]
User account to receive pool tokens[w]
Account to receive pool fee tokens[w]
Account to receive a portion of pool fee tokens as referral fees[w]
Pool token mint account- ‘[]’ Sysvar clock account
- ‘[]’ Sysvar stake history account
[]
Pool token program id,[]
Stake program id,
WithdrawStake(u64)
Withdraw the token from the pool at the current ratio.
Succeeds if the stake account has enough SOL to cover the desired amount of pool tokens, and if the withdrawal keeps the total staked amount above the minimum of rent-exempt amount + 0.001 SOL.
When allowing withdrawals, the order of priority goes:
- preferred withdraw validator stake account (if set)
- validator stake accounts
- transient stake accounts
- reserve stake account
A user can freely withdraw from a validator stake account, and if they are all at the minimum, then they can withdraw from transient stake accounts, and if they are all at minimum, then they can withdraw from the reserve.
[w]
Stake pool[w]
Validator stake list storage account[]
Stake pool withdraw authority[w]
Validator or reserve stake account to split[w]
Unitialized stake account to receive withdrawal[]
User account to set as a new withdraw authority[s]
User transfer authority, for pool token account[w]
User account with pool tokens to burn from[w]
Account to receive pool fee tokens[w]
Pool token mint account[]
Sysvar clock account (required)[]
Pool token program id[]
Stake program id, userdata: amount of pool tokens to withdraw
SetManager
(Manager only) Update manager
[w]
StakePool[s]
Manager[s]
New manager[]
New manager fee account
SetFee
Fields
fee: FeeType
Type of fee to update and value to update it to
(Manager only) Update fee
[w]
StakePool[s]
Manager
SetStaker
(Manager or staker only) Update staker
[w]
StakePool[s]
Manager or current staker- ’[]` New staker pubkey
DepositSol(u64)
Deposit SOL directly into the pool’s reserve account. The output is a “pool” token representing ownership into the pool. Inputs are converted to the current ratio.
[w]
Stake pool[]
Stake pool withdraw authority[w]
Reserve stake account, to deposit SOL[s]
Account providing the lamports to be deposited into the pool[w]
User account to receive pool tokens[w]
Account to receive fee tokens[w]
Account to receive a portion of fee as referral fees[w]
Pool token mint account[]
System program account[]
Token program id[s]
(Optional) Stake pool sol deposit authority.
SetFundingAuthority(FundingType)
(Manager only) Update SOL deposit authority
[w]
StakePool[s]
Manager- ’[]` New authority pubkey or none
WithdrawSol(u64)
Withdraw SOL directly from the pool’s reserve account. Fails if the reserve does not have enough SOL.
[w]
Stake pool[]
Stake pool withdraw authority[s]
User transfer authority, for pool token account[w]
User account to burn pool tokens[w]
Reserve stake account, to withdraw SOL[w]
Account receiving the lamports from the reserve, must be a system account[w]
Account to receive pool fee tokens[w]
Pool token mint account- ‘[]’ Clock sysvar
- ‘[]’ Stake history sysvar
[]
Stake program account[]
Token program id[s]
(Optional) Stake pool sol withdraw authority
Trait Implementations
sourceimpl BorshDeserialize for StakePoolInstruction where
Fee: BorshDeserialize,
Fee: BorshDeserialize,
Fee: BorshDeserialize,
u8: BorshDeserialize,
u32: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PreferredValidatorType: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
u32: BorshDeserialize,
bool: BorshDeserialize,
u64: BorshDeserialize,
FeeType: BorshDeserialize,
u64: BorshDeserialize,
FundingType: BorshDeserialize,
u64: BorshDeserialize,
impl BorshDeserialize for StakePoolInstruction where
Fee: BorshDeserialize,
Fee: BorshDeserialize,
Fee: BorshDeserialize,
u8: BorshDeserialize,
u32: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PreferredValidatorType: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
u32: BorshDeserialize,
bool: BorshDeserialize,
u64: BorshDeserialize,
FeeType: BorshDeserialize,
u64: BorshDeserialize,
FundingType: BorshDeserialize,
u64: BorshDeserialize,
sourceimpl BorshSchema for StakePoolInstruction
impl BorshSchema for StakePoolInstruction
sourcefn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
sourcefn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more
sourcefn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
sourceimpl BorshSerialize for StakePoolInstruction where
Fee: BorshSerialize,
Fee: BorshSerialize,
Fee: BorshSerialize,
u8: BorshSerialize,
u32: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
PreferredValidatorType: BorshSerialize,
Option<Pubkey>: BorshSerialize,
u32: BorshSerialize,
bool: BorshSerialize,
u64: BorshSerialize,
FeeType: BorshSerialize,
u64: BorshSerialize,
FundingType: BorshSerialize,
u64: BorshSerialize,
impl BorshSerialize for StakePoolInstruction where
Fee: BorshSerialize,
Fee: BorshSerialize,
Fee: BorshSerialize,
u8: BorshSerialize,
u32: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
PreferredValidatorType: BorshSerialize,
Option<Pubkey>: BorshSerialize,
u32: BorshSerialize,
bool: BorshSerialize,
u64: BorshSerialize,
FeeType: BorshSerialize,
u64: BorshSerialize,
FundingType: BorshSerialize,
u64: BorshSerialize,
sourceimpl Clone for StakePoolInstruction
impl Clone for StakePoolInstruction
sourcefn clone(&self) -> StakePoolInstruction
fn clone(&self) -> StakePoolInstruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StakePoolInstruction
impl Debug for StakePoolInstruction
sourceimpl PartialEq<StakePoolInstruction> for StakePoolInstruction
impl PartialEq<StakePoolInstruction> for StakePoolInstruction
sourcefn eq(&self, other: &StakePoolInstruction) -> bool
fn eq(&self, other: &StakePoolInstruction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StakePoolInstruction) -> bool
fn ne(&self, other: &StakePoolInstruction) -> bool
This method tests for !=
.
impl StructuralPartialEq for StakePoolInstruction
Auto Trait Implementations
impl RefUnwindSafe for StakePoolInstruction
impl Send for StakePoolInstruction
impl Sync for StakePoolInstruction
impl Unpin for StakePoolInstruction
impl UnwindSafe for StakePoolInstruction
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more