Since s_collateralTokens has the same length as tokenAddresses from the constructor and cannot be modified, the second for-loop will run for exactly the same number of iterations as the one in the constructor. The first for-loop would have been revert in the constructor if i ever became greater than or equal to tokenAddresses.length. Therefore, the second for-loop can safely use unchecked { i++; } to increment i. This saves 30-40 gas per loop
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L353C1-L357C10
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.