SafeMath in Solidity <0.8

Hi,

I'm working on a Solidity 0.6 project that has to stay 0.6 because of dependencies. Since it's <0.8, I realize I have to use SafeMath to ensure the project is secure. However, the only version of OZ's SafeMath that I can find is 0.8. How can I add the 0.6 version to my project?

Thanks in advance

Hey,

You can use the v3.4.0 release which supported solidity >=0.6.0 <0.8.0
The link for the contract: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/math/SafeMath.sol

The release:

You can use this to install the package:

npm install @openzeppelin/contracts@3.4.0
1 Like