Implementation of Compound Interest

Ethlizard's staking contract uses a unique method to calculate compound interest. Since it is impossible to store decimals in solidity, and there are overflow requirements, we are unable to calculate compound interest via a regular, simple means.

Instead, we use this formula to calculate continuous compound interest, using the ABDKMath64x64 library:

This is the result of converting a basic compound interest formula into the above via log laws.

And this means our rebasing factor is:

The implementation of the above formulas is found within the function calculateRebasePercentage.

Last updated