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

Use unchecked keyword for increment operations in loops

Summary

++i/i++ should be unchecked{++i}/unchecked{i++} when it is not possible for them to overflow, as is the case when used in for- and while-loops. The unchecked keyword is new in solidity version 0.8.0, so this only applies to that version or higher, which these instances are. This saves 30-40 gas per loop.

Vulnerability Details

File: DSCEngine.sol
118: for (uint256 i = 0; i < tokenAddresses.length; i++) {
353: for (uint256 i = 0; i < s_collateralTokens.length; i++) {

Support

FAQs

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