The relevant accounting/data exposed for step 0.75 in Proof of Yield.
We want to be able fill out this section.
In this PR, I made a change to how the change (in percent) from one day to another was calculated. Previously, change was calculated by finding the difference in between rebasing_credits_per_token at the beginning and end of the time period, and dividing by the rebasing_credits_per_token at the beginning of the time period to receive a percentage.
However, later using this value to compute the total yield resulted in a discrepancy between the total yield, and the sum of the yields from the rebase events.
This isn't great since I imagine the purpose of this section in PoY is to show that the rebase events do add up. So now I calculate change using the sum of the rebase events.
change = Decimal(sum(event['amount'] for event in s.rebase_events) / 1e18) / (s.computed_supply - s.non_rebasing_supply)
The relevant accounting/data exposed for step 0.75 in Proof of Yield.
We want to be able fill out this section.
In this PR, I made a change to how the
change
(in percent) from one day to another was calculated. Previously,change
was calculated by finding the difference in betweenrebasing_credits_per_token
at the beginning and end of the time period, and dividing by therebasing_credits_per_token
at the beginning of the time period to receive a percentage.change = 1 - (s.rebasing_credits_per_token / last_snapshot.rebasing_credits_per_token)
However, later using this value to compute the total yield resulted in a discrepancy between the total yield, and the sum of the yields from the rebase events.
s.gain = change * (s.computed_supply - s.non_rebasing_supply)
This isn't great since I imagine the purpose of this section in PoY is to show that the rebase events do add up. So now I calculate
change
using the sum of the rebase events.change = Decimal(sum(event['amount'] for event in s.rebase_events) / 1e18) / (s.computed_supply - s.non_rebasing_supply)