15,000 USDC
View results
Submission Details
Severity: gas

Can make the variable outside the loop to save gas

Summary

[G-9] Can make the variable outside the loop to save gas

Consider making the stack variables before the loop which gonna save gas

file: /src/DSCEngine.sol
354 address token = s_collateralTokens[i];
355 uint256 amount = s_collateralDeposited[user][token];

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L354-L355

Support

FAQs

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