15,000 USDC
View results
Submission Details
Severity: gas
Valid

Misleading comment in DSCEngine._healthFactor

Summary

The _healthFactor method of DSCEngine contract is preceeded by the following comment:

/*
* Returns how close to liquidation a user is
* If a user goes below 1, then they can get liquidated
*/
function _healthFactor(address user) private view returns (uint256) {
(uint256 totalDscMinted, uint256 collateralValueInUsd) = _getAccountInformation(user);
return _calculateHealthFactor(totalDscMinted, collateralValueInUsd);
}

The comment implies that the minimal acceptable health factor for the user is equal to 1. This is not true - the MIN_HEALTH_FACTOR constant is equal to 1e18. Therefore this comment is misleading and in contradiction to the actual contract's logic.

Vulnerability Details

n/a

Impact

n/a

Tools Used

Manual review

Recommendations

Change the value in the comment to 1e18

Support

FAQs

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