-
Notifications
You must be signed in to change notification settings - Fork 94
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
Burned rewards calculation #1269
Conversation
Visit the preview URL for this PR (updated for commit f40ec50): https://astar-apps--pr1269-fix-burned-rewards-w3lcu4xd.web.app (expires Fri, 03 May 2024 06:57:49 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: dd76fe72958fe2910fef9d53f0b4539b82b849db |
Thanks @bobo-k2 I'll check & verify by manually adding tokens tomorrow! |
|
||
// Determine number of used dApp slots per tier. | ||
for (let dapp of dappTierRewards.dapps) { | ||
if (dapp.tierId !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(dapp.tierId)
I think it is more better for filtering null too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
return result; | ||
}; | ||
|
||
onMounted(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps add 'async' and 'await' here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't await here because calculateTotalTokensToBeBurned
internally updates ref
value and this will cause UI to re-render the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Pull Request Summary
Fixed existing 'tokens to be burned' calculation to use real dApp tiers allocation.
The code goes from the first
era
in the current period 'tillcurrent_era - 1
and calculates how much reward are allocated for empty tiers slots (those are burned rewards). Those calculation is based on real data.Second part of the calculations calculates the same from
current_era
until lastera
of the current period under assumption that we will have the same dApp tier allocations as in previousera
. Since we are looking for total tokens to be burned this is the best we can.The more we are progressing till the end of the current period the more precise calculation will be.
Check list