Skip to main content

StakerRewardCalculator

Trait StakerRewardCalculator 

Source
pub trait StakerRewardCalculator<Balance> {
    // Required methods
    fn calculate_validator_incentive_weight(self_stake: Balance) -> Balance;
    fn calculate_staker_reward(
        validator_total_reward: Balance,
        validator_commission: Perbill,
        validator_own_stake: Balance,
        total_exposure: Balance,
    ) -> StakerRewardResult<Balance>;
}
Expand description

Handles two independent reward calculations:

  1. Staker reward split (Self::calculate_staker_reward) — determines how a validator’s staking reward is divided between the validator and their nominators.

  2. Validator incentive weight (Self::calculate_validator_incentive_weight) — determines a validator’s relative share of a separate validator incentive pot, based on self-stake. This incentive pot is validator-only; nominators do not receive from it.

Required Methods§

Source

fn calculate_validator_incentive_weight(self_stake: Balance) -> Balance

Compute a weight for this validator’s share of the validator incentive pot.

Called once per validator during era planning. All validators’ weights are summed, and each validator’s incentive payout is proportional to their_weight / total_weight.

Source

fn calculate_staker_reward( validator_total_reward: Balance, validator_commission: Perbill, validator_own_stake: Balance, total_exposure: Balance, ) -> StakerRewardResult<Balance>

Split a validator’s staking reward into validator and nominator portions.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Balance: Default> StakerRewardCalculator<Balance> for ()

Source§

fn calculate_validator_incentive_weight(_self_stake: Balance) -> Balance

Source§

fn calculate_staker_reward( _validator_total_reward: Balance, _validator_commission: Perbill, _validator_own_stake: Balance, _total_exposure: Balance, ) -> StakerRewardResult<Balance>

Implementors§