#[repr(C)]pub enum SinglePoolInstruction {
InitializePool,
ReplenishPool,
DepositStake,
WithdrawStake {
user_stake_authority: Pubkey,
token_amount: u64,
},
CreateTokenMetadata,
UpdateTokenMetadata {
name: String,
symbol: String,
uri: String,
},
InitializePoolOnRamp,
DepositSol {
lamports: u64,
},
}Expand description
Instructions supported by the SinglePool program.
Variants§
InitializePool
Initialize the mint and main stake account for a new single-validator
stake pool. The pool stake account must contain the rent-exempt
minimum plus the minimum balance of 1 sol. No tokens will be minted;
to deposit more, use Deposit after InitializeStake and InitializePoolOnRamp.
[]Validator vote account[w]Pool account[w]Pool stake account[w]Pool token mint[]Pool stake authority[]Pool mint authority[]Rent sysvar[]Clock sysvar[]Stake history sysvar[]Stake config sysvar[]System program[]Token program[]Stake program
ReplenishPool
Bring the pool stake accounts to their optimal state. This performs several operations:
- If the main stake account has been deactivated by
DeactivateDelinquent, reactivate it. - Then, if the main stake account is already fully active:
- If the on-ramp is fully active, move its stake to the main account.
- If the main account has excess lamports, move them to the on-ramp.
- Delegate the on-ramp if it has excess lamports to activate.
Combined, these operations allow harvesting and delegating MEV rewards
and also enable depositing liquid sol for pool tokens via DepositSol.
This instruction is idempotent and gracefully skips operations that would fail or have no effect, up to no-op. This allows it to be executed speculatively or as part of arbitrary flows involving the pool. If the on-ramp account is already activating, and there are excess lamports beyond the activating delegation, it increases the delegation to include them.
This instruction will fail with an error if the on-ramp account does not
exist. If the pool does not have the account, InitializePoolOnRamp must
be called to create it.
[]Validator vote account[]Pool account[w]Pool stake account[w]Pool on-ramp account[]Pool stake authority[]Clock sysvar[]Stake history sysvar[]Stake config sysvar[]Stake program
DepositStake
Deposit stake into the pool. The output is a “pool” token representing fractional ownership of the pool stake. Inputs are converted to the current ratio.
[]Pool account[w]Pool stake account[]Pool on-ramp account[w]Pool token mint[]Pool stake authority[]Pool mint authority[w]User stake account to join to the pool[w]User account to receive pool tokens[w]User account to receive lamports[]Clock sysvar[]Stake history sysvar[]Token program[]Stake program
WithdrawStake
Redeem tokens issued by this pool for stake at the current ratio.
[]Pool account[w]Pool stake account[]Pool on-ramp account[w]Pool token mint[]Pool stake authority[]Pool mint authority[w]User stake account to receive stake at[w]User account to take pool tokens from[]Clock sysvar[]Token program[]Stake program
Fields
User authority for the new stake account
CreateTokenMetadata
Create token metadata for the stake-pool token in the metaplex-token program. Step three of the permissionless three-stage initialization flow. Note this instruction is NOT necessary for the pool to operate, to ensure we cannot be broken by upstream.
[]Pool account[]Pool token mint[]Pool mint authority[]Pool MPL authority[s, w]Payer for creation of token metadata account[w]Token metadata account[]Metadata program id[]System program id
UpdateTokenMetadata
Update token metadata for the stake-pool token in the metaplex-token program.
[]Validator vote account[]Pool account[]Pool MPL authority[s]Vote account authorized withdrawer[w]Token metadata account[]Metadata program id
Fields
InitializePoolOnRamp
Create the on-ramp account for a single-validator stake pool, which is used to delegate liquid sol so that it can be merged into the main pool account as active stake.
New pools created with initialize() will include this instruction
automatically. Existing pools must use InitializePoolOnRamp to upgrade to
the latest version. Note the on-ramp IS necessary for the pool to operate.
[]Pool account[w]Pool on-ramp account[]Pool stake authority[]Rent sysvar[]System program[]Stake program
DepositSol
Deposit liquid sol into the pool. The output is a “pool” token
representing fractional ownership of the pool stake. Inputs are
converted to the current ratio, less a fee of DEPOSIT_SOL_FEE_BPS.
This instruction invokes ReplenishPool to immediately delegate
any newly added sol if possible.
[]Validator vote account[]Pool account[w]Pool stake account[w]Pool on-ramp account[w]Pool token mint[]Pool stake authority[]Pool mint authority[w, s]User system account to deposit from[w]User account to receive pool tokens[]Clock sysvar[]Stake history sysvar[]Stake config sysvar[]System program[]Token program[]Stake program[]Single-validator stake pool program
Trait Implementations§
Source§impl BorshDeserialize for SinglePoolInstruction
impl BorshDeserialize for SinglePoolInstruction
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 SinglePoolInstruction
impl Clone for SinglePoolInstruction
Source§fn clone(&self) -> SinglePoolInstruction
fn clone(&self) -> SinglePoolInstruction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SinglePoolInstruction
impl Debug for SinglePoolInstruction
Source§impl EnumExt for SinglePoolInstruction
impl EnumExt for SinglePoolInstruction
Source§impl PartialEq for SinglePoolInstruction
impl PartialEq for SinglePoolInstruction
Source§fn eq(&self, other: &SinglePoolInstruction) -> bool
fn eq(&self, other: &SinglePoolInstruction) -> bool
self and other values to be equal, and is used by ==.