Merge pull request #2362 from 0xProject/fix/revert-errors-utils

Re-export the RevertErrors
This commit is contained in:
Jacob Evans 2019-11-27 12:27:37 +10:00 committed by GitHub
commit 6ac5bcc907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 117 additions and 131 deletions

View File

@ -7,7 +7,7 @@ export {
LibCoordinatorRichErrorsContract,
LibEIP712CoordinatorDomainContract,
} from './wrappers';
export import CoordinatorRevertErrors = require('./revert_errors');
export { CoordinatorRevertErrors } from '@0x/utils';
export { CoordinatorServerCancellationResponse } from './client/index';
export { ApprovalFactory } from './approval_factory';
export { SignedCoordinatorApproval } from './types';

View File

@ -12,9 +12,7 @@ import {
} from '@0x/contracts-test-utils';
import { LibBytesRevertErrors } from '@0x/contracts-utils';
import { SignatureType, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import CoordinatorRevertErrors = require('../src/revert_errors');
import { BigNumber, CoordinatorRevertErrors } from '@0x/utils';
import { ApprovalFactory } from '../src/approval_factory';

View File

@ -1,6 +1,6 @@
export { artifacts } from './artifacts';
export { ForwarderContract } from './wrappers';
export import ForwarderRevertErrors = require('./revert_errors');
export { ExchangeForwarderRevertErrors } from '@0x/utils';
export {
ContractArtifact,
ContractChains,

View File

@ -21,9 +21,7 @@ import {
randomAddress,
verifyEventsFromLogs,
} from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { ForwarderRevertErrors } from '../src';
import { BigNumber, ExchangeForwarderRevertErrors } from '@0x/utils';
import { artifacts } from './artifacts';
import { TestForwarderContract } from './wrappers';
@ -159,7 +157,7 @@ blockchainTests('Supported asset type unit tests', env => {
const tx = forwarder
.transferAssetToSender(erc721AssetData, invalidAmount)
.awaitTransactionSuccessAsync({ from: receiver });
const expectedError = new ForwarderRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
const expectedError = new ExchangeForwarderRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
return expect(tx).to.revertWith(expectedError);
});
it('transfers an ERC20 token given ERC20Bridge assetData', async () => {
@ -177,7 +175,9 @@ blockchainTests('Supported asset type unit tests', env => {
const tx = forwarder
.transferAssetToSender(randomBytes, TRANSFER_AMOUNT)
.awaitTransactionSuccessAsync({ from: receiver });
const expectedError = new ForwarderRevertErrors.UnsupportedAssetProxyError(hexSlice(randomBytes, 0, 4));
const expectedError = new ExchangeForwarderRevertErrors.UnsupportedAssetProxyError(
hexSlice(randomBytes, 0, 4),
);
return expect(tx).to.revertWith(expectedError);
});
});

View File

@ -8,7 +8,7 @@ export {
LibOrderContract,
LibZeroExTransactionContract,
} from './wrappers';
export import LibMathRevertErrors = require('./lib_math_revert_errors');
export { LibMathRevertErrors } from '@0x/utils';
import * as ReferenceFunctionsToExport from './reference_functions';
export import ReferenceFunctions = ReferenceFunctionsToExport;

View File

@ -1,8 +1,6 @@
import { ReferenceFunctions } from '@0x/contracts-utils';
import { FillResults, Order } from '@0x/types';
import { BigNumber } from '@0x/utils';
import LibMathRevertErrors = require('./lib_math_revert_errors');
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
const { safeAdd, safeSub, safeMul, safeDiv } = ReferenceFunctions;

View File

@ -9,11 +9,10 @@ import {
} from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { FillResults, MatchedFillResults, Order } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
import { addFillResults, calculateFillResults, getPartialAmountFloor } from '../src/reference_functions';
import { artifacts } from './artifacts';

View File

@ -7,9 +7,8 @@ import {
uint256Values,
} from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
import {
getPartialAmountCeil,
getPartialAmountFloor,

View File

@ -1,9 +1,8 @@
import { constants, describe, expect } from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, LibMathRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import LibMathRevertErrors = require('../src/lib_math_revert_errors');
import {
addFillResults,
getPartialAmountCeil,

View File

@ -15,7 +15,7 @@ export {
ExchangeProtocolFeeMultiplierEventArgs,
ExchangeTransactionExecutionEventArgs,
} from './wrappers';
export import ExchangeRevertErrors = require('./revert_errors');
export { ExchangeRevertErrors } from '@0x/utils';
export { exchangeDataEncoder } from './exchange_data_encoder';
export { SignedOrder } from '@0x/types';
export { ExchangeFunctionName } from '@0x/contracts-test-utils';

View File

@ -19,17 +19,14 @@ import {
import { OwnableRevertErrors } from '@0x/contracts-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { AssetProxyId, RevertReason } from '@0x/types';
import { BigNumber, StringRevertError } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import { TestAssetProxyDispatcherAssetProxyRegisteredEventArgs, TestAssetProxyDispatcherContract } from './wrappers';
import { dependencyArtifacts } from './utils/dependency_artifacts';
import { TestAssetProxyDispatcherAssetProxyRegisteredEventArgs, TestAssetProxyDispatcherContract } from './wrappers';
chaiSetup.configure();
const expect = chai.expect;

View File

@ -2,20 +2,17 @@ import { ReferenceFunctions as LibReferenceFunctions } from '@0x/contracts-excha
import { blockchainTests, constants, expect, hexRandom, orderHashUtils } from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { Order } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import {
TestExchangeInternalsContract,
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
TestExchangeInternalsFillEventArgs,
} from './wrappers';
blockchainTests('Exchange core internal functions', env => {
const CHAIN_ID = 1337;
const ONE_ETHER = constants.ONE_ETHER;

View File

@ -2,11 +2,9 @@ import { LibMathRevertErrors, ReferenceFunctions as LibReferenceFunctions } from
import { blockchainTests, constants, expect, hexRandom } from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { FillResults, OrderInfo, OrderStatus, SignatureType } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import {
AssetBalances,
createBadAssetData,

View File

@ -8,11 +8,9 @@ import {
randomAddress,
} from '@0x/contracts-test-utils';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors, RevertError } from '@0x/utils';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import { TestLibExchangeRichErrorDecoderContract } from './wrappers';

View File

@ -16,12 +16,10 @@ import {
transactionHashUtils,
} from '@0x/contracts-test-utils';
import { SignatureType, SignedOrder, SignedZeroExTransaction } from '@0x/types';
import { BigNumber, StringRevertError } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import {
ExchangeContract,

View File

@ -15,13 +15,12 @@ import {
transactionHashUtils,
} from '@0x/contracts-test-utils';
import { FillResults, OrderStatus } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils';
import { AbiEncoder, BigNumber, ExchangeRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { exchangeDataEncoder } from '../src/exchange_data_encoder';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts as localArtifacts } from './artifacts';
import { ExchangeWrapper } from './utils/exchange_wrapper';

View File

@ -7,12 +7,10 @@ import {
transactionHashUtils,
} from '@0x/contracts-test-utils';
import { EIP712DomainWithDefaultSchema, ZeroExTransaction } from '@0x/types';
import { BigNumber, StringRevertError } from '@0x/utils';
import { BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import { TestTransactionsContract, TestTransactionsTransactionExecutionEventArgs } from './wrappers';

View File

@ -8,14 +8,12 @@ import {
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { constants, expect, LogDecoder, orderHashUtils, orderUtils, signingUtils } from '@0x/contracts-test-utils';
import { FillResults, Order, SignatureType, SignedOrder } from '@0x/types';
import { BigNumber, errorUtils, providerUtils, RevertError, StringRevertError } from '@0x/utils';
import { BigNumber, errorUtils, ExchangeRevertErrors, providerUtils, RevertError, StringRevertError } from '@0x/utils';
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
import { LogWithDecodedArgs, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
import ExchangeRevertErrors = require('../../src/revert_errors');
import { artifacts } from '../artifacts';
import { ExchangeContract, ExchangeFillEventArgs } from '../wrappers';

View File

@ -11,13 +11,11 @@ import {
} from '@0x/contracts-test-utils';
import { ReferenceFunctions as UtilReferenceFunctions, SafeMathRevertErrors } from '@0x/contracts-utils';
import { FillResults, Order } from '@0x/types';
import { AnyRevertError, BigNumber, StringRevertError } from '@0x/utils';
import { AnyRevertError, BigNumber, ExchangeRevertErrors, StringRevertError } from '@0x/utils';
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
import * as ethjs from 'ethereumjs-util';
import * as _ from 'lodash';
import ExchangeRevertErrors = require('../src/revert_errors');
import { artifacts } from './artifacts';
import {
TestFillRoundingContract,

View File

@ -1,6 +1,6 @@
import { IAssetDataContract } from '@0x/contracts-asset-proxy';
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { ForwarderContract, ForwarderRevertErrors } from '@0x/contracts-exchange-forwarder';
import { ForwarderContract } from '@0x/contracts-exchange-forwarder';
import {
blockchainTests,
constants,
@ -10,7 +10,7 @@ import {
} from '@0x/contracts-test-utils';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { SignatureType, SignedOrder } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils';
import { AbiEncoder, BigNumber, ExchangeForwarderRevertErrors } from '@0x/utils';
import { deployEth2DaiBridgeAsync } from '../bridges/deploy_eth2dai_bridge';
import { deployUniswapBridgeAsync } from '../bridges/deploy_uniswap_bridge';
@ -251,7 +251,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
takerFee: toBaseUnitAmount(0.01),
takerFeeAssetData: makerFeeTokenAssetData,
};
const expectedError = new ForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
const expectedError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
await testFactory.marketSellTestAsync([order], 1.23, { revertError: expectedError });
});
});
@ -301,7 +301,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 });
});
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Eth2Dai)', async () => {
const expectedError = new ForwarderRevertErrors.CompleteBuyFailedError(
const expectedError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
eth2DaiBridgeOrder.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT,
);
@ -352,7 +352,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 });
});
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Uniswap)', async () => {
const expectedError = new ForwarderRevertErrors.CompleteBuyFailedError(
const expectedError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
uniswapBridgeOrder.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT,
);
@ -370,7 +370,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
takerFee: toBaseUnitAmount(0.01),
takerFeeAssetData: makerFeeTokenAssetData,
};
const expectedError = new ForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
const expectedError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
await testFactory.marketBuyTestAsync([order], 1.23, { revertError: expectedError });
});
});

