TempleGoldStaking contract treat new staker and old staker the same, hence have the same reward token distributed
In TempleGoldStaking contract, we have a mapping called userRewardPerTokenPaid, which basically caches staker's _perTokenReward since the last time the staker interacted with the contract
When staker stakes at any time, userRewardPerTokenPaid[_account][_index] is not set, which means the next time user claim the reward, the protocol treats the staker as if he staked at the very beginning of the staking start point
POC: throw this to TempleGoldStaking.t.sol:
This will have an unfair scenario:
VESTING_DURATION = 2 weeks, REWARD_DURATION = 16 weeks
Alice stake() 1000e18 stakeToken in week 1
Bob stake() 1000e18 stakeToken in week 14
In week 16, Alice and Bob getReward(), and both have the same rewardToken amount
More extremely, Bob in the above scenario can loan a gigantic amount of stakeToken to stake() in week 14, which he will end up taking most of the reward token in that staking period
Manual Review
Make sure the staker's _accountLastStakeIndex is set while staker calls to stake()
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.