Instruction: DepositStake
This instruction can be used to deposit some stake into the pool. The program assumes the user passes in a stake account that has been authorized to the authority controlled by the single pool program. The authorization instruction must happen in the same transaction in order for this mechanism to be safe, and the repository provides helper functions that compose a bundle of instructions that use the program safely.
The instruction merges the user stake account with the pool stake account. The user is minted an amount of pool tokens representing their fraction of the staked assets contained in the pool.
Input accounts
pool_info
: Pool account.W/S requisites: None.
Owner: Single pool program.
Rent: N/A.
Initialized: Yes.
Discriminant: Checked (
account_type
field).PDA: Yes, controlled by the single pool program; using seeds
"pool", vote_account_address
; and checked by reading internal state.
pool_stake_info
: Stake account associated with the pool.W/S requisites: Writable.
Owner: Stake program (indirectly checked, since it is written to by the stake program).
Rent: N/A.
Initialized: Yes.
Discriminant: Checked.
PDA: Yes, controlled by the single pool program — using seeds
"stake", pool_address
.
pool_mint_info
: Mint account associated with the pool.W/S requisites: Writable.
Owner: Token program (indirectly checked, since it is written to by the token program).
Rent: N/A.
Initialized: Yes.
Discriminant: Not a responsibility of the program under review.
PDA: Yes, controlled by the single pool program — using seeds
"mint", pool_address
.
pool_stake_authority_info
: Authority controlling the pool stake.W/S requisites: None.
Owner: N/A.
Rent: N/A.
Initialized: N/A.
Discriminant: N/A.
PDA: Yes, controlled by the single pool program — using seeds
"stake authority", pool_address
.
pool_mint_authority_info
: Authority controlling the pool mint.W/S requisites: None.
Owner: N/A.
Rent: N/A.
Initialized: N/A.
Discriminant: N/A.
PDA: Yes, controlled by the single pool program — using seeds
"mint authority", pool_address
.
user_stake_info
: User stake account that will be merged into the pool.W/S requisites: Writable.
Owner: Stake program (indirectly checked, since it is written to by the stake program).
Rent: N/A.
Initialized: Yes.
Discriminant: Not a responsibility of the program under review.
PDA: No. Address must be different than
pool_stake_info
.
user_token_account_info
: User token account that will receive the minted pool tokens.W/S requisites: Writable.
Owner: Token program (indirectly checked, since it is written to by the token program).
Rent: N/A.
Initialized: Yes.
Discriminant: Not a responsibility of the program under review.
PDA: No.
user_lamport_account_info
: Account that will receive any excess lamports.W/S requisites: Writable.
Owner: Not checked (not an issue).
Rent: N/A.
Initialized: N/A.
Discriminant: N/A.
PDA: No.
clock_info
: Clock sysvar account.W/S requisites: None.
Owner: N/A (sysvar).
Rent: N/A (sysvar).
Initialized: N/A (sysvar).
Discriminant: N/A (sysvar).
PDA: No — the address is checked to ensure it matches the actual clock sysvar.
stake_history_info
: Stake history sysvar account — not used, only passed along to the stake program.W/S requisites: None.
Owner: N/A (sysvar).
Rent: N/A (sysvar).
Initialized: N/A (sysvar).
Discriminant: N/A (sysvar).
PDA: No.
token_program_info
: Token program account.W/S requisites: None.
Owner: N/A (sysvar).
Rent: N/A (sysvar).
Initialized: N/A (sysvar).
Discriminant: N/A (sysvar).
PDA: No — the address is checked to ensure it matches the actual token program.
stake_program_info
: Stake program account.W/S requisites: None.
Owner: N/A (sysvar).
Rent: N/A (sysvar).
Initialized: N/A (sysvar).
Discriminant: N/A (sysvar).
PDA: No — the address is checked to ensure it matches the actual stake program.