hi everyone, it's been a while since I last used SafeMath.sol for one of my Smart Contracts. I was writing some code for a new contract of mine and I needed the SafeMath for my uint256. I could not find it in the "@openzeppelin/contracts/utils/math/SafeMath.sol". Was this library substituted by "@openzeppelin/contracts/utils/math/Math.sol"?
1 Like
So apparently after a little bit of extra research I found out that math checks are now on the language level after Solidity 0.8+. So It's safe to not use SafeMath from OpenZeppelin as fas as I found. can somebody confirm/deny this?
1 Like
Yes, from Solidity 0.8.0, all arithmetic is checked by default, and you can find that SafeMath
is still in the repository, athough it is now just a wrapper over the built-in overflow checks. so I think you can use Solidity 0.8.x to remove SafeMath
from your contracts, and OpenZeppelin may fully remove it from the repository in a future major release.
There is a discussion at https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2465.