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

[G-01] Unchecking arithmetics operations that can’t underflow/overflow

Summary

Solidity version 0.8+ comes with implicit overflow and underflow checks on unsigned integers. When an overflow or an underflow isn’t possible (as an example, when a comparison is made before the arithmetic operation), some gas can be saved by using an unchecked block: https://docs.soliditylang.org/en/v0.8.10/control-structures.html#checked-or-unchecked-arithmetic

25 gas saved per instance

Instances:

uint256 totalCollateralToRedeem = tokenAmountFromDebtCovered + bonusCollateral;
for (uint256 i = 0; i < tokenAddresses.length; i++) {
for (uint256 i = 0; i < s_collateralTokens.length; i++) {
uint256 secondsSince = block.timestamp - updatedAt;

Support

FAQs

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