"TypeError: Type is not callable" error in remix?

function calculateBNBReward(address ofAddress) public view returns (uint256) {
    uint256 totalSupply = uint256(totalFee)
    .sub(_gonBalances(address(0)))
    .sub(_gonBalances(0x000000000000000000000000000000000000dEaD)) // exclude burned wallet
    .sub(_gonBalances(address(pair)));
    // exclude liquidity wallet

    return Utils.calculateBNBReward(
        totalFee,
        _gonBalances(address(ofAddress)),
        address(this).balance,
        totalSupply,
        ofAddress
    );
}

I got this error in this function. It says Type is not callable

image

Hello @Lloyd_Ramos

By default, there is no .sub (or .add, .mul, .div) for uint256 in solidity.

If you are using a solidity version <0.8.0, you'll want to import "@openzeppelin/contracts/utils/math/SafeMath.sol" and do using SafeMath for uint256; in your contract.

If you are using solidity >= 0.8.0, safemath is included by the compiler, and you can just use the +, -, *, / operators

1 Like