pub trait DistributedRewards: GroupRewards
where Self::Balance: FixedPointOperand + Zero, Self::GroupId: Clone,
{ // 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>
where It: IntoIterator<Item = Self::GroupId>, <It as IntoIterator>::IntoIter: Clone,

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,

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.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<Balance, GroupId, T> DistributedRewards for T
where Balance: FixedPointOperand + Zero, GroupId: Clone, T: GroupRewards<Balance = Balance, GroupId = GroupId>,