Cyfrin / 2023-07-foundry-defi-stablecoin

37 stars 32 forks source link

Unnecessary public visibility in `getTimeout()` #1124

Open codehawks-bot opened 1 year ago

codehawks-bot commented 1 year ago

Unnecessary public visibility in getTimeout()

Severity

Gas Optimization / Informational

Relevant GitHub Links

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

Summary

The getTimeout() function in the OracleLib contract is currently marked as public, although it could be marked as external to optimize gas usage.

Tools Used

Manual review

Recommendations

Consider changing the visibility of the getTimeout() function to external to save gas when the function is called from outside the contract:

function getTimeout(AggregatorV3Interface /* chainlinkFeed */ ) external pure returns (uint256) { 
    return TIMEOUT;
}