0g-chain/migrate/v0_24/staking_rewards.md
Robert Pirtle bdfcf56fba prepare v0.24.1 release (#1758)
* prepare v0.24.1 release

* add staking_rewards migration doc
2023-10-25 12:49:00 -07:00

3.3 KiB
Raw Blame History

Migrate Staking Reward Calculation to Endpoint

Kava 15 (v0.25.x) is changing the mechanism for staking rewards, which will no longer be inflationary but will be paid out of the community module. In order to continue displaying expected yields or APYs to users, wallets and explorers will need to update.

To accommodate an easy transition to these new changes, a new endpoint has been backported to v0.24.

The endpoint calculates staking rewards for the current kava version and is forward compatible with future changes.

All consumers who display yearly staking reward percentages are encouraged to migrate from the standard calculation to using the endpoint, as the standard calculation will no longer be accurate in the near-future.

Endpoint: /kava/community/v1beta1/annualized_rewards Example Response:

{
  "staking_rewards": "0.203023625910000000"
}

Before Kava 15

The staking APR is calculated the same way as other cosmos-sdk chains. Various parameters are fetched and then combined in this calculation:

staking_apr ≈ mint_inflation *
    (1 - distribution_params.community_tax) *
    (total_supply_ukava/pool.bonded_tokens)

Note this doesnt include transaction fees paid to stakers.

Endpoints used:

Informational Endpoints

After Kava 15

Kava 15 will implement new staking rewards as ratified in this proposal: https://www.mintscan.io/kava/proposals/141. They will come into effect at the “switchover time” on 2024-01-01.

  • All delegating and claiming transactions remain unchanged. There is no change in how rewards are claimed or how claimable balances are queried.
  • After the switchover time, inflation will be set to zero (and rewards will be paid from the community module account).
  • After the switchover time, rewards are paid out according to:
staking apy ≈ community_params.staking_rewards_per_second *
    seconds_per_year / pool.bonded_tokens

Note this doesnt include transaction fees paid to stakers.