diff --git a/contracts/coordinator/src/index.ts b/contracts/coordinator/src/index.ts index 45a575245a..240e303d34 100644 --- a/contracts/coordinator/src/index.ts +++ b/contracts/coordinator/src/index.ts @@ -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'; diff --git a/contracts/coordinator/test/mixins.ts b/contracts/coordinator/test/mixins.ts index 57f22a9a4d..e5c2ee42a2 100644 --- a/contracts/coordinator/test/mixins.ts +++ b/contracts/coordinator/test/mixins.ts @@ -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'; diff --git a/contracts/exchange-forwarder/src/index.ts b/contracts/exchange-forwarder/src/index.ts index af6bcb28b2..dd06356a44 100644 --- a/contracts/exchange-forwarder/src/index.ts +++ b/contracts/exchange-forwarder/src/index.ts @@ -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, diff --git a/contracts/exchange-forwarder/test/asset_test.ts b/contracts/exchange-forwarder/test/asset_test.ts index 77fa1c8c3e..fab1391d59 100644 --- a/contracts/exchange-forwarder/test/asset_test.ts +++ b/contracts/exchange-forwarder/test/asset_test.ts @@ -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); }); }); diff --git a/contracts/exchange-libs/src/index.ts b/contracts/exchange-libs/src/index.ts index 029a1c093e..f0fb0f8085 100644 --- a/contracts/exchange-libs/src/index.ts +++ b/contracts/exchange-libs/src/index.ts @@ -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; diff --git a/contracts/exchange-libs/src/reference_functions.ts b/contracts/exchange-libs/src/reference_functions.ts index e3ebdf921d..fa57f09b70 100644 --- a/contracts/exchange-libs/src/reference_functions.ts +++ b/contracts/exchange-libs/src/reference_functions.ts @@ -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; diff --git a/contracts/exchange-libs/test/lib_fill_results.ts b/contracts/exchange-libs/test/lib_fill_results.ts index 694d2e3e5e..2d8d54ea41 100644 --- a/contracts/exchange-libs/test/lib_fill_results.ts +++ b/contracts/exchange-libs/test/lib_fill_results.ts @@ -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'; diff --git a/contracts/exchange-libs/test/lib_math.ts b/contracts/exchange-libs/test/lib_math.ts index 30f0441370..4575f200ff 100644 --- a/contracts/exchange-libs/test/lib_math.ts +++ b/contracts/exchange-libs/test/lib_math.ts @@ -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, diff --git a/contracts/exchange-libs/test/reference_functions.ts b/contracts/exchange-libs/test/reference_functions.ts index 797cace298..08fdf9b7ac 100644 --- a/contracts/exchange-libs/test/reference_functions.ts +++ b/contracts/exchange-libs/test/reference_functions.ts @@ -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, diff --git a/contracts/exchange/src/index.ts b/contracts/exchange/src/index.ts index 11d0e6753a..8bce846c1a 100644 --- a/contracts/exchange/src/index.ts +++ b/contracts/exchange/src/index.ts @@ -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'; diff --git a/contracts/exchange/test/dispatcher.ts b/contracts/exchange/test/dispatcher.ts index 9bbcb4fed1..f9e59e5b19 100644 --- a/contracts/exchange/test/dispatcher.ts +++ b/contracts/exchange/test/dispatcher.ts @@ -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; diff --git a/contracts/exchange/test/internal.ts b/contracts/exchange/test/internal.ts index 6968bc05d4..eb8a2425ff 100644 --- a/contracts/exchange/test/internal.ts +++ b/contracts/exchange/test/internal.ts @@ -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; diff --git a/contracts/exchange/test/isolated_fill_order.ts b/contracts/exchange/test/isolated_fill_order.ts index 057d3d090f..7f552f0818 100644 --- a/contracts/exchange/test/isolated_fill_order.ts +++ b/contracts/exchange/test/isolated_fill_order.ts @@ -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, diff --git a/contracts/exchange/test/lib_exchange_rich_error_decoder.ts b/contracts/exchange/test/lib_exchange_rich_error_decoder.ts index b1ad617424..9136f13dfd 100644 --- a/contracts/exchange/test/lib_exchange_rich_error_decoder.ts +++ b/contracts/exchange/test/lib_exchange_rich_error_decoder.ts @@ -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'; diff --git a/contracts/exchange/test/signature_validator.ts b/contracts/exchange/test/signature_validator.ts index cbf5a79efd..fea72881a5 100644 --- a/contracts/exchange/test/signature_validator.ts +++ b/contracts/exchange/test/signature_validator.ts @@ -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, diff --git a/contracts/exchange/test/transactions.ts b/contracts/exchange/test/transactions.ts index 13d632ab4c..584fa60eb0 100644 --- a/contracts/exchange/test/transactions.ts +++ b/contracts/exchange/test/transactions.ts @@ -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'; diff --git a/contracts/exchange/test/transactions_unit_tests.ts b/contracts/exchange/test/transactions_unit_tests.ts index 87f1925256..f84160f422 100644 --- a/contracts/exchange/test/transactions_unit_tests.ts +++ b/contracts/exchange/test/transactions_unit_tests.ts @@ -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'; diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts index 9a08ae78fb..942f8ce2bb 100644 --- a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts +++ b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts @@ -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'; diff --git a/contracts/exchange/test/wrapper_unit_tests.ts b/contracts/exchange/test/wrapper_unit_tests.ts index 96d0327744..b518c1d109 100644 --- a/contracts/exchange/test/wrapper_unit_tests.ts +++ b/contracts/exchange/test/wrapper_unit_tests.ts @@ -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, diff --git a/contracts/integrations/test/forwarder/bridge_test.ts b/contracts/integrations/test/forwarder/bridge_test.ts index 22061224c7..f5ac2ce510 100644 --- a/contracts/integrations/test/forwarder/bridge_test.ts +++ b/contracts/integrations/test/forwarder/bridge_test.ts @@ -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 }); }); }); diff --git a/contracts/integrations/test/forwarder/forwarder_test.ts b/contracts/integrations/test/forwarder/forwarder_test.ts index d276c74e07..3c414da4a3 100644 --- a/contracts/integrations/test/forwarder/forwarder_test.ts +++ b/contracts/integrations/test/forwarder/forwarder_test.ts @@ -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, diff --git a/contracts/staking/src/index.ts b/contracts/staking/src/index.ts index 277af9e0d0..7b2d5b8e54 100644 --- a/contracts/staking/src/index.ts +++ b/contracts/staking/src/index.ts @@ -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, diff --git a/contracts/staking/test/migration_test.ts b/contracts/staking/test/migration_test.ts index aebb814abe..2960a5b2ff 100644 --- a/contracts/staking/test/migration_test.ts +++ b/contracts/staking/test/migration_test.ts @@ -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 { diff --git a/contracts/staking/test/pools_test.ts b/contracts/staking/test/pools_test.ts index 142a71394f..9581fcec20 100644 --- a/contracts/staking/test/pools_test.ts +++ b/contracts/staking/test/pools_test.ts @@ -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'; diff --git a/contracts/staking/test/rewards_test.ts b/contracts/staking/test/rewards_test.ts index 098aa92a27..cff54d80e0 100644 --- a/contracts/staking/test/rewards_test.ts +++ b/contracts/staking/test/rewards_test.ts @@ -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'; diff --git a/contracts/staking/test/stake_test.ts b/contracts/staking/test/stake_test.ts index a530ad28a4..75d791c3f1 100644 --- a/contracts/staking/test/stake_test.ts +++ b/contracts/staking/test/stake_test.ts @@ -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'; diff --git a/contracts/staking/test/unit_tests/exchange_test.ts b/contracts/staking/test/unit_tests/exchange_test.ts index af3302f1c2..9e769c8630 100644 --- a/contracts/staking/test/unit_tests/exchange_test.ts +++ b/contracts/staking/test/unit_tests/exchange_test.ts @@ -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, diff --git a/contracts/staking/test/unit_tests/finalizer_test.ts b/contracts/staking/test/unit_tests/finalizer_test.ts index bf3f581b28..fd203e891d 100644 --- a/contracts/staking/test/unit_tests/finalizer_test.ts +++ b/contracts/staking/test/unit_tests/finalizer_test.ts @@ -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'; diff --git a/contracts/staking/test/unit_tests/lib_fixed_math_test.ts b/contracts/staking/test/unit_tests/lib_fixed_math_test.ts index 8b08e74e41..ae020ebc4d 100644 --- a/contracts/staking/test/unit_tests/lib_fixed_math_test.ts +++ b/contracts/staking/test/unit_tests/lib_fixed_math_test.ts @@ -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'; diff --git a/contracts/staking/test/unit_tests/mixin_scheduler_test.ts b/contracts/staking/test/unit_tests/mixin_scheduler_test.ts index 8e01f061cd..c588472410 100644 --- a/contracts/staking/test/unit_tests/mixin_scheduler_test.ts +++ b/contracts/staking/test/unit_tests/mixin_scheduler_test.ts @@ -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 { diff --git a/contracts/staking/test/unit_tests/protocol_fees_test.ts b/contracts/staking/test/unit_tests/protocol_fees_test.ts index 06634c5667..f268fe6845 100644 --- a/contracts/staking/test/unit_tests/protocol_fees_test.ts +++ b/contracts/staking/test/unit_tests/protocol_fees_test.ts @@ -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, diff --git a/contracts/staking/test/unit_tests/stake_test.ts b/contracts/staking/test/unit_tests/stake_test.ts index defd6b58d6..a53611c6c1 100644 --- a/contracts/staking/test/unit_tests/stake_test.ts +++ b/contracts/staking/test/unit_tests/stake_test.ts @@ -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'; diff --git a/contracts/staking/test/unit_tests/staking_proxy_test.ts b/contracts/staking/test/unit_tests/staking_proxy_test.ts index 5d72266ca2..1c56b18b61 100644 --- a/contracts/staking/test/unit_tests/staking_proxy_test.ts +++ b/contracts/staking/test/unit_tests/staking_proxy_test.ts @@ -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!'; diff --git a/contracts/staking/test/unit_tests/zrx_vault_test.ts b/contracts/staking/test/unit_tests/zrx_vault_test.ts index fc94715ac5..a693d082e8 100644 --- a/contracts/staking/test/unit_tests/zrx_vault_test.ts +++ b/contracts/staking/test/unit_tests/zrx_vault_test.ts @@ -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 { diff --git a/contracts/tests/test/dev-utils/lib_asset_data.ts b/contracts/tests/test/dev-utils/lib_asset_data.ts index 76ebe8578a..7b6953a3d0 100644 --- a/contracts/tests/test/dev-utils/lib_asset_data.ts +++ b/contracts/tests/test/dev-utils/lib_asset_data.ts @@ -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, ); } }); diff --git a/contracts/utils/src/index.ts b/contracts/utils/src/index.ts index c5f5bb8b4e..f5eefb8b42 100644 --- a/contracts/utils/src/index.ts +++ b/contracts/utils/src/index.ts @@ -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'; diff --git a/contracts/utils/src/reference_functions.ts b/contracts/utils/src/reference_functions.ts index 3b384fb71f..cd67f4a089 100644 --- a/contracts/utils/src/reference_functions.ts +++ b/contracts/utils/src/reference_functions.ts @@ -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); diff --git a/contracts/utils/test/authorizable.ts b/contracts/utils/test/authorizable.ts index 60850ada5b..c48852500b 100644 --- a/contracts/utils/test/authorizable.ts +++ b/contracts/utils/test/authorizable.ts @@ -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'; diff --git a/contracts/utils/test/lib_address_array.ts b/contracts/utils/test/lib_address_array.ts index de256709bb..df4116b661 100644 --- a/contracts/utils/test/lib_address_array.ts +++ b/contracts/utils/test/lib_address_array.ts @@ -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'; diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts index ea55d7cff2..e8feeb61d0 100644 --- a/contracts/utils/test/lib_bytes.ts +++ b/contracts/utils/test/lib_bytes.ts @@ -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'; diff --git a/contracts/utils/test/lib_safe_math.ts b/contracts/utils/test/lib_safe_math.ts index 42121106d0..f6a34c391f 100644 --- a/contracts/utils/test/lib_safe_math.ts +++ b/contracts/utils/test/lib_safe_math.ts @@ -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'; diff --git a/contracts/utils/test/ownable.ts b/contracts/utils/test/ownable.ts index e802a0b679..471edcd9a5 100644 --- a/contracts/utils/test/ownable.ts +++ b/contracts/utils/test/ownable.ts @@ -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'; diff --git a/contracts/utils/test/reentrancy_guard.ts b/contracts/utils/test/reentrancy_guard.ts index 438fccf63a..ec8d6ff282 100644 --- a/contracts/utils/test/reentrancy_guard.ts +++ b/contracts/utils/test/reentrancy_guard.ts @@ -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'; diff --git a/contracts/utils/test/reference_functions.ts b/contracts/utils/test/reference_functions.ts index 4b6393715b..f604633e2b 100644 --- a/contracts/utils/test/reference_functions.ts +++ b/contracts/utils/test/reference_functions.ts @@ -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; diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index e0994b4fdb..1d18085ccf 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -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": [ diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 81de561a40..1a25cb41d6 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -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'); diff --git a/contracts/coordinator/src/revert_errors.ts b/packages/utils/src/revert_errors/coordinator/revert_errors.ts similarity index 93% rename from contracts/coordinator/src/revert_errors.ts rename to packages/utils/src/revert_errors/coordinator/revert_errors.ts index 4433790a8e..a117890b38 100644 --- a/contracts/coordinator/src/revert_errors.ts +++ b/packages/utils/src/revert_errors/coordinator/revert_errors.ts @@ -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 diff --git a/contracts/exchange-forwarder/src/revert_errors.ts b/packages/utils/src/revert_errors/exchange-forwarder/revert_errors.ts similarity index 96% rename from contracts/exchange-forwarder/src/revert_errors.ts rename to packages/utils/src/revert_errors/exchange-forwarder/revert_errors.ts index dfd4071fb1..bf4da2bd69 100644 --- a/contracts/exchange-forwarder/src/revert_errors.ts +++ b/packages/utils/src/revert_errors/exchange-forwarder/revert_errors.ts @@ -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 diff --git a/contracts/exchange-libs/src/lib_math_revert_errors.ts b/packages/utils/src/revert_errors/exchange-libs/lib_math_revert_errors.ts similarity index 88% rename from contracts/exchange-libs/src/lib_math_revert_errors.ts rename to packages/utils/src/revert_errors/exchange-libs/lib_math_revert_errors.ts index bf132852d5..860fd3223b 100644 --- a/contracts/exchange-libs/src/lib_math_revert_errors.ts +++ b/packages/utils/src/revert_errors/exchange-libs/lib_math_revert_errors.ts @@ -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 { diff --git a/contracts/exchange/src/revert_errors.ts b/packages/utils/src/revert_errors/exchange/revert_errors.ts similarity index 98% rename from contracts/exchange/src/revert_errors.ts rename to packages/utils/src/revert_errors/exchange/revert_errors.ts index d5118ffbb4..83cece37fb 100644 --- a/contracts/exchange/src/revert_errors.ts +++ b/packages/utils/src/revert_errors/exchange/revert_errors.ts @@ -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 { diff --git a/contracts/staking/src/fixed_math_revert_errors.ts b/packages/utils/src/revert_errors/staking/fixed_math_revert_errors.ts similarity index 92% rename from contracts/staking/src/fixed_math_revert_errors.ts rename to packages/utils/src/revert_errors/staking/fixed_math_revert_errors.ts index e0206d0be4..fafe47cf2d 100644 --- a/contracts/staking/src/fixed_math_revert_errors.ts +++ b/packages/utils/src/revert_errors/staking/fixed_math_revert_errors.ts @@ -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 diff --git a/contracts/staking/src/staking_revert_errors.ts b/packages/utils/src/revert_errors/staking/staking_revert_errors.ts similarity index 98% rename from contracts/staking/src/staking_revert_errors.ts rename to packages/utils/src/revert_errors/staking/staking_revert_errors.ts index 81c0c983ee..7cd5a2acd2 100644 --- a/contracts/staking/src/staking_revert_errors.ts +++ b/packages/utils/src/revert_errors/staking/staking_revert_errors.ts @@ -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 diff --git a/contracts/utils/src/authorizable_revert_errors.ts b/packages/utils/src/revert_errors/utils/authorizable_revert_errors.ts similarity index 94% rename from contracts/utils/src/authorizable_revert_errors.ts rename to packages/utils/src/revert_errors/utils/authorizable_revert_errors.ts index dd001d5e44..e7f5d9bf97 100644 --- a/contracts/utils/src/authorizable_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/authorizable_revert_errors.ts @@ -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 { diff --git a/contracts/utils/src/lib_address_array_revert_errors.ts b/packages/utils/src/revert_errors/utils/lib_address_array_revert_errors.ts similarity index 79% rename from contracts/utils/src/lib_address_array_revert_errors.ts rename to packages/utils/src/revert_errors/utils/lib_address_array_revert_errors.ts index fdd7c4fbcd..d9d0e878b9 100644 --- a/contracts/utils/src/lib_address_array_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/lib_address_array_revert_errors.ts @@ -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) { diff --git a/contracts/utils/src/lib_bytes_revert_errors.ts b/packages/utils/src/revert_errors/utils/lib_bytes_revert_errors.ts similarity index 89% rename from contracts/utils/src/lib_bytes_revert_errors.ts rename to packages/utils/src/revert_errors/utils/lib_bytes_revert_errors.ts index 3d7f4fa0f9..a83e5013ce 100644 --- a/contracts/utils/src/lib_bytes_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/lib_bytes_revert_errors.ts @@ -1,4 +1,5 @@ -import { BigNumber, RevertError } from '@0x/utils'; +import { BigNumber } from '../../configured_bignumber'; +import { RevertError } from '../../revert_error'; export enum InvalidByteOperationErrorCodes { FromLessThanOrEqualsToRequired, diff --git a/contracts/utils/src/ownable_revert_errors.ts b/packages/utils/src/revert_errors/utils/ownable_revert_errors.ts similarity index 92% rename from contracts/utils/src/ownable_revert_errors.ts rename to packages/utils/src/revert_errors/utils/ownable_revert_errors.ts index dd61036876..14e18df617 100644 --- a/contracts/utils/src/ownable_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/ownable_revert_errors.ts @@ -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 { diff --git a/contracts/utils/src/reentrancy_guard_revert_errors.ts b/packages/utils/src/revert_errors/utils/reentrancy_guard_revert_errors.ts similarity index 83% rename from contracts/utils/src/reentrancy_guard_revert_errors.ts rename to packages/utils/src/revert_errors/utils/reentrancy_guard_revert_errors.ts index 1c39c6d5c4..75cf0c7fe1 100644 --- a/contracts/utils/src/reentrancy_guard_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/reentrancy_guard_revert_errors.ts @@ -1,4 +1,4 @@ -import { RevertError } from '@0x/utils'; +import { RevertError } from '../../revert_error'; export class IllegalReentrancyError extends RevertError { constructor() { diff --git a/contracts/utils/src/safe_math_revert_errors.ts b/packages/utils/src/revert_errors/utils/safe_math_revert_errors.ts similarity index 93% rename from contracts/utils/src/safe_math_revert_errors.ts rename to packages/utils/src/revert_errors/utils/safe_math_revert_errors.ts index 499dc2009e..b90f11b1d4 100644 --- a/contracts/utils/src/safe_math_revert_errors.ts +++ b/packages/utils/src/revert_errors/utils/safe_math_revert_errors.ts @@ -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