What will be result for
a.sub(b);
if
a = 1;
b= -1;
using openzeppeline safemath?
What will be result for
a.sub(b);
if
a = 1;
b= -1;
using openzeppeline safemath?
Hi @JackBekket,
Welcome to the community
SafeMath operates on uint256. See the OpenZeppelin documentation for details: https://docs.openzeppelin.com/contracts/3.x/api/math#SafeMath-sub-uint256-uint256-
The following will not compile on Remix:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/math/SafeMath.sol";
contract MyContract {
using SafeMath for uint256;
function calculate() public pure returns (uint256) {
uint256 a = 1;
return a.sub(-1);
}
}