StakePoolProgram.decreaseValidatorStake constructor
StakePoolProgram.decreaseValidatorStake({
- required SolAddress stakePool,
- required SolAddress staker,
- required SolAddress withdrawAuthority,
- required SolAddress validatorList,
- required SolAddress validatorStake,
- required SolAddress transientStake,
- required StakePoolDecreaseValidatorStakeLayout layout,
(Staker only) Decrease active stake on a validator, eventually moving it to the reserve
Internally, this instruction splits a validator stake account into its corresponding transient stake account and deactivates it.
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.
Implementation
factory StakePoolProgram.decreaseValidatorStake({
/// 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,
required StakePoolDecreaseValidatorStakeLayout layout,
}) {
return StakePoolProgram(
layout: layout,
keys: [
stakePool.toReadOnly(),
staker.toSigner(),
withdrawAuthority.toReadOnly(),
validatorList.toWritable(),
validatorStake.toWritable(),
transientStake.toWritable(),
SystemProgramConst.sysvarClockPubkey.toReadOnly(),
SystemProgramConst.sysvarRentPubkey.toReadOnly(),
SystemProgramConst.programId.toReadOnly(),
StakeProgramConst.programId.toReadOnly(),
],
programId: StakePoolProgramConst.programId);
}