Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: low
Invalid

Don't need to set s_balanceDuringFlashLoan to 0 in the constructor of MockFlashLoanReceiver

Summary

s_balanceDuringFlashLoan is initialized to 0 in the constructor of MockFlashLoanReceiver. This serves no purpose because the only function that is not a getter function (ie, executeOperation) immediately sets s_balanceDuringFlashLoan to the amount of tokens in the contract anyway

Vulnerability Details

s_balanceDuringFlashLoan is set in the constructor to 0:

s_balanceDuringFlashLoan = 0;

Impact

You are wasting gas and maybe opening up additional attack surface when you don't need to. Plus variables are initialized to 0 when a contract is deployed anyway.

Tools Used

Manual review

Recommendations

Remove this from the constructor of MockFlashLoanReceiver:

s_balanceDuringFlashLoan = 0;
Updates

Lead Judging Commences

0xnevi Lead Judge
about 2 years ago
0xnevi Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Mock contracts issue

Support

FAQs

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