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§
type Balance
type Balance
Type used as balance for all currencies and reward.
type GroupId
type GroupId
Type used to identify the group
Required Methods§
fn 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.
fn 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.
fn 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.