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

Using unchecked blocks to save gas

Summary

Increments in for loop can be unchecked ( save 30-40 gas per loop iteration)

Vulnerability Details

In line 119, the following is used

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

Impact

Increase in runtime gas costs

Tools Used

Manual review

Recommendations

Consider using the following.

for(uint256 i; i < tokenAddresses.length;) {
// loop logic
unchecked { ++i; }
}

Support

FAQs

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