Skip to content

Returns Calculation Mechanism

saumyakaran edited this page Jul 25, 2020 · 1 revision

Inputs

User inputs

  • Stake Amount ( stake_amount )
  • Risk preference
  • Time period (time_period_in_eras)
  • Compounding on/off

On-chain inputs

  • Average for previous 4 era's total era points ( net_points )
  • Average of era points for given validator pool till now ( 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 )

Outputs

  • Expected Returns in KSM ( expected_returns )
  • Expected Portfolio Value in KSM ( expected_portfolio_value )
  • Expected Yield in % ( expected_yield )

Logic

First, we calculate the expected_pool_reward for each suggested/selected validator in the given era:

expected_pool_reward = ( points / net_points ) * net_rewards

The expected_pool_reward is determined 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 )

Then, we determine expected_returns_per_era for each suggested/selected validator. For this, we subtract commission from expected_pool_reward and multiply it with user_stake_fraction:

expected_returns_per_era = user_stake_fraction * ( expected_pool_reward * ( 1 - ( commission / 100 ) ) )

We sum up the expected_returns_per_era for all validators to get the net_expected_returns_per_era

From here, we have 2 cases:

  1. Compounding off
  • Expected Returns in KSM ( expected_returns )
expected_returns = net_expected_returns_per_era * time_period_in_eras
  1. Compounding on
  • Expected Returns in KSM ( expected_returns )
expected_returns = (stake_amount * (1 + (net_expected_returns_per_era / stake_amount)) ** time_period_in_eras) - stake_amount

NOTE: The logic for calculation of portfolio value and expected yield remains the same in both cases, however the results change due to the difference in expected_returns:

  • Expected Portfolio Value in KSM ( expected_portfolio_value )
expected_portfolio_value = stake_amount + expected_returns
  • Expected Yield in % ( expected_yield )
expected_yield = 100 * (expected_returns / stake_amount)
Clone this wiki locally