gas

`burn()` and `staleCheckLatestRoundData()` and `getTimeout()` can be `external`

Reward

Total

19.63 USDC

4.46 USDC
Selected
6.25 USDC
4.46 USDC
4.46 USDC
Selected Submission

burn() and staleCheckLatestRoundData() and getTimeout() can be external

Severity

Gas Optimization

Relevant GitHub Links

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

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/libraries/OracleLib.sol#L21-L25

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/libraries/OracleLib.sol#L35-L38

Summary

burn() can be external to save gas.

Vulnerability Details

burn() in DecentralizedStableCoin.sol and staleCheckLatestRoundData() and getTimeout() in OracleLib.sol aren't called inside the contract and thus can be set to external.

Impact

Useless gas consumption.

Tools Used

Manual review

Recommendations

Set the functions to external to save gas.