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

For Loop unchecked may save gas

Summary

Adding variable i as unchecked may help reduce gas. Can be used in 2 for loops in DSCEngine.Links shown above.

Vulnerability Details

Impact

Tools Used

Foundry test suit

Recommendations

one of the for loop customized for gas saving shown below

    for (uint256 i ; i < tokenAddresses.length; ) {
        s_priceFeeds[tokenAddresses[i]] = priceFeedAddresses[i];
        s_collateralTokens.push(tokenAddresses[i]);
        
        unchecked{
            ++i;
        }
    }

Support

FAQs

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