Open codehawks-bot opened 1 year ago
Gas Optimization / Informational
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol
Constants in comparisons should appear on the left side
Doing so will prevent typo bugs
Instances (5):
File: src/DSCEngine.sol 96: if (amount == 0) { 331: if (totalDscMinted == 0) return type(uint256).max;
Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol
File: src/DecentralizedStableCoin.sol 49: if (_amount <= 0) { 59: if (_to == address(0)) { 63: if (_amount <= 0) {
Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol
Code Review using VSCode
Put constants on the left side in comparisons
Constants in comparisons should appear on the left side
Severity
Gas Optimization / Informational
Relevant GitHub Links
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol
Summary
Constants in comparisons should appear on the left side
Vulnerability Details
Doing so will prevent typo bugs
Instances (5):
Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DSCEngine.sol
Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/tree/main/src/DecentralizedStableCoin.sol
Tools Used
Code Review using VSCode
Recommendations
Put constants on the left side in comparisons