Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new tutorial for reward calculations #1

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
latex: true
});

module.exports = withNextra({
async redirects() {
return [
{
source: '/cross-chain-communication/integrations',
destination: '/cross-chain-communication/active-development',
permanent: true, // or false if the redirect is temporary
},
]
source: "/cross-chain-communication/integrations",
destination: "/cross-chain-communication/active-development",
permanent: true // or false if the redirect is temporary
}
];
},
webpack: (config, { isServer }) => {
if (isServer) {
require('./scripts/generate-sitemap');
require("./scripts/generate-sitemap");
}
return config;
},
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# How to calculate rewards

## Reward calculation

Currently rewards are calculated this way:

* Fetch `iglobal` by calling `getNetworkInfo` method of chain contract (`cx00..00`) divide by 10**18 (to convert from units in loop)
* Fetch `iprep` by calling `getNetworkInfo` method of chain contract (`cx00..00`)
* Fetch `totalPower` by calling `getNetworkInfo` method of chain contract (`cx00..00`) Fetch prep power (power) by calling `getPRep` method chain contract (`cx00..00`)
* Fetch `commissionRate` by calling `getPRep` method chain contract (`cx00..00`) divide by 10000

$$
VVMP = Validator \enspace and \enspace Voter \enspace Monthly \enspace Reward
\\

VVMP = prepPower * \frac{\Big(iglobal * \frac{iprep}{10000}\Big)}{totalPower}
\\
$$

$$
VoMP = Voter \enspace Monthly \enspace Reward
\\
VoMP = VVMP * (1 - commissionRate)
\\
VaMP = Validator \enspace Monthly \enspace Reward
\\

VaMP = VVMP * commissionRate
$$

## Reward dilution for voters due to bond mechanism

If the validator has bonded more than 5% of their voted amount (delegated amount + bonded), as new voters add delegation to the prep the prepPower variable will increase which means the validator and voters will receive more rewards.


If the bond is equal or less than 5% any increase in delegation (new voters delegating more to the validator) will only dilute the rewards of all the voters because the prepPower will not increase.

$$
bond \le 5\% \implies prepPower \enspace doesnt \enspace increases \enspace with \enspace new \enspace voters
\\
prepPower = min \Big(bonded*20, bonded+delegated\Big)
\\
Delegated \enspace amount \enspace increase \enspace without \enspace increase \enspace in \enspace bonding \implies \\ No \enspace change \enspace in \enspace prepPower \implies No \enspace change \enspace in \enspace rewards \implies \\ generates \enspace reward \enspace dilution
$$

If prepPower doesnt increase then voters monthly reward gets divided by a bigger amount of delegated (voters)

![](/images/rewards1.png)
Binary file added public/images/rewards1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading