fn reward_validator(stash: &T::AccountId, reward: BalanceOf<T>) {
		let off_the_table = reward.min(Self::validators(stash).validator_payment);
		let reward = reward - off_the_table;
		let mut imbalance = <PositiveImbalanceOf<T>>::zero();
		let validator_cut = if reward.is_zero() {
			Zero::zero()
		} else {
			let exposure = Self::stakers(stash);
			let total = exposure.total.max(One::one());
			let safe_mul_rational = |b| b * reward / total;// FIXME #1572:  avoid overflow
			for i in &exposure.others {
				let nom_payout = safe_mul_rational(i.value);
				imbalance.maybe_subsume(Self::make_payout(&i.who, nom_payout));
			}
			safe_mul_rational(exposure.own)
		};
		imbalance.maybe_subsume(Self::make_payout(stash, validator_cut + off_the_table));
		T::Reward::on_unbalanced(imbalance);
	}
/// Reward a given validator by a specific amount. Add the reward to their, and their nominators'
/// balance, pro-rata based on their exposure, after having removed the validator's pre-payout cut.
Reward a given validator by a specific amount. Add the reward to their, and their nominators'
balance, pro-rata based on their exposure, after having removed the validator's pre-payout cut.
Reward a given validator by a specific amount . Add the reward to their and their nominators ' balance pro - rata based on their exposure after having removed the validator ' s pre - payout cut .
fn reward_validator(stash: &T::AccountId, reward: BalanceOf<T>) {
		let off_the_table = reward.min(Self::validators(stash).validator_payment);
		let reward = reward - off_the_table;
		let mut imbalance = <PositiveImbalanceOf<T>>::zero();
		let validator_cut = if reward.is_zero() {
			Zero::zero()
		} else {
			let exposure = Self::stakers(stash);
			let total = exposure.total.max(One::one());
			let safe_mul_rational = |b| b * reward / total;// FIXME #1572:  avoid overflow
			for i in &exposure.others {
				let nom_payout = safe_mul_rational(i.value);
				imbalance.maybe_subsume(Self::make_payout(&i.who, nom_payout));
			}
			safe_mul_rational(exposure.own)
		};
		imbalance.maybe_subsume(Self::make_payout(stash, validator_cut + off_the_table));
		T::Reward::on_unbalanced(imbalance);
	}
fn reward_validator ( stash : & T :: AccountId , reward : BalanceOf < T > ) { let off_the_table = reward . min ( Self :: validators ( stash ) . validator_payment ) ; let reward = reward - off_the_table ; let mut imbalance = < PositiveImbalanceOf < T > > :: zero ( ) ; let validator_cut = if reward . is_zero ( ) { Zero :: zero ( ) } else { let exposure = Self :: stakers ( stash ) ; let total = exposure . total . max ( One :: one ( ) ) ; let safe_mul_rational = | b | b * reward / total ; // FIXME #1572:  avoid overflow for i in & exposure . others { let nom_payout = safe_mul_rational ( i . value ) ; imbalance . maybe_subsume ( Self :: make_payout ( & i . who , nom_payout ) ) ; } safe_mul_rational ( exposure . own ) } ; imbalance . maybe_subsume ( Self :: make_payout ( stash , validator_cut + off_the_table ) ) ; T :: Reward :: on_unbalanced ( imbalance ) ; }
Reward a given validator by a specific amount.
Reward a given validator by a specific amount .
stash
&T::AccountId
reward
BalanceOf<T>
stash
&T::AccountId
reward
BalanceOf<T>