Open ermalkaleci opened 4 weeks ago
@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 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 !
We're close to merge PR Required changes are minimal.
New property
rank_rewards
is added to DAppTierRewardsSame as tier rewards but contains rank rewards.
New field
rank
is added to event DAppRewardRankedTier 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 valueconst 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.
Reward calculation Tier reward is the same
rewards[tier]
Rank reward calculation is very simplerank * rank_rewards[tier]
Final amountamount = rewards[tier] + rank * rank_rewards[tier]