Beginner noob question - is this a valid implementation of safemath?

hello guys, I'm just playing with BEP20 tokens and found the code on github. I want my code to be secure but the original code is using uint (and not uint256) so I'm not sure if my edit is valid: I have added 3 lines to use safemath:

pragma solidity ^0.8.2;
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol';

contract Token {
    using SafeMath for uint256;
    using SafeMath for uint;
    mapping(address => uint) public balances;
    mapping(address => mapping(address => uint)) public allowance;
    uint public totalSupply = 123 * 10 ** 18;
    string public name = "My Token";
    string public symbol = "TKN";
    uint public decimals = 18;
    
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
    
    constructor() {
        balances[msg.sender] = totalSupply;
    }
    
    function balanceOf(address owner) public returns(uint) {
        return balances[owner];
    }
    
    function transfer(address to, uint value) public returns(bool) {
        require(balanceOf(msg.sender) >= value, 'balance too low');
        balances[to] += value;
        balances[msg.sender] -= value;
       emit Transfer(msg.sender, to, value);
        return true;
    }
    
    function transferFrom(address from, address to, uint value) public returns(bool) {
        require(balanceOf(from) >= value, 'balance too low');
        require(allowance[from][msg.sender] >= value, 'allowance too low');
        balances[to] += value;
        balances[from] -= value;
        emit Transfer(from, to, value);
        return true;   
    }
    
    function approve(address spender, uint value) public returns (bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;   
    }
}

my added lines:
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol';
using SafeMath for uint256;
using SafeMath for uint;

so just import safemath, and then use safemath for uint256 BUT ALSO use safemath for uint - is this like a valid implementation and is the token code now safe? it was without safemath and I didn't like it...

Hi, welcome! :wave:

I think uint is alias to uint256, but I when I use it, i prefer to make it more clear, I always use uint256.

And after 0.8.x version of the Solidity, it has checked arithmetic, that means it will revert on overflows, underflows etc. Yeah, you can still use this library contract.

SafeMath is no longer necessary on Solidity 0.8.