Skip to content

Rewards Calculation Logic

saumyakaran edited this page May 20, 2020 · 1 revision

Inputs

  • Total era points for given era ( net_points )
  • Era points for given validator in that era ( points )
  • Total rewards (in KSM) for given era ( net_rewards )
  • Commission for given validator in % ( commission )
  • Total stake on the validator in KSM ( total_stake )
  • Stake Amount ( stake_amount )

Output

  • Expected Daily Earning in KSM ( expected_daily_earning )

Logic

First, we calculate the pool_reward for given validator in the given era:

pool_reward = ( points / net_points ) * net_rewards

The pool_reward is determined for the past 4 eras for each validator and summed up. Let's call it summation_pool_reward.

Next, we determine the fraction of the pool which the user will hold if they stake stake_amount KSM on given validator. Let's call this fraction user_stake_fraction.

user_stake_fraction = stake_amount / ( stake_amount + total_stake )

Finally, to determine expected_daily_earning, we subtract commission from summation_pool_reward and multiply it with user_stake_fraction:

expected_daily_earning = user_stake_fraction * ( summation_pool_reward * ( 1 - ( commission / 100 ) ) )
Clone this wiki locally