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

Use assembly to check for `address(0)`

Summary

Gas can be saved by using assembly to check for address(0)

Vulnerability Details

Saves around 60 gas per this link

103 if (s_priceFeeds[token] == address(0)) {

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

58 if (_to == address(0)) {

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DecentralizedStableCoin.sol#L58

Impact

Gas savings can be achieved

Tools Used

Manual review

Recommendations

Use assembly for these checks to save gas

Support

FAQs

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