antipalos / antipalos.github.io

Σελίδες γνώσης
4 stars 5 forks source link

Add "per epoch" calculations option in addition to "per year" #5

Open vsubhuman opened 6 years ago

vsubhuman commented 6 years ago

"Restaking" calculations are planned in https://github.com/antipalos/antipalos.github.io/issues/4. But in order for restaking to be more real-life-like - it should be calculated (optionally) on the "per epoch" basis, cuz people can theoretically restake profits every 5 days.

The whole calculations system should be reworked to do actual calculations on "the higher resolution" of epochs, and the year results will be calculated as aggregates. This will also allow to give users some more interesting intermediate results.

vsubhuman commented 6 years ago

The complication is that it is not that obvious how to calculate the per-epoch inflation. I mean it might seem that actual decrease should also be gradual, so decrease at the last epoch of the year would actually be a little bit bigger than the decrease. For this to work - the per-epoch decrease should also be calculated in percents, but I am not sure for now how to derive a formula that would yield the same per-year decrease. For example:

If we have a reserve of 100 coins and a per-year decrease of 10% - then after year 1 the reserve if 90 coins. But if we have two epochs - it is (of course) not enough to just split the 10% in two and calculate (100 - 5%) - 5% cuz this would yield 90,25.

I'm positive there's a function already that allows to calculate the "step" percentages from a total period percentage and the number of steps (epochs), but I just don't know it yet. Need to google it.

Note: other option might be to calculate per-year percentage and then just divide the result coins into 73 epochs, so in out example we calculate 10% of 100 and then divide 10 in two and get 2 epochs of 5 coins. This would give us 73 completely equal epochs in a year and remove this "coolness" of a gradual decrease, but would also significantly simplify the calculations.

Additional question is: how IOHK plan to actually calculate this in the actual system? It might as well be that they will also just calculate (yearly decrease / 73) for each epoch, who knows.