gas

Use `assembly` to check for `address(0)`

Reward

Total

11.01 USDC

1.17 USDC
1.17 USDC
1.17 USDC
1.17 USDC
Selected
1.64 USDC
1.17 USDC
1.17 USDC
1.17 USDC
1.17 USDC
Selected Submission

Use assembly to check for address(0)

Severity

Gas Optimization / Informational

Relevant GitHub Links

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

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

Summary

Using assembly to check for address(0) is gas-efficient. There are 2 instances of this issue:

File: src/DecentralizedStableCoin.sol

58:  if (_to == address(0)) {
File: src/DSCEngine.sol

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