if the value of initial rewards if low then it can cause loss of rewards for multiple rounds which can accumulate as a bigger rewards.
Following is the function which calculates the rewards.
Now lets assume payout start = 0(just for simplification )
decrease interval = 5 sec
rewards decrease = 3
initial Amount = 10
then if this function is called at 4sec i.e end time = 4sec and someone had already deposited before payout start then following will be the inputs getPeriodReward(
10, 3, 0, 5, 0,4)
now this would return 8 so 2 tokens are left as rewards for this interval
So if again the above function is called with the following inputs
getPeriodReward(
10, 3, 0, 5, 4,5) this will return 2
So 8+2 total 10 tokens have been rewarded which is the correct amount for this interval
Now if getPeriodReward(
10, 3, 0, 5, 5,9) then it will return 5 tokens so the tokens left for this interval = 2 because for the 2nd interval there is decrease of rewards by the decrease reward which is equal to 3.
now if getPeriodReward(
10, 3, 0, 5, 9,10) then it will return 1 token and the interval ends so total rewards distributed = 5 +1 = 6 which means 1 token remains undistributed.
This can happen in mutliple rounds which can cause less rewards token being transferred to the users.
Key to note is that this happens when the value of rewards to be distributed are low so this issue can be medium/low issue but certainly it is a valid issue.
Causes some rewards token to remain undistributed thus causing loss to the users.
Manual review
It is difficult to come up with a mitigation for this issue as it can cause the whole function to change.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.