#[repr(C)]pub enum StakePoolInstruction {
Show 27 variants
Initialize {
fee: Fee,
withdrawal_fee: Fee,
deposit_fee: Fee,
referral_fee: u8,
max_validators: u32,
},
AddValidatorToPool(u32),
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),
CreateTokenMetadata {
name: String,
symbol: String,
uri: String,
},
UpdateTokenMetadata {
name: String,
symbol: String,
uri: String,
},
IncreaseAdditionalValidatorStake {
lamports: u64,
transient_stake_seed: u64,
ephemeral_stake_seed: u64,
},
DecreaseAdditionalValidatorStake {
lamports: u64,
transient_stake_seed: u64,
ephemeral_stake_seed: u64,
},
DecreaseValidatorStakeWithReserve {
lamports: u64,
transient_stake_seed: u64,
},
Redelegate {
lamports: u64,
source_transient_stake_seed: u64,
ephemeral_stake_seed: u64,
destination_transient_stake_seed: u64,
},
DepositStakeWithSlippage {
minimum_pool_tokens_out: u64,
},
WithdrawStakeWithSlippage {
pool_tokens_in: u64,
minimum_lamports_out: u64,
},
DepositSolWithSlippage {
lamports_in: u64,
minimum_pool_tokens_out: u64,
},
WithdrawSolWithSlippage {
pool_tokens_in: u64,
minimum_lamports_out: u64,
},
}
Expand description
Instructions supported by the StakePool program.
Variants§
Initialize
Fields
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(u32)
(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
max( crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation() )
.
It is funded from the stake pool reserve.
[w]
Stake pool[s]
Staker[w]
Reserve stake 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
userdata: optional non-zero u32 seed used for generating the validator stake address
RemoveValidatorFromPool
(Staker only) Removes validator from the pool, deactivating its stake
Only succeeds if the validator stake account has the minimum of
max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
. plus the
rent-exempt amount.
[w]
Stake pool[s]
Staker[]
Stake pool withdraw authority[w]
Validator stake list storage account[w]
Stake account to remove from the pool[w]
Transient stake account, to deactivate if necessary[]
Sysvar clock[]
Stake program id,
DecreaseValidatorStake
Fields
NOTE: This instruction has been deprecated since version 0.7.0. Please
use DecreaseValidatorStakeWithReserve
instead.
(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 max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
[]
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
(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
max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Stake pool reserve stake[w]
Transient stake account[]
Validator 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
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+2N ` [] 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 + max( crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation() )
.
When allowing withdrawals, the order of priority goes:
- preferred withdraw validator stake account (if set)
- validator stake accounts
- transient stake accounts
- reserve stake account OR totally remove validator stake accounts
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 or remove any validator from the pool.
[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
(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, stake deposit, or SOL withdrawal 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
CreateTokenMetadata
Fields
Create token metadata for the stake-pool token in the
metaplex-token program
0. []
Stake pool
[s]
Manager[]
Stake pool withdraw authority[]
Pool token mint account[s, w]
Payer for creation of token metadata account[w]
Token metadata account[]
Metadata program id[]
System program id
UpdateTokenMetadata
Fields
Update token metadata for the stake-pool token in the metaplex-token program
[]
Stake pool[s]
Manager[]
Stake pool withdraw authority[w]
Token metadata account[]
Metadata program id
IncreaseAdditionalValidatorStake
Fields
(Staker only) Increase stake on a validator again in an epoch.
Works regardless if the transient stake account exists.
Internally, this instruction splits reserve stake into an ephemeral
stake account, activates it, then merges or splits it into the
transient stake account delegated to the appropriate validator.
UpdateValidatorListBalance
will do the work of merging once it’s
ready.
The minimum amount to move is rent-exemption plus
max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Stake pool reserve stake[w]
Uninitialized ephemeral stake account to receive stake[w]
Transient stake account[]
Validator stake account[]
Validator vote account to delegate to- ‘[]’ Clock 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.
DecreaseAdditionalValidatorStake
Fields
(Staker only) Decrease active stake again from a validator, eventually moving it to the reserve
Works regardless if the transient stake account already exists.
Internally, this instruction:
- withdraws rent-exempt reserve lamports from the reserve into the ephemeral stake
- splits a validator stake account into an ephemeral stake account
- deactivates the ephemeral account
- merges or splits the ephemeral account into the transient stake account delegated to the appropriate validator
The amount of lamports to move must be at least
max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Reserve stake account, to fund rent exempt reserve[w]
Canonical stake account to split from[w]
Uninitialized ephemeral stake account to receive stake[w]
Transient stake account[]
Clock sysvar- ‘[]’ Stake history sysvar
[]
System program[]
Stake program
DecreaseValidatorStakeWithReserve
Fields
(Staker only) Decrease active stake on a validator, eventually moving it to the reserve
Internally, this instruction:
- withdraws enough lamports to make the transient account rent-exempt
- splits from a validator stake account into a transient stake account
- deactivates the transient stake account
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 max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Reserve stake account, to fund rent exempt reserve[w]
Canonical stake account to split from[w]
Transient stake account to receive split[]
Clock sysvar- ‘[]’ Stake history sysvar
[]
System program[]
Stake program
Redelegate
Fields
(Staker only) Redelegate active stake on a validator, eventually moving it to another
Internally, this instruction splits a validator stake account into its corresponding transient stake account, redelegates it to an ephemeral stake account, then merges that stake into the destination transient stake account.
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 source transient stake account and ephemeral stake account do not exist.
The amount of lamports to move must be at least rent-exemption plus the minimum delegation amount. Rent-exemption plus minimum delegation is required for the destination ephemeral stake account.
The rent-exemption for the source transient account comes from the stake pool reserve, if needed.
The amount that arrives at the destination validator in the end is
redelegate_lamports - rent_exemption
if the destination transient
account does not exist, and redelegate_lamports
if the destination
transient account already exists. The rent_exemption
is not activated
when creating the destination transient stake account, but if it already
exists, then the full amount is delegated.
[]
Stake pool[s]
Stake pool staker[]
Stake pool withdraw authority[w]
Validator list[w]
Reserve stake account, to withdraw rent exempt reserve[w]
Source canonical stake account to split from[w]
Source transient stake account to receive split and be redelegated[w]
Uninitialized ephemeral stake account to receive redelegation[w]
Destination transient stake account to receive ephemeral stake by merge[]
Destination stake account to receive transient stake after activation[]
Destination validator vote account[]
Clock sysvar[]
Stake History sysvar[]
Stake Config sysvar[]
System program[]
Stake program
DepositStakeWithSlippage
Deposit some stake into the pool, with a specified slippage constraint. The output is a “pool” token representing ownership into the pool. Inputs are converted at 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,
WithdrawStakeWithSlippage
Fields
Withdraw the token from the pool at the current ratio, specifying a minimum expected output lamport amount.
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 + max( crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation() )
.
[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
DepositSolWithSlippage
Fields
Deposit SOL directly into the pool’s reserve account, with a specified slippage constraint. The output is a “pool” token representing ownership into the pool. Inputs are converted at 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.
WithdrawSolWithSlippage
Fields
Withdraw SOL directly from the pool’s reserve account. Fails if the reserve does not have enough SOL or if the slippage constraint is not met.
[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§
source§impl BorshDeserialize for StakePoolInstruction
impl BorshDeserialize for StakePoolInstruction
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 Clone for StakePoolInstruction
impl Clone for StakePoolInstruction
source§fn clone(&self) -> StakePoolInstruction
fn clone(&self) -> StakePoolInstruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for StakePoolInstruction
impl Debug for StakePoolInstruction
source§impl EnumExt for StakePoolInstruction
impl EnumExt for StakePoolInstruction
source§impl PartialEq for StakePoolInstruction
impl PartialEq for StakePoolInstruction
source§fn eq(&self, other: &StakePoolInstruction) -> bool
fn eq(&self, other: &StakePoolInstruction) -> bool
self
and other
values to be equal, and is used
by ==
.