Contract - BaseGauge.sol
The _updateReward()
function is as follow -
The rewardPerTokenStored
deals with accumulated reward per Token, collectively for all users. It doesn't deals with single user.
Currently it's state.rewardPerTokenPaid = rewardPerTokenStored
, which is wrong.
Because state.rewardPerTokenPaid
purpose if to track the amount or reward per token paid to a user, not all user.
Means state.rewardPerTokenPaid
is wrongly being updated, with a state variable that's used for collective all user.
Incorrect updation of userStates[account]
.
userStates[account]
is being used in earned()
function.
earned()
function is being used to calculate reward earned by user.
Hence, wrong amount will be calculated and transferred to user.
Loss to fund and to protocol and user.
Manual
Change the current architecture if function, by using share based model. calculate user's share and multiply by rewardPerTokenStored
then use that value to update state.rewardPerTokenPaid
.
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.