You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create a generic StakingRewardsPerEpoch contract (vs the standard StakingRewardsPerBlock)
Use baseshare field the synthetix as baseline. the baseshare field has a "multiplier" feature, that we dont need.
All rewards contracts follow a similar structure
when user performs an action like stake/withdraw his state + global accumulated rewards is updated.
in our case, since rewards are not per block, plus they are not in the original staking token, the global accumulator needs to be updated once collectUBI is called and fuse are swapped to G$
Because a user might stake just before collectUBI is called, in this case he would get a "free launch" of the rewards accumulated between the two last calls of collectUBI. So we need a little bit more complication
when user stake we
add the amount to "pendingStakes"
we mark that user staked after collectUBI event #X
when collectUBI is called
we distribute the rewards per share (synthetix rewardPerToken())
we then increase number of shares by "pendingStakes" (synthetix totalySupply+pendingStakes)
and update an array rewardsPerTokenAt[X+1] with the global rewards (instead of currently it is a single variable)
when user does any action - withdraw/stake, we use rewardsPerTokenAt[X+1] as his baseline. so if user staked at time Ti and withdraw at time Tj he is entitled to rewardsPerTokenAt[Tj] - rewardsPerTokenAt[Ti+1] (synthetix earned())
The text was updated successfully, but these errors were encountered:
sirpy
changed the title
Make a reward distribution mechanism in function that sends the users reward on his demand
FuseStaking rewards distribution logic
Mar 17, 2022
sirpy
changed the title
FuseStaking rewards distribution logic
Generic contract for rewards distribution logic
Mar 30, 2022
The text was updated successfully, but these errors were encountered: