pub trait DistributedRewards: GroupRewards{
// Provided methods
fn distribute_reward<It>(
reward: Self::Balance,
groups: It
) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>
where It: IntoIterator<Item = Self::GroupId>,
<It as IntoIterator>::IntoIter: Clone { ... }
fn distribute_reward_with_weights<Weight, It>(
reward: Self::Balance,
groups: It
) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>
where Weight: FixedPointOperand + EnsureAdd + Unsigned,
It: IntoIterator<Item = (Self::GroupId, Weight)>,
<It as IntoIterator>::IntoIter: Clone { ... }
}
Expand description
Distribution mechanisms over group rewards.
This trait is implemented automatically for all GroupRewards
with the
requested bounds.
Provided Methods§
fn distribute_reward<It>(
reward: Self::Balance,
groups: It
) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>
fn distribute_reward<It>( reward: Self::Balance, groups: It ) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>
Distribute uniformly the reward given to the entire list of groups. Only groups with stake will be taken for distribution.
This method makes several calls to Rewards::reward_group()
under the
hood. If one of those calls fail, this method will continue to reward
the rest of the groups, The failed group errors will be returned.
fn distribute_reward_with_weights<Weight, It>(
reward: Self::Balance,
groups: It
) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>where
Weight: FixedPointOperand + EnsureAdd + Unsigned,
It: IntoIterator<Item = (Self::GroupId, Weight)>,
<It as IntoIterator>::IntoIter: Clone,
fn distribute_reward_with_weights<Weight, It>(
reward: Self::Balance,
groups: It
) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>where
Weight: FixedPointOperand + EnsureAdd + Unsigned,
It: IntoIterator<Item = (Self::GroupId, Weight)>,
<It as IntoIterator>::IntoIter: Clone,
Distribute the reward given to the entire list of groups.
Only groups with stake will be taken for distribution.
Each group will recive a weight / total_weight
part of the reward.
This method makes several calls to Rewards::reward_group()
under the
hood. If one of those calls fail, this method will continue to reward
the rest of the groups, The failed group errors will be returned.