Binop -> BinOp
This commit is contained in:
@@ -8,7 +8,7 @@ const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
||||
export function safeAdd(a: BigNumber, b: BigNumber): BigNumber {
|
||||
const r = a.plus(b);
|
||||
if (r.isGreaterThan(MAX_UINT256)) {
|
||||
throw new SafeMathRevertErrors.Uint256BinopError(SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, a, b);
|
||||
throw new SafeMathRevertErrors.Uint256BinOpError(SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a, b);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -19,8 +19,8 @@ export function safeAdd(a: BigNumber, b: BigNumber): BigNumber {
|
||||
export function safeSub(a: BigNumber, b: BigNumber): BigNumber {
|
||||
const r = a.minus(b);
|
||||
if (r.isLessThan(0)) {
|
||||
throw new SafeMathRevertErrors.Uint256BinopError(
|
||||
SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow,
|
||||
throw new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow,
|
||||
a,
|
||||
b,
|
||||
);
|
||||
@@ -34,8 +34,8 @@ export function safeSub(a: BigNumber, b: BigNumber): BigNumber {
|
||||
export function safeMul(a: BigNumber, b: BigNumber): BigNumber {
|
||||
const r = a.times(b);
|
||||
if (r.isGreaterThan(MAX_UINT256)) {
|
||||
throw new SafeMathRevertErrors.Uint256BinopError(
|
||||
SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow,
|
||||
throw new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow,
|
||||
a,
|
||||
b,
|
||||
);
|
||||
@@ -48,7 +48,7 @@ export function safeMul(a: BigNumber, b: BigNumber): BigNumber {
|
||||
*/
|
||||
export function safeDiv(a: BigNumber, b: BigNumber): BigNumber {
|
||||
if (b.isEqualTo(0)) {
|
||||
throw new SafeMathRevertErrors.Uint256BinopError(SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, a, b);
|
||||
throw new SafeMathRevertErrors.Uint256BinOpError(SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, a, b);
|
||||
}
|
||||
return a.dividedToIntegerBy(b);
|
||||
}
|
||||
|
Reference in New Issue
Block a user