StakePoolProgram.decreaseValidatorStakeWithReserve constructor
StakePoolProgram.decreaseValidatorStakeWithReserve({
- required SolAddress stakePool,
- required SolAddress staker,
- required SolAddress withdrawAuthority,
- required SolAddress validatorList,
- required SolAddress validatorStake,
- required SolAddress transientStake,
- required SolAddress reserveStake,
- required StakePoolDecreaseValidatorStakeWithReserveLayout layout,
(Staker only) Decrease active stake on a validator, eventually moving it to the reserve
Internally, this instruction:
- withdraws enough lamports to make the transient account rent-exempt
- splits from a validator stake account into a transient stake account
- deactivates the transient stake account
In order to rebalance the pool without taking custody, the staker needs a way of reducing the stake on a stake account. This instruction splits some amount of stake, up to the total activated stake, from the canonical validator stake account, into its "transient" stake account. The instruction only succeeds if the transient stake account does not exist.
Implementation
factory StakePoolProgram.decreaseValidatorStakeWithReserve({
/// Stake pool
required SolAddress stakePool,
/// Stake pool staker
required SolAddress staker,
/// Stake pool withdraw authority
required SolAddress withdrawAuthority,
/// Validator list
required SolAddress validatorList,
/// Canonical stake account to split from
required SolAddress validatorStake,
/// Transient stake account to receive split
required SolAddress transientStake,
/// Reserve stake account, to fund rent exempt reserve
required SolAddress reserveStake,
required StakePoolDecreaseValidatorStakeWithReserveLayout layout,
}) {
return StakePoolProgram(
layout: layout,
keys: [
stakePool.toReadOnly(),
staker.toSigner(),
withdrawAuthority.toReadOnly(),
validatorList.toWritable(),
reserveStake.toWritable(),
validatorStake.toWritable(),
transientStake.toWritable(),
SystemProgramConst.sysvarClockPubkey.toReadOnly(),
SystemProgramConst.sysvarStakeHistoryPubkey.toReadOnly(),
SystemProgramConst.programId.toReadOnly(),
StakeProgramConst.programId.toReadOnly(),
],
programId: StakePoolProgramConst.programId);
}