Merge pull request #2103 from 0xProject/feature/contracts-staking/rich-reverts
Staking RichErrors and cleanup
This commit is contained in:
@@ -77,8 +77,8 @@ blockchainTests('Exchange core internal functions', env => {
|
||||
makerAssetAmount: constants.MAX_UINT256_ROOT,
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(50, 18),
|
||||
});
|
||||
const expectedError = new SafeMathRevertErrors.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256AdditionOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256AdditionOverflow,
|
||||
const expectedError = new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow,
|
||||
matchedFillResults.left.takerFeePaid,
|
||||
matchedFillResults.right.takerFeePaid,
|
||||
);
|
||||
|
@@ -443,8 +443,8 @@ blockchainTests('Isolated fillOrder() tests', env => {
|
||||
takerAssetAmount: MAX_UINT256_ROOT,
|
||||
});
|
||||
const takerAssetFillAmount = MAX_UINT256_ROOT;
|
||||
const expectedError = new SafeMathRevertErrors.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
const expectedError = new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow,
|
||||
takerAssetFillAmount,
|
||||
order.takerFee,
|
||||
);
|
||||
|
@@ -39,8 +39,8 @@ describe('Reference functions', () => {
|
||||
takerAssetAmount: MAX_UINT256_ROOT,
|
||||
});
|
||||
const takerAssetFilledAmount = MAX_UINT256_ROOT;
|
||||
const expectedError = new SafeMathRevertErrors.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
const expectedError = new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.MultiplicationOverflow,
|
||||
takerAssetFilledAmount,
|
||||
order.takerFee,
|
||||
);
|
||||
|
@@ -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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256AdditionOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256MultiplicationOverflow,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256DivisionByZero,
|
||||
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.SafeMathError(
|
||||
SafeMathRevertErrors.SafeMathErrorCodes.Uint256AdditionOverflow,
|
||||
const expectedError = new SafeMathRevertErrors.Uint256BinOpError(
|
||||
SafeMathRevertErrors.BinOpErrorCodes.AdditionOverflow,
|
||||
orders[0].makerAssetAmount,
|
||||
orders[1].makerAssetAmount,
|
||||
);
|
||||
|
Reference in New Issue
Block a user