Trait cfg_traits::rewards::GroupRewards
source · pub trait GroupRewards {
type Balance;
type GroupId;
// Required methods
fn is_ready(group_id: Self::GroupId) -> bool;
fn reward_group(
group_id: Self::GroupId,
reward: Self::Balance
) -> Result<Self::Balance, DispatchError>;
fn group_stake(group_id: Self::GroupId) -> Self::Balance;
}
Expand description
Abstraction over a distribution reward groups.
Required Associated Types§
Required Methods§
sourcefn is_ready(group_id: Self::GroupId) -> bool
fn is_ready(group_id: Self::GroupId) -> bool
Check if the group is ready to be rewarded. Most of the cases it means that the group has stake that should be rewarded.
sourcefn reward_group(
group_id: Self::GroupId,
reward: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn reward_group( group_id: Self::GroupId, reward: Self::Balance ) -> Result<Self::Balance, DispatchError>
Reward a group distributing the reward amount proportionally to all
associated accounts. This method is called by distribution method only
when the group is considered ready, check GroupRewards::is_ready()
.
The method returns the minted reward. Depending on the implementation it
may be less than requested.
sourcefn group_stake(group_id: Self::GroupId) -> Self::Balance
fn group_stake(group_id: Self::GroupId) -> Self::Balance
Retrieve the total staked amount.
Object Safety§
This trait is not object safe.