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

Using unchecked blocks to save gas

Summary

[G-21] Using unchecked blocks to save gas

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.
see resource : https://github.com/ethereum/solidity/issues/10695

file: /src/libraries/OracleLib.sol
29 uint256 secondsSince = block.timestamp - updatedAt;

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/libraries/OracleLib.sol#L29

Support

FAQs

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