Quick question re SafeMath. I have read that since solidity 0.8 was introduced we no longer need to use Safemath.sol. I just want to be 100% sure that this is definitely the case? I have built a basic custom ERC20. I did notice that some governance tokens have used a newer version of safeMath with contracts deployed using solidity 0.8
For reference here is my ERC20.
/**
*Submitted for verification at Etherscan.io on 2022-02-13
*/
// contracts/mytoken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/ownable.sol";
contract MyToken is ERC20, Ownable {
constructor() ERC20("myToken", "My") {
_mint(msg.sender, 100000000000 * 10 ** 18);
}
function burn(uint256 amount) external {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_burn(msg.sender, amount);
}
}