15,000 USDC
View results
Submission Details
Severity: gas

Return Statement is not necessary in `DSCEngine.getAccountCollateralValue()`

Summary

The DSCEngine.getAccountCollateralValue() is already defined with a named return (returns (uint256 totalCollateralValueInUsd)).

Therefore, there is no need to use the return totalCollateralValueInUsd; statement in the end of the function since it will automatically return this parameter once the execution of the function is completed.

Impact

Save some gas by removing this return statement.

Tools Used

VSCode

Recommendations

Remove the following line of code:
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L358

Support

FAQs

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