pub trait DistributedRewards: GroupRewards
where <Self as GroupRewards>::Balance: FixedPointOperand + Zero, <Self as GroupRewards>::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::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::IntoIter: Clone { ... } }
Expand description

Distribution mechanisms over group rewards. This trait is implemented automatically for all GroupRewards with the requested bounds.

Provided Methods§

source

fn distribute_reward<It>( reward: Self::Balance, groups: It ) -> Result<Vec<Result<Self::Balance, DispatchError>>, DispatchError>
where It: IntoIterator<Item = Self::GroupId>, It::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.

source

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::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§

source§

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