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

`deposit`, `redeem`, `flashloan` and `repay` functions don't check for 0 amount

Summary

With the current design of the protocol, any user could call deposit, flashloan, repay, or even redeem if they have already deposited funds, with a 0 value for amount (or amountOfAssetToken for redeem function).

Vulnerability Details

Such a call would succeed while no action would be executed. This would result in a transaction being executed entirely for no reasons. This would cost gas and could be prevented by a sanity check for 0 value.

Impact

The impact is LOW and it might almost be considered a gas optimisation (but for users). Adding a sanity check would prevent useless call to functions like flashloan or deposit that might consume gas for nothing.

Tools Used

Manual

Recommendations

I recommend to add the following check in deposit, redeem and flashloan functions :

if (amount == 0) {
revert ThunderLoan_amountCannotBeZero();
}

after declaring a new custom error in the contract :

error ThunderLoan_amountCannotBeZero();
Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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