diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 47a323f24a..64783ba085 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -1748,8 +1748,8 @@ describe('ERC1155Proxy', () => { nftNotOwnerBalance, ]; await erc1155Wrapper.assertBalancesAsync(tokenHolders, tokensToTransfer, expectedInitialBalances); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, maxUintValue, valueMultiplier, ); @@ -1836,8 +1836,8 @@ describe('ERC1155Proxy', () => { // check balances before transfer const expectedInitialBalances = [spenderInitialFungibleBalance, receiverInitialFungibleBalance]; await erc1155Wrapper.assertBalancesAsync(tokenHolders, tokensToTransfer, expectedInitialBalances); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, spenderInitialFungibleBalance, valuesToTransfer[0].times(valueMultiplier), ); diff --git a/contracts/erc1155/test/erc1155_token.ts b/contracts/erc1155/test/erc1155_token.ts index eb079d646e..ef3b2def3e 100644 --- a/contracts/erc1155/test/erc1155_token.ts +++ b/contracts/erc1155/test/erc1155_token.ts @@ -173,8 +173,8 @@ describe('ERC1155Token', () => { const tokenToTransfer = fungibleToken; const valueToTransfer = spenderInitialFungibleBalance.plus(1); // create the expected error (a uint256 underflow) - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, spenderInitialFungibleBalance, valueToTransfer, ); @@ -349,8 +349,8 @@ describe('ERC1155Token', () => { const tokensToTransfer = [fungibleToken]; const valuesToTransfer = [spenderInitialFungibleBalance.plus(1)]; // create the expected error (a uint256 underflow) - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, spenderInitialFungibleBalance, valuesToTransfer[0], ); diff --git a/contracts/exchange-libs/test/lib_fill_results.ts b/contracts/exchange-libs/test/lib_fill_results.ts index ef77bb15cc..8bf9bc8dd2 100644 --- a/contracts/exchange-libs/test/lib_fill_results.ts +++ b/contracts/exchange-libs/test/lib_fill_results.ts @@ -139,8 +139,8 @@ blockchainTests('LibFillResults', env => { takerAssetAmount: MAX_UINT256_ROOT, }); const takerAssetFilledAmount = MAX_UINT256_ROOT; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFilledAmount, order.makerAssetAmount, ); @@ -162,8 +162,8 @@ blockchainTests('LibFillResults', env => { order.takerAssetAmount, order.makerAssetAmount, ); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, makerAssetFilledAmount, order.makerFee, ); @@ -180,8 +180,8 @@ blockchainTests('LibFillResults', env => { takerFee: MAX_UINT256_ROOT.times(11), }); const takerAssetFilledAmount = MAX_UINT256_ROOT.dividedToIntegerBy(10); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFilledAmount, order.takerFee, ); @@ -303,8 +303,8 @@ blockchainTests('LibFillResults', env => { it('reverts if computing `makerAssetFilledAmount` overflows', async () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.makerAssetFilledAmount = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.makerAssetFilledAmount, b.makerAssetFilledAmount, ); @@ -314,8 +314,8 @@ blockchainTests('LibFillResults', env => { it('reverts if computing `takerAssetFilledAmount` overflows', async () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.takerAssetFilledAmount = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.takerAssetFilledAmount, b.takerAssetFilledAmount, ); @@ -325,8 +325,8 @@ blockchainTests('LibFillResults', env => { it('reverts if computing `makerFeePaid` overflows', async () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.makerFeePaid = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.makerFeePaid, b.makerFeePaid, ); @@ -336,8 +336,8 @@ blockchainTests('LibFillResults', env => { it('reverts if computing `takerFeePaid` overflows', async () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.takerFeePaid = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.takerFeePaid, b.takerFeePaid, ); diff --git a/contracts/exchange-libs/test/lib_math.ts b/contracts/exchange-libs/test/lib_math.ts index 4c3b4f3464..5e9b89023e 100644 --- a/contracts/exchange-libs/test/lib_math.ts +++ b/contracts/exchange-libs/test/lib_math.ts @@ -71,8 +71,8 @@ blockchainTests('LibMath', env => { const numerator = ONE_ETHER; const denominator = ZERO_AMOUNT; const target = ONE_ETHER.times(0.01); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, numerator.times(target), denominator, ); @@ -85,8 +85,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -131,8 +131,8 @@ blockchainTests('LibMath', env => { const denominator = ZERO_AMOUNT; const target = ONE_ETHER.times(0.01); // This will actually manifest as a subtraction underflow. - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, denominator, new BigNumber(1), ); @@ -145,8 +145,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -210,8 +210,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -275,8 +275,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -341,8 +341,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -407,8 +407,8 @@ blockchainTests('LibMath', env => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); diff --git a/contracts/exchange-libs/test/reference_functions.ts b/contracts/exchange-libs/test/reference_functions.ts index 8ca1ed2786..dddebf9587 100644 --- a/contracts/exchange-libs/test/reference_functions.ts +++ b/contracts/exchange-libs/test/reference_functions.ts @@ -35,8 +35,8 @@ describe('Reference Functions', () => { it('reverts if computing `makerAssetFilledAmount` overflows', () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.makerAssetFilledAmount = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.makerAssetFilledAmount, b.makerAssetFilledAmount, ); @@ -46,8 +46,8 @@ describe('Reference Functions', () => { it('reverts if computing `takerAssetFilledAmount` overflows', () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.takerAssetFilledAmount = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.takerAssetFilledAmount, b.takerAssetFilledAmount, ); @@ -57,8 +57,8 @@ describe('Reference Functions', () => { it('reverts if computing `makerFeePaid` overflows', () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.makerFeePaid = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.makerFeePaid, b.makerFeePaid, ); @@ -68,8 +68,8 @@ describe('Reference Functions', () => { it('reverts if computing `takerFeePaid` overflows', () => { const [a, b] = _.cloneDeep(DEFAULT_FILL_RESULTS); b.takerFeePaid = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a.takerFeePaid, b.takerFeePaid, ); @@ -85,8 +85,8 @@ describe('Reference Functions', () => { const numerator = ONE_ETHER; const denominator = ZERO_AMOUNT; const target = ONE_ETHER.times(0.01); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, numerator.times(target), denominator, ); @@ -99,8 +99,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -118,8 +118,8 @@ describe('Reference Functions', () => { const denominator = ZERO_AMOUNT; const target = ONE_ETHER.times(0.01); // This will actually manifest as a subtraction underflow. - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, denominator, new BigNumber(1), ); @@ -132,8 +132,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -170,8 +170,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -208,8 +208,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -254,8 +254,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); @@ -300,8 +300,8 @@ describe('Reference Functions', () => { const numerator = MAX_UINT256; const denominator = ONE_ETHER.dividedToIntegerBy(2); const target = MAX_UINT256_ROOT.times(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, numerator, target, ); diff --git a/contracts/exchange/test/internal.ts b/contracts/exchange/test/internal.ts index fbc58b48ce..619a5bef34 100644 --- a/contracts/exchange/test/internal.ts +++ b/contracts/exchange/test/internal.ts @@ -77,8 +77,8 @@ blockchainTests('Exchange core internal functions', env => { makerAssetAmount: constants.MAX_UINT256_ROOT, takerAssetAmount: Web3Wrapper.toBaseUnitAmount(50, 18), }); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, leftOrder.makerAssetAmount, rightOrder.makerAssetAmount, ); @@ -94,8 +94,8 @@ blockchainTests('Exchange core internal functions', env => { makerAssetAmount: Web3Wrapper.toBaseUnitAmount(50, 18), takerAssetAmount: constants.MAX_UINT256_ROOT, }); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, leftOrder.takerAssetAmount, rightOrder.takerAssetAmount, ); @@ -228,8 +228,8 @@ blockchainTests('Exchange core internal functions', env => { makerFeePaid: constants.ZERO_AMOUNT, takerFeePaid: constants.ZERO_AMOUNT, }; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, orderTakerAssetFilledAmount, takerAssetFillAmount, ); @@ -357,8 +357,8 @@ blockchainTests('Exchange core internal functions', env => { rightOrder.takerFeeAssetData = leftOrder.takerFeeAssetData; // The expected error that should be thrown by the function. - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, matchedFillResults.left.takerFeePaid, matchedFillResults.right.takerFeePaid, ); diff --git a/contracts/exchange/test/isolated_fill_order.ts b/contracts/exchange/test/isolated_fill_order.ts index 42cc0bec1d..d9e8ddb4e8 100644 --- a/contracts/exchange/test/isolated_fill_order.ts +++ b/contracts/exchange/test/isolated_fill_order.ts @@ -443,8 +443,8 @@ blockchainTests('Isolated fillOrder() tests', env => { takerAssetAmount: MAX_UINT256_ROOT, }); const takerAssetFillAmount = MAX_UINT256_ROOT; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFillAmount, order.makerAssetAmount, ); @@ -464,8 +464,8 @@ blockchainTests('Isolated fillOrder() tests', env => { order.takerAssetAmount, order.makerAssetAmount, ); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, makerAssetFilledAmount, order.makerFee, ); @@ -480,8 +480,8 @@ blockchainTests('Isolated fillOrder() tests', env => { takerFee: MAX_UINT256_ROOT.times(11), }); const takerAssetFillAmount = MAX_UINT256_ROOT.dividedToIntegerBy(10); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFillAmount, order.takerFee, ); diff --git a/contracts/exchange/test/reference_functions.ts b/contracts/exchange/test/reference_functions.ts index bb7e4f7572..b2cc773270 100644 --- a/contracts/exchange/test/reference_functions.ts +++ b/contracts/exchange/test/reference_functions.ts @@ -39,8 +39,8 @@ describe('Reference functions', () => { takerAssetAmount: MAX_UINT256_ROOT, }); const takerAssetFilledAmount = MAX_UINT256_ROOT; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFilledAmount, order.makerAssetAmount, ); @@ -60,8 +60,8 @@ describe('Reference functions', () => { order.takerAssetAmount, order.makerAssetAmount, ); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, makerAssetFilledAmount, order.makerFee, ); @@ -76,8 +76,8 @@ describe('Reference functions', () => { takerFee: MAX_UINT256_ROOT.times(11), }); const takerAssetFilledAmount = MAX_UINT256_ROOT.dividedToIntegerBy(10); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, takerAssetFilledAmount, order.takerFee, ); diff --git a/contracts/exchange/test/wrapper_unit_tests.ts b/contracts/exchange/test/wrapper_unit_tests.ts index f349d11747..d317942091 100644 --- a/contracts/exchange/test/wrapper_unit_tests.ts +++ b/contracts/exchange/test/wrapper_unit_tests.ts @@ -718,8 +718,8 @@ blockchainTests('Exchange wrapper functions unit tests.', env => { const signatures = _.times(COUNT, i => createOrderSignature(orders[i])); orders[1].takerAssetAmount = MAX_UINT256; const takerAssetFillAmount = MAX_UINT256; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, orders[0].takerAssetAmount, orders[1].takerAssetAmount, ); @@ -1031,8 +1031,8 @@ blockchainTests('Exchange wrapper functions unit tests.', env => { const orders = [randomOrder({ takerAssetAmount: MAX_UINT256 })]; const signatures = _.times(orders.length, i => createOrderSignature(orders[i])); const makerAssetFillAmount = new BigNumber(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, orders[0].takerAssetAmount, makerAssetFillAmount, ); @@ -1044,8 +1044,8 @@ blockchainTests('Exchange wrapper functions unit tests.', env => { const orders = [randomOrder({ makerAssetAmount: constants.ZERO_AMOUNT })]; const signatures = _.times(orders.length, i => createOrderSignature(orders[i])); const makerAssetFillAmount = ONE_ETHER; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, orders[0].takerAssetAmount.times(makerAssetFillAmount), orders[0].makerAssetAmount, ); @@ -1066,8 +1066,8 @@ blockchainTests('Exchange wrapper functions unit tests.', env => { ]; const signatures = _.times(orders.length, i => createOrderSignature(orders[i])); const makerAssetFillAmount = new BigNumber(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, orders[0].makerAssetAmount, orders[1].makerAssetAmount, ); diff --git a/contracts/staking/contracts/src/libs/LibSafeMath.sol b/contracts/staking/contracts/src/libs/LibSafeMath.sol index fd9a149f8d..45b8dabc47 100644 --- a/contracts/staking/contracts/src/libs/LibSafeMath.sol +++ b/contracts/staking/contracts/src/libs/LibSafeMath.sol @@ -32,8 +32,8 @@ library LibSafeMath { function _add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; if (c < a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.ADDITION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); @@ -46,8 +46,8 @@ library LibSafeMath { /// Note that this reverts on underflow. function _sub(uint256 a, uint256 b) internal pure returns (uint256) { if (b > a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.SUBTRACTION_UNDERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); @@ -69,8 +69,8 @@ library LibSafeMath { uint256 c = a * b; if (c / a != b) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.MULTIPLICATION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); @@ -83,8 +83,8 @@ library LibSafeMath { /// Note that this reverts on division by zero. The result is rounded towards zero. function _div(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.DIVISION_BY_ZERO, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); diff --git a/contracts/staking/contracts/src/libs/LibSafeMath64.sol b/contracts/staking/contracts/src/libs/LibSafeMath64.sol index d4bca227c9..8d84275cd9 100644 --- a/contracts/staking/contracts/src/libs/LibSafeMath64.sol +++ b/contracts/staking/contracts/src/libs/LibSafeMath64.sol @@ -29,8 +29,8 @@ library LibSafeMath64 { function _add(uint64 a, uint64 b) internal pure returns (uint64) { uint64 c = a + b; if (c < a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinopError( - LibSafeMathRichErrors.BinopErrorCodes.ADDITION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); @@ -43,8 +43,8 @@ library LibSafeMath64 { /// Note that this reverts on underflow. function _sub(uint64 a, uint64 b) internal pure returns (uint64) { if (b > a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinopError( - LibSafeMathRichErrors.BinopErrorCodes.SUBTRACTION_UNDERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); @@ -66,8 +66,8 @@ library LibSafeMath64 { uint64 c = a * b; if (c / a != b) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinopError( - LibSafeMathRichErrors.BinopErrorCodes.MULTIPLICATION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); @@ -80,8 +80,8 @@ library LibSafeMath64 { /// Note that this reverts on division by zero. The result is rounded towards zero. function _div(uint64 a, uint64 b) internal pure returns (uint64) { if (b == 0) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinopError( - LibSafeMathRichErrors.BinopErrorCodes.DIVISION_BY_ZERO, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint64BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); diff --git a/contracts/staking/contracts/src/libs/LibSafeMath96.sol b/contracts/staking/contracts/src/libs/LibSafeMath96.sol index 3e1041882b..c54316dea6 100644 --- a/contracts/staking/contracts/src/libs/LibSafeMath96.sol +++ b/contracts/staking/contracts/src/libs/LibSafeMath96.sol @@ -29,8 +29,8 @@ library LibSafeMath96 { function _add(uint96 a, uint96 b) internal pure returns (uint96) { uint96 c = a + b; if (c < a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinopError( - LibSafeMathRichErrors.BinopErrorCodes.ADDITION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); @@ -43,8 +43,8 @@ library LibSafeMath96 { /// Note that this reverts on underflow. function _sub(uint96 a, uint96 b) internal pure returns (uint96) { if (b > a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinopError( - LibSafeMathRichErrors.BinopErrorCodes.SUBTRACTION_UNDERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); @@ -66,8 +66,8 @@ library LibSafeMath96 { uint96 c = a * b; if (c / a != b) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinopError( - LibSafeMathRichErrors.BinopErrorCodes.MULTIPLICATION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); @@ -80,8 +80,8 @@ library LibSafeMath96 { /// Note that this reverts on division by zero. The result is rounded towards zero. function _div(uint96 a, uint96 b) internal pure returns (uint96) { if (b == 0) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinopError( - LibSafeMathRichErrors.BinopErrorCodes.DIVISION_BY_ZERO, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint96BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); diff --git a/contracts/utils/contracts/src/LibSafeMath.sol b/contracts/utils/contracts/src/LibSafeMath.sol index 5a411cf3cf..407e02eb45 100644 --- a/contracts/utils/contracts/src/LibSafeMath.sol +++ b/contracts/utils/contracts/src/LibSafeMath.sol @@ -16,8 +16,8 @@ library LibSafeMath { } uint256 c = a * b; if (c / a != b) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.MULTIPLICATION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); @@ -31,8 +31,8 @@ library LibSafeMath { returns (uint256) { if (b == 0) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.DIVISION_BY_ZERO, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); @@ -47,8 +47,8 @@ library LibSafeMath { returns (uint256) { if (b > a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.SUBTRACTION_UNDERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); @@ -63,8 +63,8 @@ library LibSafeMath { { uint256 c = a + b; if (c < a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.ADDITION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); diff --git a/contracts/utils/contracts/src/LibSafeMathRichErrors.sol b/contracts/utils/contracts/src/LibSafeMathRichErrors.sol index ca01c57d70..618cae0dcc 100644 --- a/contracts/utils/contracts/src/LibSafeMathRichErrors.sol +++ b/contracts/utils/contracts/src/LibSafeMathRichErrors.sol @@ -3,23 +3,23 @@ pragma solidity ^0.5.9; library LibSafeMathRichErrors { - // bytes4(keccak256("Uint256BinopError(uint8,uint256,uint256)")) + // bytes4(keccak256("Uint256BinOpError(uint8,uint256,uint256)")) bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR = - 0x8d8e1919; + 0xe946c1bb; - // bytes4(keccak256("Uint96BinopError(uint8,uint96,uint96)")) + // bytes4(keccak256("Uint96BinOpError(uint8,uint96,uint96)")) bytes4 internal constant UINT96_BINOP_ERROR_SELECTOR = - 0x224cf712; + 0xe486a353; - // bytes4(keccak256("Uint64BinopError(uint8,uint64,uint64)")) + // bytes4(keccak256("Uint64BinOpError(uint8,uint64,uint64)")) bytes4 internal constant UINT64_BINOP_ERROR_SELECTOR = - 0x4e79032d; + 0x67e71b32; // bytes4(keccak256("Uint256DowncastError(uint8,uint256)")) bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR = 0xc996af7b; - enum BinopErrorCodes { + enum BinOpErrorCodes { ADDITION_OVERFLOW, MULTIPLICATION_OVERFLOW, SUBTRACTION_UNDERFLOW, @@ -32,8 +32,8 @@ library LibSafeMathRichErrors { } // solhint-disable func-name-mixedcase - function Uint256BinopError( - BinopErrorCodes errorCode, + function Uint256BinOpError( + BinOpErrorCodes errorCode, uint256 a, uint256 b ) @@ -49,8 +49,8 @@ library LibSafeMathRichErrors { ); } - function Uint96BinopError( - BinopErrorCodes errorCode, + function Uint96BinOpError( + BinOpErrorCodes errorCode, uint96 a, uint96 b ) @@ -66,8 +66,8 @@ library LibSafeMathRichErrors { ); } - function Uint64BinopError( - BinopErrorCodes errorCode, + function Uint64BinOpError( + BinOpErrorCodes errorCode, uint64 a, uint64 b ) diff --git a/contracts/utils/contracts/src/SafeMath.sol b/contracts/utils/contracts/src/SafeMath.sol index d565a3d12f..bf0e95145a 100644 --- a/contracts/utils/contracts/src/SafeMath.sol +++ b/contracts/utils/contracts/src/SafeMath.sol @@ -16,8 +16,8 @@ contract SafeMath { } uint256 c = a * b; if (c / a != b) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.MULTIPLICATION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); @@ -31,8 +31,8 @@ contract SafeMath { returns (uint256) { if (b == 0) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.DIVISION_BY_ZERO, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); @@ -47,8 +47,8 @@ contract SafeMath { returns (uint256) { if (b > a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.SUBTRACTION_UNDERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); @@ -63,8 +63,8 @@ contract SafeMath { { uint256 c = a + b; if (c < a) { - LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinopError( - LibSafeMathRichErrors.BinopErrorCodes.ADDITION_OVERFLOW, + LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( + LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); diff --git a/contracts/utils/src/reference_functions.ts b/contracts/utils/src/reference_functions.ts index 140bf0a89f..cd67f4a089 100644 --- a/contracts/utils/src/reference_functions.ts +++ b/contracts/utils/src/reference_functions.ts @@ -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); } diff --git a/contracts/utils/test/reference_functions.ts b/contracts/utils/test/reference_functions.ts index 237abc8888..f604633e2b 100644 --- a/contracts/utils/test/reference_functions.ts +++ b/contracts/utils/test/reference_functions.ts @@ -21,8 +21,8 @@ describe('Reference Functions', () => { it('reverts on overflow', () => { const a = MAX_UINT256.dividedToIntegerBy(2); const b = MAX_UINT256.dividedToIntegerBy(2).plus(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a, b, ); @@ -41,8 +41,8 @@ describe('Reference Functions', () => { it('reverts on underflow', () => { const a = MAX_UINT256.dividedToIntegerBy(2); const b = MAX_UINT256.dividedToIntegerBy(2).plus(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, a, b, ); @@ -61,8 +61,8 @@ describe('Reference Functions', () => { it('reverts on overflow', () => { const a = MAX_UINT256.dividedToIntegerBy(2); const b = MAX_UINT256.dividedToIntegerBy(2).plus(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, a, b, ); @@ -81,8 +81,8 @@ describe('Reference Functions', () => { it('reverts if denominator is zero', () => { const a = MAX_UINT256.dividedToIntegerBy(2); const b = ZERO_AMOUNT; - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, a, b, ); diff --git a/contracts/utils/test/safe_math.ts b/contracts/utils/test/safe_math.ts index 7ea422ee67..15590b29ff 100644 --- a/contracts/utils/test/safe_math.ts +++ b/contracts/utils/test/safe_math.ts @@ -45,8 +45,8 @@ blockchainTests('SafeMath', env => { it('should revert if the multiplication overflows', async () => { const a = toBigNumber('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); // The largest uint256 number const b = toBigNumber(2); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.MultiplicationOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow, a, b, ); @@ -91,8 +91,8 @@ blockchainTests('SafeMath', env => { it('should revert if second argument is zero', async () => { const a = toBigNumber(1); const b = toBigNumber(0); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.DivisionByZero, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.DivisionByZero, a, b, ); @@ -112,8 +112,8 @@ blockchainTests('SafeMath', env => { it('should revert if the subtraction underflows', async () => { const a = toBigNumber(0); const b = toBigNumber(1); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.SubtractionUnderflow, a, b, ); @@ -143,8 +143,8 @@ blockchainTests('SafeMath', env => { it('should revert if the addition overflows', async () => { const a = toBigNumber('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); // The largest uint256 number const b = toBigNumber(1); - const expectedError = new SafeMathRevertErrors.Uint256BinopError( - SafeMathRevertErrors.BinopErrorCodes.AdditionOverflow, + const expectedError = new SafeMathRevertErrors.Uint256BinOpError( + SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow, a, b, ); diff --git a/packages/utils/src/safe_math_revert_errors.ts b/packages/utils/src/safe_math_revert_errors.ts index 3ddd411911..874e9bdaf5 100644 --- a/packages/utils/src/safe_math_revert_errors.ts +++ b/packages/utils/src/safe_math_revert_errors.ts @@ -3,7 +3,7 @@ import { RevertError } from './revert_error'; // tslint:disable:max-classes-per-file -export enum BinopErrorCodes { +export enum BinOpErrorCodes { AdditionOverflow, MultiplicationOverflow, SubtractionUnderflow, @@ -15,9 +15,9 @@ export enum DowncastErrorCodes { ValueTooLargeToDowncastToUint96, } -export class Uint256BinopError extends RevertError { - constructor(error?: BinopErrorCodes, a?: BigNumber, b?: BigNumber) { - super('Uint256BinopError', 'Uint256BinopError(uint8 error, uint256 a, uint256 b)', { +export class Uint256BinOpError extends RevertError { + constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) { + super('Uint256BinOpError', 'Uint256BinOpError(uint8 error, uint256 a, uint256 b)', { error, a, b, @@ -25,9 +25,9 @@ export class Uint256BinopError extends RevertError { } } -export class Uint96BinopError extends RevertError { - constructor(error?: BinopErrorCodes, a?: BigNumber, b?: BigNumber) { - super('Uint96BinopError', 'Uint96BinopError(uint8 error, uint96 a, uint96 b)', { +export class Uint96BinOpError extends RevertError { + constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) { + super('Uint96BinOpError', 'Uint96BinOpError(uint8 error, uint96 a, uint96 b)', { error, a, b, @@ -35,9 +35,9 @@ export class Uint96BinopError extends RevertError { } } -export class Uint64BinopError extends RevertError { - constructor(error?: BinopErrorCodes, a?: BigNumber, b?: BigNumber) { - super('Uint64BinopError', 'Uint64BinopError(uint8 error, uint64 a, uint64 b)', { +export class Uint64BinOpError extends RevertError { + constructor(error?: BinOpErrorCodes, a?: BigNumber, b?: BigNumber) { + super('Uint64BinOpError', 'Uint64BinOpError(uint8 error, uint64 a, uint64 b)', { error, a, b, @@ -54,7 +54,7 @@ export class Uint256DowncastError extends RevertError { } } -const types = [Uint256BinopError, Uint96BinopError, Uint64BinopError, Uint256DowncastError]; +const types = [Uint256BinOpError, Uint96BinOpError, Uint64BinOpError, Uint256DowncastError]; // Register the types we've defined. for (const type of types) {