solana_sdk::stake::instruction

Enum StakeInstruction

source
pub enum StakeInstruction {
Show 16 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,
}

Variants§

§

Initialize(Authorized, Lockup)

Initialize a stake with lockup and authorization information

§Account references

  1. [WRITE] Uninitialized stake account
  2. [] 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

  1. [WRITE] Stake account to be updated
  2. [] Clock sysvar
  3. [SIGNER] The stake or withdraw authority
  4. Optional: [SIGNER] Lockup authority, if updating StakeAuthorize::Withdrawer before lockup expiration
§

DelegateStake

Delegate a stake to a particular vote account

§Account references

  1. [WRITE] Initialized stake account to be delegated
  2. [] Vote account to which this stake will be delegated
  3. [] Clock sysvar
  4. [] Stake history sysvar that carries stake warmup/cooldown history
  5. [] Address of config account that carries stake config
  6. [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

  1. [WRITE] Stake account to be split; must be in the Initialized or Stake state
  2. [WRITE] Uninitialized stake account that will take the split-off amount
  3. [SIGNER] Stake authority
§

Withdraw(u64)

Withdraw unstaked lamports from the stake account

§Account references

  1. [WRITE] Stake account from which to withdraw
  2. [WRITE] Recipient account
  3. [] Clock sysvar
  4. [] Stake history sysvar that carries stake warmup/cooldown history
  5. [SIGNER] Withdraw authority
  6. 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

  1. [WRITE] Delegated stake account
  2. [] Clock sysvar
  3. [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

  1. [WRITE] Initialized stake account
  2. [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

  1. [WRITE] Destination stake account for the merge
  2. [WRITE] Source stake account for to merge. This account will be drained
  3. [] Clock sysvar
  4. [] Stake history sysvar that carries stake warmup/cooldown history
  5. [SIGNER] Stake authority
§

AuthorizeWithSeed(AuthorizeWithSeedArgs)

Authorize a key to manage stake or withdrawal with a derived key

§Account references

  1. [WRITE] Stake account to be updated
  2. [SIGNER] Base key of stake or withdraw authority
  3. [] Clock sysvar
  4. 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

  1. [WRITE] Uninitialized stake account
  2. [] Rent sysvar
  3. [] The stake authority
  4. [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

  1. [WRITE] Stake account to be updated
  2. [] Clock sysvar
  3. [SIGNER] The stake or withdraw authority
  4. [SIGNER] The new stake or withdraw authority
  5. 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

  1. [WRITE] Stake account to be updated
  2. [SIGNER] Base key of stake or withdraw authority
  3. [] Clock sysvar
  4. [SIGNER] The new stake or withdraw authority
  5. 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

  1. [WRITE] Initialized stake account
  2. [SIGNER] Lockup authority or withdraw authority
  3. 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

  1. [WRITE] Delegated stake account
  2. [] Delinquent vote account for the delegated stake account
  3. [] Reference vote account that has voted at least once in the last MINIMUM_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

  1. [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
  2. [WRITE] Uninitialized stake account that will hold the redelegated stake
  3. [] Vote account to which this stake will be re-delegated
  4. [] Address of config account that carries stake config
  5. [SIGNER] Stake authority

Trait Implementations§

source§

impl Clone for StakeInstruction

source§

fn clone(&self) -> StakeInstruction

Returns a copy 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 StakeInstruction

source§

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

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

impl<'de> Deserialize<'de> for StakeInstruction

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<StakeInstruction, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for StakeInstruction

source§

fn eq(&self, other: &StakeInstruction) -> 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 Serialize for StakeInstruction

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for StakeInstruction

source§

impl StructuralPartialEq for StakeInstruction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiEnumVisitor for T
where T: Serialize + ?Sized,

source§

default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

source§

impl<T> AbiEnumVisitor for T
where T: Serialize + AbiExample + ?Sized,

source§

default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

source§

impl<T> AbiExample for T

source§

default fn example() -> T

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, dst: *mut T)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,