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

Missing address 0 checks in DSCEngine's constructor

Summary

Missing address 0 checks in DSCEngine's constructor for the memory arrays and DecentralizedStableCoin address

Vulnerability Details

The memory arrays tokenAddresses[] and priceFeedAddresses[] are checked if they are the same length which is a solidity best practice. However address(0) checks are missing. In this way we are relying on the deployer that he will pass the corrects addresses. However I think it will be a good practice to include zero address checks to ensure DSCEngine cannot be faulty initialized.

Impact

Low

Tools Used

Manual Review

Recommendations

Maybe you should add the following check in the constructor after checking the array's lenghts:
if(tokenAddresses[i] == address(0) && priceFeedAddresses[i] == address(0) { revert DSCEngine_tokenPriceFeedIsAddress0};
Note that I wrote the statement this way because the contract uses custom errors. The error DSCEngine_tokenPriceFeedIsAddress0 is not declared in the contract I made it up.

Support

FAQs

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