code-423n4 / 2021-12-vader-findings

0 stars 0 forks source link

`rewardRate` parameter are not updated in time #146

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

ACai

Vulnerability details

Impact

https://github.com/code-423n4/2021-12-vader/blob/main/contracts/staking-rewards/StakingRewards.sol

The rewardRate would still 0 after the function notifyRewardAmount is executed. The user who stake in this contract can not Inquire their reward.

Proof of Concept

https://github.com/code-423n4/2021-12-vader/blob/main/contracts/staking-rewards/StakingRewards.sol

At the beginning, the rewardRate is 0.

Before the owner of StakingRewards call the function notifyRewardAmount, the rewardRate still 0. But it has been used in function getRewardForDuration() and function rewardPerToken(). This causes the return value of the function getRewardForDuration() and function rewardPerToken() to be 0. It means that the user who stake in this contract can not Inquire their reward.

Tools Used

VS Code

Recommended Mitigation Steps

-