From 389d4d10f1cec7989649665cac6a1d08428ca13c Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Wed, 27 Nov 2019 11:58:25 +1100 Subject: [PATCH] Import from @0x/utils --- .../test/utils/fill_order_combinatorial_utils.ts | 4 +--- contracts/integrations/test/forwarder/bridge_test.ts | 12 ++++++------ contracts/staking/test/unit_tests/exchange_test.ts | 3 +-- contracts/staking/test/unit_tests/finalizer_test.ts | 3 +-- .../staking/test/unit_tests/lib_fixed_math_test.ts | 3 +-- .../staking/test/unit_tests/mixin_scheduler_test.ts | 3 +-- .../staking/test/unit_tests/protocol_fees_test.ts | 4 +--- contracts/staking/test/unit_tests/stake_test.ts | 3 +-- .../staking/test/unit_tests/staking_proxy_test.ts | 3 +-- contracts/staking/test/unit_tests/zrx_vault_test.ts | 4 +--- 10 files changed, 15 insertions(+), 27 deletions(-) diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts index 4089d1acf0..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 } from '../../src'; - import { artifacts } from '../artifacts'; import { ExchangeContract, ExchangeFillEventArgs } from '../wrappers'; 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/staking/test/unit_tests/exchange_test.ts b/contracts/staking/test/unit_tests/exchange_test.ts index df1e8fef28..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 } from '../../src'; - 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 1a6f278559..fd203e891d 100644 --- a/contracts/staking/test/unit_tests/finalizer_test.ts +++ b/contracts/staking/test/unit_tests/finalizer_test.ts @@ -7,11 +7,10 @@ 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 { StakingRevertErrors } from '../../src'; import { constants as stakingConstants } from '../../src/constants'; import { artifacts } from '../artifacts'; 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 1c0ade0fd5..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 } from '../../src'; 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 3595dc6829..c588472410 100644 --- a/contracts/staking/test/unit_tests/mixin_scheduler_test.ts +++ b/contracts/staking/test/unit_tests/mixin_scheduler_test.ts @@ -1,8 +1,7 @@ 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 { StakingRevertErrors } from '../../src'; import { constants as stakingConstants } from '../../src/constants'; import { artifacts } from '../artifacts'; diff --git a/contracts/staking/test/unit_tests/protocol_fees_test.ts b/contracts/staking/test/unit_tests/protocol_fees_test.ts index f9e12e4b1b..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 } from '../../src'; - 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 3688ac7fa9..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 } from '../../src'; 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 bc6a19fe67..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'; @@ -11,7 +11,6 @@ import { TestStakingProxyUnitContract, } from '../wrappers'; -import { StakingRevertErrors } from '../../src'; import { constants as stakingConstants } from '../../src/constants'; blockchainTests.resets('StakingProxy unit tests', env => { diff --git a/contracts/staking/test/unit_tests/zrx_vault_test.ts b/contracts/staking/test/unit_tests/zrx_vault_test.ts index adceab2c84..a693d082e8 100644 --- a/contracts/staking/test/unit_tests/zrx_vault_test.ts +++ b/contracts/staking/test/unit_tests/zrx_vault_test.ts @@ -8,12 +8,10 @@ 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 { StakingRevertErrors } from '../../src'; import { constants as stakingConstants } from '../../src/constants'; import { artifacts } from '../artifacts';