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

dAppStakingV3 ranked tier update #1305

Open
ermalkaleci opened this issue Jun 5, 2024 · 2 comments · Fixed by #1324
Open

dAppStakingV3 ranked tier update #1305

ermalkaleci opened this issue Jun 5, 2024 · 2 comments · Fixed by #1324
Assignees
Labels
enhancement New feature or request

Comments

@ermalkaleci
Copy link

ermalkaleci commented Jun 5, 2024

We're close to merge PR
Required changes are minimal.

New property rank_rewards is added to DAppTierRewards
Screenshot 2024-06-05 at 10 30 48 PM
Same as tier rewards but contains rank rewards.

New field rank is added to event DAppReward
Screenshot 2024-06-05 at 10 29 28 PM

RankedTier type is still u8 like TierId but it contains 2 values (rank & tier). This is done in order to keep PoV low.
Tier exists on the first byte, use bitwise AND to get the value const tier_id = value & 0xf
to get rank exists on the second byte, do a right shift 4 bits to get the value const rank = value >> 4
You can implement this even before the release because old tier values are from 0 to 3 and the rank will be zero.

DAppStakingApi is bumped to version 2. Nothing is changed here expect the return value which is still the same (u8) but represents different value, which is the encoded RankedTier value, so that's why we bumped it.
Screenshot 2024-06-05 at 10 44 22 PM

Reward calculation
Tier reward is the same rewards[tier]
Rank reward calculation is very simple rank * rank_rewards[tier]
Final amount amount = rewards[tier] + rank * rank_rewards[tier]

@ermalkaleci ermalkaleci added the enhancement New feature or request label Jun 5, 2024
@bobo-k2 bobo-k2 self-assigned this Jun 12, 2024
@bobo-k2 bobo-k2 linked a pull request Jun 17, 2024 that will close this issue
6 tasks
@Dinonard
Copy link
Member

@Kahonnohak this is something that should also be displayed on the UI.

Maybe just as a small number next to the dApp name in the ladder.

@Kahonnohak
Copy link
Contributor

@Kahonnohak this is something that should also be displayed on the UI.

Maybe just as a small number next to the dApp name in the ladder.

Great work! Thanks @Dinonard @ermalkaleci !

@bobo-k2 bobo-k2 mentioned this issue Jul 31, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants