Function pallet_capacity::pallet::dispatchables::change_staking_target
source · pub fn change_staking_target<T: Config>(
from: MessageSourceId,
to: MessageSourceId,
amount: <<T as Config>::Currency as InspectFungible<<T as Config>::AccountId>>::Balance
)
Expand description
Sets the target of the staking capacity to a new target.
This adds a chunk to StakingDetails.stake_change_unlocking chunks
, up to T::MaxUnlockingChunks
.
The staked amount and Capacity generated by amount
originally targeted to the from
MSA Id is reassigned to the to
MSA Id.
Does not affect unstaking process or additional stake amounts.
Changing a staking target to a Provider when Origin has nothing staked them will retain the staking type.
Changing a staking target to a Provider when Origin has any amount staked to them will error if the staking types are not the same.
Errors
Error::MaxUnlockingChunksExceeded
ifstake_change_unlocking_chunks
==T::MaxUnlockingChunks
Error::StakerTargetRelationshipNotFound
iffrom
is not a target for Origin’s staking account.Error::StakingAmountBelowMinimum
ifamount
to retarget is below the minimum staking amount.Error::InsufficientStakingBalance
ifamount
to retarget exceeds what the staker has targeted tofrom
MSA Id.Error::InvalidTarget
ifto
does not belong to a registered Provider.Error::MaxRetargetsExceeded
if origin has reached the maximimum number of retargets for the current RewardEra.
Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::change_staking_target
.