15,000 USDC
View results
Submission Details
Severity: gas

Ordering of Modifiers

Summary

We can save the caller some gas by updating the order of two modifiers

Vulnerability Details

Gas Impact for Caller

Impact

When depositing Collateral using depositCollateral three modifiers are used, ideally if there is an error that will revert in one of these modifiers we would like to save the caller gas.

If the caller is using an incorrect Collateral token, we should revert with this modifier first before checking to see that we have more than zero of the incorrect token

Tools Used

Manual Review

Recommendations

Move content of line 152 to line 151 and content from line 151 to line 152 in order to update the order of the Modifiers:

  • moreThanZero(amountCollateral)

  • isAllowedToken(tokenCollateralAddress)

  • isAllowedToken(tokenCollateralAddress)

  • moreThanZero(amountCollateral)

Support

FAQs

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