/// Creates instructions required to deposit into a stake pool, given a stake
/// account owned by the user.
Creates instructions required to deposit into a stake pool, given a stake
account owned by the user.
Creates instructions required to deposit into a stake pool given a stake account owned by the user .
pub fn deposit(
    program_id: &Pubkey,
    stake_pool: &Pubkey,
    validator_list_storage: &Pubkey,
    stake_pool_withdraw_authority: &Pubkey,
    deposit_stake_address: &Pubkey,
    deposit_stake_withdraw_authority: &Pubkey,
    validator_stake_account: &Pubkey,
    pool_tokens_to: &Pubkey,
    pool_mint: &Pubkey,
    token_program_id: &Pubkey,
) -> Vec<Instruction> {
    let stake_pool_deposit_authority =
        find_deposit_authority_program_address(program_id, stake_pool).0;
    let accounts = vec![
        AccountMeta::new(*stake_pool, false),
        AccountMeta::new(*validator_list_storage, false),
        AccountMeta::new_readonly(stake_pool_deposit_authority, false),
        AccountMeta::new_readonly(*stake_pool_withdraw_authority, false),
        AccountMeta::new(*deposit_stake_address, false),
        AccountMeta::new(*validator_stake_account, false),
        AccountMeta::new(*pool_tokens_to, false),
        AccountMeta::new(*pool_mint, false),
        AccountMeta::new_readonly(sysvar::clock::id(), false),
        AccountMeta::new_readonly(sysvar::stake_history::id(), false),
        AccountMeta::new_readonly(*token_program_id, false),
        AccountMeta::new_readonly(stake_program::id(), false),
    ];
    vec![
        stake_program::authorize(
            deposit_stake_address,
            deposit_stake_withdraw_authority,
            &stake_pool_deposit_authority,
            stake_program::StakeAuthorize::Staker,
        ),
        stake_program::authorize(
            deposit_stake_address,
            deposit_stake_withdraw_authority,
            &stake_pool_deposit_authority,
            stake_program::StakeAuthorize::Withdrawer,
        ),
        Instruction {
            program_id: *program_id,
            accounts,
            data: StakePoolInstruction::Deposit.try_to_vec().unwrap(),
        },
    ]
}
pub fn deposit ( program_id : & Pubkey , stake_pool : & Pubkey , validator_list_storage : & Pubkey , stake_pool_withdraw_authority : & Pubkey , deposit_stake_address : & Pubkey , deposit_stake_withdraw_authority : & Pubkey , validator_stake_account : & Pubkey , pool_tokens_to : & Pubkey , pool_mint : & Pubkey , token_program_id : & Pubkey , ) -> Vec < Instruction > { let stake_pool_deposit_authority = find_deposit_authority_program_address ( program_id , stake_pool ) . 0 ; let accounts = vec ! [ AccountMeta new ( stake_pool false ) AccountMeta new ( validator_list_storage false ) AccountMeta new_readonly ( stake_pool_deposit_authority false ) AccountMeta new_readonly ( stake_pool_withdraw_authority false ) AccountMeta new ( deposit_stake_address false ) AccountMeta new ( validator_stake_account false ) AccountMeta new ( pool_tokens_to false ) AccountMeta new ( pool_mint false ) AccountMeta new_readonly ( sysvar clock id ( ) false ) AccountMeta new_readonly ( sysvar stake_history id ( ) false ) AccountMeta new_readonly ( token_program_id false ) AccountMeta new_readonly ( stake_program id ( ) false ) ] ; vec ! [ stake_program authorize ( deposit_stake_address deposit_stake_withdraw_authority stake_pool_deposit_authority stake_program StakeAuthorize Staker ) stake_program authorize ( deposit_stake_address deposit_stake_withdraw_authority stake_pool_deposit_authority stake_program StakeAuthorize Withdrawer ) Instruction { program_id program_id accounts data StakePoolInstruction Deposit try_to_vec ( ) unwrap ( ) } ] }
Creates instructions required to deposit into a stake pool, given a stake
account owned by the user.
Creates instructions required to deposit into a stake pool given a stake account owned by the user .
program_id
&Pubkey
stake_pool
&Pubkey
validator_list_storage
&Pubkey
stake_pool_withdraw_authority
&Pubkey
deposit_stake_address
&Pubkey
deposit_stake_withdraw_authority
&Pubkey
validator_stake_account
&Pubkey
pool_tokens_to
&Pubkey
pool_mint
&Pubkey
token_program_id
&Pubkey