pub enum StakeInstruction {
Show 18 variants
Initialize(Authorized, Lockup),
Authorize(Pubkey, StakeAuthorize),
DelegateStake,
Split(u64),
Withdraw(u64),
Deactivate,
SetLockup(LockupArgs),
Merge,
AuthorizeWithSeed(AuthorizeWithSeedArgs),
InitializeChecked,
AuthorizeChecked(StakeAuthorize),
AuthorizeCheckedWithSeed(AuthorizeCheckedWithSeedArgs),
SetLockupChecked(LockupCheckedArgs),
GetMinimumDelegation,
DeactivateDelinquent,
Redelegate,
MoveStake(u64),
MoveLamports(u64),
}
Variants§
Initialize(Authorized, Lockup)
Initialize a stake with lockup and authorization information
§Account references
[WRITE]
Uninitialized stake account[]
Rent sysvar
Authorized carries pubkeys that must sign staker transactions and withdrawer transactions. Lockup carries information about withdrawal restrictions
Authorize(Pubkey, StakeAuthorize)
Authorize a key to manage stake or withdrawal
§Account references
[WRITE]
Stake account to be updated[]
Clock sysvar[SIGNER]
The stake or withdraw authority- Optional:
[SIGNER]
Lockup authority, if updating StakeAuthorize::Withdrawer before lockup expiration
DelegateStake
Delegate a stake to a particular vote account
§Account references
[WRITE]
Initialized stake account to be delegated[]
Vote account to which this stake will be delegated[]
Clock sysvar[]
Stake history sysvar that carries stake warmup/cooldown history[]
Unused account, formerly the stake config[SIGNER]
Stake authority
The entire balance of the staking account is staked. DelegateStake can be called multiple times, but re-delegation is delayed by one epoch
Split(u64)
Split u64 tokens and stake off a stake account into another stake account.
§Account references
[WRITE]
Stake account to be split; must be in the Initialized or Stake state[WRITE]
Uninitialized stake account that will take the split-off amount[SIGNER]
Stake authority
Withdraw(u64)
Withdraw unstaked lamports from the stake account
§Account references
[WRITE]
Stake account from which to withdraw[WRITE]
Recipient account[]
Clock sysvar[]
Stake history sysvar that carries stake warmup/cooldown history[SIGNER]
Withdraw authority- Optional:
[SIGNER]
Lockup authority, if before lockup expiration
The u64 is the portion of the stake account balance to be withdrawn,
must be <= StakeAccount.lamports - staked_lamports
.
Deactivate
Deactivates the stake in the account
§Account references
[WRITE]
Delegated stake account[]
Clock sysvar[SIGNER]
Stake authority
SetLockup(LockupArgs)
Set stake lockup
If a lockup is not active, the withdraw authority may set a new lockup If a lockup is active, the lockup custodian may update the lockup parameters
§Account references
[WRITE]
Initialized stake account[SIGNER]
Lockup authority or withdraw authority
Merge
Merge two stake accounts.
Both accounts must have identical lockup and authority keys. A merge is possible between two stakes in the following states with no additional conditions:
- two deactivated stakes
- an inactive stake into an activating stake during its activation epoch
For the following cases, the voter pubkey and vote credits observed must match:
- two activated stakes
- two activating accounts that share an activation epoch, during the activation epoch
All other combinations of stake states will fail to merge, including all “transient” states, where a stake is activating or deactivating with a non-zero effective stake.
§Account references
[WRITE]
Destination stake account for the merge[WRITE]
Source stake account for to merge. This account will be drained[]
Clock sysvar[]
Stake history sysvar that carries stake warmup/cooldown history[SIGNER]
Stake authority
AuthorizeWithSeed(AuthorizeWithSeedArgs)
Authorize a key to manage stake or withdrawal with a derived key
§Account references
[WRITE]
Stake account to be updated[SIGNER]
Base key of stake or withdraw authority[]
Clock sysvar- Optional:
[SIGNER]
Lockup authority, if updating StakeAuthorize::Withdrawer before lockup expiration
InitializeChecked
Initialize a stake with authorization information
This instruction is similar to Initialize
except that the withdraw authority
must be a signer, and no lockup is applied to the account.
§Account references
[WRITE]
Uninitialized stake account[]
Rent sysvar[]
The stake authority[SIGNER]
The withdraw authority
AuthorizeChecked(StakeAuthorize)
Authorize a key to manage stake or withdrawal
This instruction behaves like Authorize
with the additional requirement that the new
stake or withdraw authority must also be a signer.
§Account references
[WRITE]
Stake account to be updated[]
Clock sysvar[SIGNER]
The stake or withdraw authority[SIGNER]
The new stake or withdraw authority- Optional:
[SIGNER]
Lockup authority, if updating StakeAuthorize::Withdrawer before lockup expiration
AuthorizeCheckedWithSeed(AuthorizeCheckedWithSeedArgs)
Authorize a key to manage stake or withdrawal with a derived key
This instruction behaves like AuthorizeWithSeed
with the additional requirement that
the new stake or withdraw authority must also be a signer.
§Account references
[WRITE]
Stake account to be updated[SIGNER]
Base key of stake or withdraw authority[]
Clock sysvar[SIGNER]
The new stake or withdraw authority- Optional:
[SIGNER]
Lockup authority, if updating StakeAuthorize::Withdrawer before lockup expiration
SetLockupChecked(LockupCheckedArgs)
Set stake lockup
This instruction behaves like SetLockup
with the additional requirement that
the new lockup authority also be a signer.
If a lockup is not active, the withdraw authority may set a new lockup If a lockup is active, the lockup custodian may update the lockup parameters
§Account references
[WRITE]
Initialized stake account[SIGNER]
Lockup authority or withdraw authority- Optional:
[SIGNER]
New lockup authority
GetMinimumDelegation
Get the minimum stake delegation, in lamports
§Account references
None
Returns the minimum delegation as a little-endian encoded u64 value.
Programs can use the get_minimum_delegation()
helper function to invoke and
retrieve the return value for this instruction.
DeactivateDelinquent
Deactivate stake delegated to a vote account that has been delinquent for at least
MINIMUM_DELINQUENT_EPOCHS_FOR_DEACTIVATION
epochs.
No signer is required for this instruction as it is a common good to deactivate abandoned stake.
§Account references
[WRITE]
Delegated stake account[]
Delinquent vote account for the delegated stake account[]
Reference vote account that has voted at least once in the lastMINIMUM_DELINQUENT_EPOCHS_FOR_DEACTIVATION
epochs
Redelegate
Redelegate activated stake to another vote account.
Upon success:
- the balance of the delegated stake account will be reduced to the undelegated amount in the account (rent exempt minimum and any additional lamports not part of the delegation), and scheduled for deactivation.
- the provided uninitialized stake account will receive the original balance of the delegated stake account, minus the rent exempt minimum, and scheduled for activation to the provided vote account. Any existing lamports in the uninitialized stake account will also be included in the re-delegation.
§Account references
[WRITE]
Delegated stake account to be redelegated. The account must be fully activated and carry a balance greater than or equal to the minimum delegation amount plus rent exempt minimum[WRITE]
Uninitialized stake account that will hold the redelegated stake[]
Vote account to which this stake will be re-delegated[]
Unused account, formerly the stake config[SIGNER]
Stake authority
MoveStake(u64)
Move stake between accounts with the same authorities and lockups, using Staker authority.
The source account must be fully active. If its entire delegation is moved, it immediately becomes inactive. Otherwise, at least the minimum delegation of active stake must remain.
The destination account must be fully active or fully inactive. If it is active, it must be delegated to the same vote account as the source. If it is inactive, it immediately becomes active, and must contain at least the minimum delegation. The destination must be pre-funded with the rent-exempt reserve.
This instruction only affects or moves active stake. Additional unstaked lamports are never moved, activated, or deactivated, and accounts are never deallocated.
§Account references
[WRITE]
Active source stake account[WRITE]
Active or inactive destination stake account[SIGNER]
Stake authority
The u64 is the portion of the stake to move, which may be the entire delegation
MoveLamports(u64)
Move unstaked lamports between accounts with the same authorities and lockups, using Staker authority.
The source account must be fully active or fully inactive. The destination may be in any mergeable state (active, inactive, or activating, but not in warmup cooldown). Only lamports that are neither backing a delegation nor required for rent-exemption may be moved.
§Account references
[WRITE]
Active or inactive source stake account[WRITE]
Mergeable destination stake account[SIGNER]
Stake authority
The u64 is the portion of available lamports to move
Trait Implementations§
Source§impl Clone for StakeInstruction
impl Clone for StakeInstruction
Source§fn clone(&self) -> StakeInstruction
fn clone(&self) -> StakeInstruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more