Enum spl_stake_pool::instruction::StakePoolInstruction [−][src]
#[repr(C)] pub enum StakePoolInstruction {}Show variants
Initialize { fee: Fee, max_validators: u32, }, CreateValidatorStakeAccount, AddValidatorToPool, RemoveValidatorFromPool, DecreaseValidatorStake(u64), IncreaseValidatorStake(u64), SetPreferredValidator { validator_type: PreferredValidatorType, validator_vote_address: Option<Pubkey>, }, UpdateValidatorListBalance { start_index: u32, no_merge: bool, }, UpdateStakePoolBalance, Deposit, Withdraw(u64), SetManager, SetFee { fee: Fee, }, SetStaker,
Expand description
Instructions supported by the StakePool program.
Variants
Initializes a new StakePool.
[w]
New StakePool to create.[s]
Manager[]
Staker[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.[]
Clock sysvar[]
Rent sysvar[]
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.
Show fields
(Staker only) Creates new program account for accumulating stakes for a particular validator
[]
Stake pool account this stake will belong to[s]
Staker[ws]
Funding account (must be a system account)[w]
Stake account to be created[]
Validator this stake account will vote for[]
Rent sysvar[]
Stake History sysvar[]
Stake Config sysvar[]
System program[]
Stake program
(Staker only) Adds stake account delegated to validator to the pool’s list of managed validators.
The stake account must have the rent-exempt amount plus at least 1 SOL, and at most 1.001 SOL.
Once we delegate even 1 SOL, it will accrue rewards one epoch later, so we’ll have more than 1 active SOL at this point. At 10% annualized rewards, 1 epoch of 2 days will accrue 0.000547945 SOL, so we check that it is at least 1 SOL, and at most 1.001 SOL.
[w]
Stake pool[s]
Staker[]
Stake pool withdraw authority[w]
Validator stake list storage account[w]
Stake account to add to the pool, its withdraw authority must be set to the staker[]
Clock sysvar- ‘[]’ Sysvar stake history account
[]
Stake program
(Staker only) Removes validator from the pool
Only succeeds if the validator stake account has the minimum of 1 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- ‘[]’ Sysvar clock
[]
Stake program id,
DecreaseValidatorStake(u64)
(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 userdata: amount of lamports to split into the transient stake account
IncreaseValidatorStake(u64)
(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 1 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 split into the transient stake account
(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.
[]
Stake pool[s]
Stake pool staker[w]
Validator list
Fails if the validator is not part of the stake pool.
Show fields
Fields of SetPreferredValidator
validator_type: PreferredValidatorType
Affected operation (deposit or withdraw)
validator_vote_address: Option<Pubkey>
Validator vote account that deposits or withdraws must go through, unset with None
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
Show fields
Fields of UpdateValidatorListBalance
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[]
Sysvar clock account[]
Pool token program
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[]
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]
Pool token mint account- ‘[]’ Sysvar clock account
- ‘[]’ Sysvar stake history account
[]
Pool token program id,[]
Stake program id,
Withdraw(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 + 1 SOL.
A validator stake account can be withdrawn from freely, and the reserve can only be drawn from if there is no active stake left, where all validator accounts are left with 1 lamport.
[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]
Pool token mint account[]
Sysvar clock account (required)[]
Pool token program id[]
Stake program id, userdata: amount of pool tokens to withdraw
(Manager only) Update manager
[w]
StakePool[s]
Manager- ’[]` New manager pubkey
- ’[]` New manager fee account
(Manager only) Update fee
[w]
StakePool[s]
Manager[]
Sysvar clock
Show fields
Fields of SetFee
fee: Fee
Fee assessed as percentage of perceived rewards
(Manager or staker only) Update staker
[w]
StakePool[s]
Manager or current staker- ’[]` New staker pubkey
Trait Implementations
impl BorshDeserialize for StakePoolInstruction where
Fee: BorshDeserialize,
u32: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PreferredValidatorType: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
u32: BorshDeserialize,
bool: BorshDeserialize,
u64: BorshDeserialize,
Fee: BorshDeserialize,
impl BorshDeserialize for StakePoolInstruction where
Fee: BorshDeserialize,
u32: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PreferredValidatorType: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
u32: BorshDeserialize,
bool: BorshDeserialize,
u64: BorshDeserialize,
Fee: BorshDeserialize,
Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
Deserialize this instance from a slice of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
Get the name of the type without brackets.
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
fn 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.
Serialize this instance into a vector of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
pub default fn example() -> T
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V