Cyfrin / 2023-07-foundry-defi-stablecoin

37 stars 32 forks source link

Usage of floating pragma statement #1121

Open codehawks-bot opened 1 year ago

codehawks-bot commented 1 year ago

Usage of floating pragma statement

Severity

Gas Optimization / Informational

Relevant GitHub Links

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

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

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

Summary

The contracts OracleLib, DecentralizedStableCoin, and DSCEngine are using a floating pragma statement pragma solidity ^0.8.18;. While this is not necessarily a vulnerability, it could potentially introduce backward compatibility issues if a new version of the Solidity compiler introduces breaking changes.

Vulnerability Details

This statement indicates that the contract can be compiled with any Solidity compiler version from 0.8.18 to versions below 0.9.0. While this provides flexibility in using different compiler versions, it could potentially introduce backward compatibility issues if a new version of the Solidity compiler introduces breaking changes.

Tools Used

Manual review

Recommendations

Consider using a fixed version pragma statement to avoid potential issues related to compiler changes.

pragma solidity 0.8.18;