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

change openings reward display #4745

Merged
merged 2 commits into from
Jan 30, 2024
Merged

change openings reward display #4745

merged 2 commits into from
Jan 30, 2024

Conversation

vrrayz
Copy link
Contributor

@vrrayz vrrayz commented Jan 23, 2024

Fixes #4516

Copy link

vercel bot commented Jan 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dao ✅ Ready (Inspect) Visit Preview Jan 30, 2024 9:12am
pioneer-2 ✅ Ready (Inspect) Visit Preview Jan 30, 2024 9:12am
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview Jan 30, 2024 9:12am

title={`Reward per ${rewardPeriod?.toString()} blocks`}
value={rewardPeriod?.mul(opening.rewardPerBlock)}
title={'Reward per week'}
value={rewardPeriod?.mul(opening.rewardPerBlock).mul(new BN(7))}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The code now makes the assumption that opening.rewardPerBlock is a day , which is fine but in this case there's no need to use the api rewardPerBlock (because if the api returns something else than 14400 then rewardPerBlock * 7 won't be a week anymore).

So IMO this would be a lot clearer:

Suggested change
value={rewardPeriod?.mul(opening.rewardPerBlock).mul(new BN(7))}
value={opening.rewardPerBlock.muln(A_WEEK / MILLISECONDS_PER_BLOCK}

Or even:

Suggested change
value={rewardPeriod?.mul(opening.rewardPerBlock).mul(new BN(7))}
value={opening.rewardPerBlock.muln(BLOCKS_PER_WEEK}

(With BLOCKS_PER_WEEK defined as a constant somewhere).

Copy link
Collaborator

@thesan thesan left a comment

Choose a reason for hiding this comment

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

LGTM

@thesan thesan merged commit a102234 into Joystream:dev Jan 30, 2024
7 checks passed
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.

Openings: Change the way rewards are displayed
2 participants