remove staking RevertReasons from TS types, ExchangeAlreadyRegisteredError -> ExchangeAddressAlreadyRegisteredError

This commit is contained in:
Michael Zhu
2019-08-26 11:21:16 -07:00
parent 0d5e037081
commit 2c15b3f9bd
8 changed files with 95 additions and 141 deletions

View File

@@ -8,11 +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;
}
@@ -52,11 +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);
}