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

Burned rewards calculation #1269

Merged
merged 2 commits into from
Apr 26, 2024
Merged

Burned rewards calculation #1269

merged 2 commits into from
Apr 26, 2024

Conversation

bobo-k2
Copy link
Contributor

@bobo-k2 bobo-k2 commented Apr 25, 2024

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 'till current_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 last era of the current period under assumption that we will have the same dApp tier allocations as in previous era. 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.

image

Check list

  • contains breaking changes
  • adds new feature
  • modifies existing feature (bug fix or improvements)
  • relies on other tasks
  • documentation changes
  • tested on mobile devices

Copy link

github-actions bot commented Apr 25, 2024

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

@Kahonnohak
Copy link
Contributor

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) {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return result;
};

onMounted(() => {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@Kahonnohak Kahonnohak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@bobo-k2 bobo-k2 merged commit a0a4bcf into main Apr 26, 2024
9 checks passed
@bobo-k2 bobo-k2 deleted the fix/burned-rewards branch April 26, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants