20,000 USDC
View results
Submission Details
Severity: medium

[M-04] `updateFor` function may not work

Summary

If the update function is not updated, this function will not change any state.

Vulnerability Details

When updateFor is called.

It is found in this statement:

82 uint256 _supplied = balances[recipient];
83 if (_supplied != 0) {

This sentence will not be fulfilled, since the mapping balances of the recipient is 0.
Since it does not comply, this sentence would be activated:

91 } else {
92 supplyIndex[recipient] = index;
93 }

The index variable is initialized to 0, so it wouldn't update the value for us either and neither would the balances.
Therefore it will never be updated.

Impact

Users will not earn rewards

Tools Used

Manual code review

Recommendations

Ensure correct operation of update else revert the function

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.