15,000 USDC
View results
Submission Details
Severity: gas

Modifiers Naming

Summary

Modifiers can be named better

Vulnerability Details

Modifiers need to clearly express what they are checking, enforcing or requiring or not allowing etc.
The modifier moreThanZero(..) needs to be clear that its amount that must be enforced to be more than zero
The modifier isAllowedToken() makes it seem as if its saying token is allowed vs is token allowed?, it's not clear

Impact

Informational: Naming them right helps other developers, auditors . maintainers impacting better readability, maintanability and auditability of code.

Tools Used

Manual analysis

Recommendations

It is recommended that modifiers use consistent, descriptive naming that signifies clarity as to what is being checked, enforced or required etc. It may be best practise to consider using 'only' format for modifiers enforcing check of what is allowed and what is not allowed e.g

DSCEngine.sol line 95 moreThanZero -> onlyAmountsAboveZero(...)
DSCEngine.sol line 102 isAllowedToken -> onlyAllowedToken(...)
With better naming monitoring and error reading and assessing becomes easier and faster

Support

FAQs

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