StakePoolProgram.decreaseAdditionalValidatorStake constructor

StakePoolProgram.decreaseAdditionalValidatorStake({
  1. required SolAddress stakePool,
  2. required SolAddress staker,
  3. required SolAddress withdrawAuthority,
  4. required SolAddress validatorList,
  5. required SolAddress validatorStake,
  6. required SolAddress transientStake,
  7. required SolAddress reserveStake,
  8. required SolAddress ephemeralStake,
  9. required StakePoolDecreaseAdditionalValidatorStakeLayout layout,
})

(Staker only) Decrease active stake again from a validator, eventually moving it to the reserve

Works regardless if the transient stake account already exists.

Internally, this instruction:

withdraws rent-exempt reserve lamports from the reserve into the ephemeral stake

splits a validator stake account into an ephemeral stake account deactivates the ephemeral account

merges or splits the ephemeral account into the transient stake account delegated to the appropriate validator

Implementation

factory StakePoolProgram.decreaseAdditionalValidatorStake({
  /// 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
  required SolAddress transientStake,

  /// Reserve stake account, to fund rent exempt reserve
  required SolAddress reserveStake,

  ///  Uninitialized ephemeral stake account to receive stake
  required SolAddress ephemeralStake,
  required StakePoolDecreaseAdditionalValidatorStakeLayout layout,
}) {
  return StakePoolProgram(
      layout: layout,
      keys: [
        stakePool.toReadOnly(),
        staker.toSigner(),
        withdrawAuthority.toReadOnly(),
        validatorList.toWritable(),
        reserveStake.toWritable(),
        validatorStake.toWritable(),
        ephemeralStake.toWritable(),
        transientStake.toWritable(),
        SystemProgramConst.sysvarClockPubkey.toReadOnly(),
        SystemProgramConst.sysvarStakeHistoryPubkey.toReadOnly(),
        SystemProgramConst.programId.toReadOnly(),
        StakeProgramConst.programId.toReadOnly()
      ],
      programId: StakePoolProgramConst.programId);
}