View File

@ -1,7 +1,7 @@
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
import { artifacts, ForwarderContract, ForwarderRevertErrors } from '@0x/contracts-exchange-forwarder';
import { artifacts, ExchangeForwarderRevertErrors, ForwarderContract } from '@0x/contracts-exchange-forwarder';
import {
blockchainTests,
constants,
@ -127,7 +127,9 @@ blockchainTests('Forwarder integration tests', env => {
exchange.address,
deployment.tokens.weth.address,
);
await expect(deployForwarder).to.revertWith(new ForwarderRevertErrors.UnregisteredAssetProxyError());
await expect(deployForwarder).to.revertWith(
new ExchangeForwarderRevertErrors.UnregisteredAssetProxyError(),
);
});
});
blockchainTests.resets('marketSellOrdersWithEth without extra fees', () => {
@ -258,7 +260,7 @@ blockchainTests('Forwarder integration tests', env => {
takerFeeAssetData,
takerFee: toBaseUnitAmount(1),
});
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
await testFactory.marketSellTestAsync([order], 0.5, {
revertError,
});
@ -316,7 +318,7 @@ blockchainTests('Forwarder integration tests', env => {
it('should fail if the fee is set too high', async () => {
const order = await maker.signOrderAsync();
const forwarderFeePercentage = new BigNumber(6);
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, forwarderFeePercentage),
);
await testFactory.marketSellTestAsync([order], 0.5, {
@ -383,7 +385,7 @@ blockchainTests('Forwarder integration tests', env => {
});
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount', async () => {
const order = await maker.signOrderAsync();
const revertError = new ForwarderRevertErrors.CompleteBuyFailedError(
const revertError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
order.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT,
);
@ -421,7 +423,7 @@ blockchainTests('Forwarder integration tests', env => {
takerFeeAssetData,
takerFee: toBaseUnitAmount(1),
});
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
await testFactory.marketBuyTestAsync([order], 0.5, {
revertError,
});
@ -608,7 +610,7 @@ blockchainTests('Forwarder integration tests', env => {
});
it('should fail if the fee is set too high', async () => {
const order = await maker.signOrderAsync();
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, new BigNumber(6)),
);
await testFactory.marketBuyTestAsync([order], 0.5, {
@ -623,7 +625,7 @@ blockchainTests('Forwarder integration tests', env => {
order.takerAssetAmount.times(0.5).plus(DeploymentManager.protocolFee),
forwarderFeePercentage,
);
const revertError = new ForwarderRevertErrors.InsufficientEthForFeeError(ethFee, ethFee.minus(1));
const revertError = new ExchangeForwarderRevertErrors.InsufficientEthForFeeError(ethFee, ethFee.minus(1));
await testFactory.marketBuyTestAsync([order], 0.5, {
ethValueAdjustment: -1,
forwarderFeePercentage,

View File

@ -41,8 +41,7 @@ export {
IStakingEventsRewardsPaidEventArgs,
} from './wrappers';
export { artifacts } from './artifacts';
export import FixedMathRevertErrors = require('./fixed_math_revert_errors');
export import StakingRevertErrors = require('./staking_revert_errors');
export { StakingRevertErrors, FixedMathRevertErrors } from '@0x/utils';
export { constants } from './constants';
export {
StakeInfo,

View File

@ -1,9 +1,8 @@
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
import { BigNumber, StringRevertError } from '@0x/utils';
import { BigNumber, StakingRevertErrors, StringRevertError } from '@0x/utils';
import { constants as stakingConstants } from '../src/constants';
import StakingRevertErrors = require('../src/staking_revert_errors');
import { artifacts } from './artifacts';
import {

View File

@ -1,9 +1,9 @@
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import { constants as stakingConstants } from '../src/constants';
import StakingRevertErrors = require('../src/staking_revert_errors');
import { MakerActor } from './actors/maker_actor';
import { PoolOperatorActor } from './actors/pool_operator_actor';

View File

@ -1,9 +1,8 @@
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
import { blockchainTests, constants, describe, expect, shortZip } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import StakingRevertErrors = require('../src/staking_revert_errors');
import { DelegatorsByPoolId, OperatorByPoolId, StakeInfo, StakeStatus } from '../src/types';
import { FinalizerActor } from './actors/finalizer_actor';

View File

@ -1,9 +1,8 @@
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
import { blockchainTests, describe } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import StakingRevertErrors = require('../src/staking_revert_errors');
import { StakeInfo, StakeStatus } from '../src/types';
import { StakerActor } from './actors/staker_actor';

View File

@ -1,9 +1,8 @@
import { blockchainTests, expect } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
import { StakingRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { artifacts } from '../artifacts';
import {
TestExchangeManagerContract,

View File

@ -7,12 +7,11 @@ import {
Numberish,
shortZip,
} from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogEntry } from 'ethereum-types';
import * as _ from 'lodash';
import { constants as stakingConstants } from '../../src/constants';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { artifacts } from '../artifacts';
import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils';

View File

@ -1,9 +1,8 @@
import { blockchainTests, expect, hexRandom, Numberish } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, FixedMathRevertErrors } from '@0x/utils';
import { Decimal } from 'decimal.js';
import * as _ from 'lodash';
import FixedMathRevertErrors = require('../../src/fixed_math_revert_errors');
import { assertRoughlyEquals, fromFixed, toDecimal, toFixed } from '../utils/number_utils';
import { artifacts } from '../artifacts';

View File

@ -1,9 +1,8 @@
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import { constants as stakingConstants } from '../../src/constants';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { artifacts } from '../artifacts';
import {

View File

@ -7,12 +7,10 @@ import {
Numberish,
randomAddress,
} from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogEntry } from 'ethereum-types';
import * as _ from 'lodash';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { artifacts } from '../artifacts';
import {
IStakingEventsEvents,

View File

@ -9,10 +9,9 @@ import {
Numberish,
shortZip,
} from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { StakeStatus } from '../../src/types';
import { artifacts } from '../artifacts';

View File

@ -1,6 +1,6 @@
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors } from '@0x/contracts-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
@ -12,7 +12,6 @@ import {
} from '../wrappers';
import { constants as stakingConstants } from '../../src/constants';
import StakingRevertErrors = require('../../src/staking_revert_errors');
blockchainTests.resets('StakingProxy unit tests', env => {
const testString = 'Hello, World!';

View File

@ -8,13 +8,11 @@ import {
filterLogsToArguments,
provider,
} from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors, SafeMathRevertErrors } from '@0x/contracts-utils';
import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { AuthorizableRevertErrors, BigNumber, SafeMathRevertErrors, StakingRevertErrors } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { constants as stakingConstants } from '../../src/constants';
import StakingRevertErrors = require('../../src/staking_revert_errors');
import { artifacts } from '../artifacts';
import {

View File

@ -22,11 +22,10 @@ import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-
import { chaiSetup, constants, LogDecoder, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { AssetProxyId } from '@0x/types';
import { BigNumber, providerUtils, StringRevertError } from '@0x/utils';
import { BigNumber, providerUtils, StringRevertError, LibBytesRevertErrors } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts, LibAssetDataContract } from '@0x/contracts-dev-utils';
import { InvalidByteOperationError } from '@0x/contracts-utils/lib/src/lib_bytes_revert_errors';
chaiSetup.configure();
const expect = chai.expect;
@ -359,7 +358,7 @@ describe('LibAssetData', () => {
for (const data of assetData) {
const badData = data.substring(0, data.length - 2); // drop one byte but retain assetProxyId
await expect(libAssetData.revertIfInvalidAssetData(badData).callAsync()).to.eventually.be.rejectedWith(
InvalidByteOperationError,
LibBytesRevertErrors.InvalidByteOperationError,
);
}
});

View File

@ -4,9 +4,11 @@ export * from './wrappers';
import * as ReferenceFunctionsToExport from './reference_functions';
export import ReferenceFunctions = ReferenceFunctionsToExport;
export import AuthorizableRevertErrors = require('./authorizable_revert_errors');
export import LibAddressArrayRevertErrors = require('./lib_address_array_revert_errors');
export import LibBytesRevertErrors = require('./lib_bytes_revert_errors');
export import OwnableRevertErrors = require('./ownable_revert_errors');
export import ReentrancyGuardRevertErrors = require('./reentrancy_guard_revert_errors');
export import SafeMathRevertErrors = require('./safe_math_revert_errors');
export {
AuthorizableRevertErrors,
LibAddressArrayRevertErrors,
LibBytesRevertErrors,
OwnableRevertErrors,
ReentrancyGuardRevertErrors,
SafeMathRevertErrors,
} from '@0x/utils';

View File

@ -1,6 +1,4 @@
import { BigNumber } from '@0x/utils';
import SafeMathRevertErrors = require('./safe_math_revert_errors');
import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);

View File

@ -1,10 +1,7 @@
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { AuthorizableRevertErrors, BigNumber, OwnableRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import AuthorizableRevertErrors = require('../src/authorizable_revert_errors');
import OwnableRevertErrors = require('../src/ownable_revert_errors');
import { artifacts } from './artifacts';
import { TestAuthorizableContract } from './wrappers';

View File

@ -1,11 +1,9 @@
import { chaiSetup, provider, randomAddress, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, LibAddressArrayRevertErrors } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import LibAddressArrayRevertErrors = require('../src/lib_address_array_revert_errors');
import { artifacts } from './artifacts';
import { TestLibAddressArrayContract } from './wrappers';

View File

@ -1,11 +1,9 @@
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, LibBytesRevertErrors } from '@0x/utils';
import BN = require('bn.js');
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import LibBytesRevertErrors = require('../src/lib_bytes_revert_errors');
import { artifacts } from './artifacts';
import { TestLibBytesContract } from './wrappers';

View File

@ -1,9 +1,8 @@
import { blockchainTests, constants, describe, expect } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
import * as _ from 'lodash';
import * as ReferenceFunctions from '../src/reference_functions';
import SafeMathRevertErrors = require('../src/safe_math_revert_errors');
import { artifacts } from './artifacts';
import { TestLibSafeMathContract } from './wrappers';

View File

@ -1,6 +1,5 @@
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
import OwnableRevertErrors = require('../src/ownable_revert_errors');
import { OwnableRevertErrors } from '@0x/utils';
import { artifacts } from './artifacts';
import { IOwnableEvents, IOwnableOwnershipTransferredEventArgs, TestOwnableContract } from './wrappers';

View File

@ -3,7 +3,7 @@ import { BlockchainLifecycle } from '@0x/dev-utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import ReentrancyGuardRevertErrors = require('../src/reentrancy_guard_revert_errors');
import { ReentrancyGuardRevertErrors } from '@0x/utils';
import { artifacts } from './artifacts';
import { TestReentrancyGuardContract } from './wrappers';

View File

@ -1,7 +1,7 @@
import { constants, describe, expect } from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/utils';
import { safeAdd, safeDiv, safeMul, safeSub } from '../src/reference_functions';
import SafeMathRevertErrors = require('../src/safe_math_revert_errors');
describe('Reference Functions', () => {
const { ONE_ETHER, MAX_UINT256, ZERO_AMOUNT } = constants;

View File

@ -1,4 +1,13 @@
[
{
"version": "4.6.0-beta.3",
"changes": [
{
"note": "Re-export all `RevertErrors`",
"pr": 2362
}
]
},
{
"version": "4.6.0-beta.2",
"changes": [

View File

@ -25,3 +25,16 @@ export {
StringRevertError,
AnyRevertError,
} from './revert_error';
export import CoordinatorRevertErrors = require('./revert_errors/coordinator/revert_errors');
export import ExchangeForwarderRevertErrors = require('./revert_errors/exchange-forwarder/revert_errors');
export import LibMathRevertErrors = require('./revert_errors/exchange-libs/lib_math_revert_errors');
export import ExchangeRevertErrors = require('./revert_errors/exchange/revert_errors');
export import FixedMathRevertErrors = require('./revert_errors/staking/fixed_math_revert_errors');
export import StakingRevertErrors = require('./revert_errors/staking/staking_revert_errors');
export import AuthorizableRevertErrors = require('./revert_errors/utils/authorizable_revert_errors');
export import LibAddressArrayRevertErrors = require('./revert_errors/utils/lib_address_array_revert_errors');
export import LibBytesRevertErrors = require('./revert_errors/utils/lib_bytes_revert_errors');
export import OwnableRevertErrors = require('./revert_errors/utils/ownable_revert_errors');
export import ReentrancyGuardRevertErrors = require('./revert_errors/utils/reentrancy_guard_revert_errors');
export import SafeMathRevertErrors = require('./revert_errors/utils/safe_math_revert_errors');

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file

View File

@ -1,6 +1,8 @@
import { BigNumber, RevertError } from '@0x/utils';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class DivisionByZeroError extends RevertError {

View File

@ -1,7 +1,9 @@
import { OrderStatus } from '@0x/types';
import { BigNumber, RevertError } from '@0x/utils';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export enum BatchMatchOrdersErrorCodes {

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class AuthorizedAddressMismatchError extends RevertError {

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
export class MismanagedMemoryError extends RevertError {
constructor(freeMemPtr?: BigNumber, addressArrayEndPtr?: BigNumber) {

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
export enum InvalidByteOperationErrorCodes {
FromLessThanOrEqualsToRequired,

View File

@ -1,4 +1,4 @@
import { RevertError } from '@0x/utils';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file
export class OnlyOwnerError extends RevertError {

View File

@ -1,4 +1,4 @@
import { RevertError } from '@0x/utils';
import { RevertError } from '../../revert_error';
export class IllegalReentrancyError extends RevertError {
constructor() {

View File

@ -1,4 +1,5 @@
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber } from '../../configured_bignumber';
import { RevertError } from '../../revert_error';
// tslint:disable:max-classes-per-file