diff --git a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts b/contracts/asset-proxy/src/erc1155_proxy_wrapper.ts similarity index 99% rename from contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts rename to contracts/asset-proxy/src/erc1155_proxy_wrapper.ts index cc40915f1d..fe68af2cfb 100644 --- a/contracts/asset-proxy/test/utils/erc1155_proxy_wrapper.ts +++ b/contracts/asset-proxy/src/erc1155_proxy_wrapper.ts @@ -13,9 +13,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts } from '../../src/artifacts'; +import { artifacts } from './artifacts'; -import { ERC1155ProxyContract, IAssetProxyContract } from '../../src/wrappers'; +import { ERC1155ProxyContract, IAssetProxyContract } from './wrappers'; export class ERC1155ProxyWrapper { private readonly _tokenOwnerAddresses: string[]; diff --git a/contracts/asset-proxy/test/utils/erc20_wrapper.ts b/contracts/asset-proxy/src/erc20_wrapper.ts similarity index 98% rename from contracts/asset-proxy/test/utils/erc20_wrapper.ts rename to contracts/asset-proxy/src/erc20_wrapper.ts index 831dfbf26f..c928375a92 100644 --- a/contracts/asset-proxy/test/utils/erc20_wrapper.ts +++ b/contracts/asset-proxy/src/erc20_wrapper.ts @@ -5,9 +5,9 @@ import { BigNumber } from '@0x/utils'; import { ZeroExProvider } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts } from '../../src/artifacts'; +import { artifacts } from './artifacts'; -import { ERC20ProxyContract } from '../../src/wrappers'; +import { ERC20ProxyContract } from './wrappers'; export class ERC20Wrapper { private readonly _tokenOwnerAddresses: string[]; diff --git a/contracts/asset-proxy/test/utils/erc721_wrapper.ts b/contracts/asset-proxy/src/erc721_wrapper.ts similarity index 99% rename from contracts/asset-proxy/test/utils/erc721_wrapper.ts rename to contracts/asset-proxy/src/erc721_wrapper.ts index 068c675f1e..cbee407178 100644 --- a/contracts/asset-proxy/test/utils/erc721_wrapper.ts +++ b/contracts/asset-proxy/src/erc721_wrapper.ts @@ -5,9 +5,9 @@ import { BigNumber } from '@0x/utils'; import { ZeroExProvider } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts } from '../../src/artifacts'; +import { artifacts } from './artifacts'; -import { ERC721ProxyContract } from '../../src/wrappers'; +import { ERC721ProxyContract } from './wrappers'; export class ERC721Wrapper { private readonly _tokenOwnerAddresses: string[]; diff --git a/contracts/asset-proxy/src/index.ts b/contracts/asset-proxy/src/index.ts index 0943b3fb67..c09b5adde2 100644 --- a/contracts/asset-proxy/src/index.ts +++ b/contracts/asset-proxy/src/index.ts @@ -1,6 +1,6 @@ export * from './artifacts'; export * from './wrappers'; -export { ERC20Wrapper } from '../test/utils/erc20_wrapper'; -export { ERC721Wrapper } from '../test/utils/erc721_wrapper'; -export { ERC1155ProxyWrapper } from '../test/utils/erc1155_proxy_wrapper'; +export { ERC20Wrapper } from './erc20_wrapper'; +export { ERC721Wrapper } from './erc721_wrapper'; +export { ERC1155ProxyWrapper } from './erc1155_proxy_wrapper'; diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 07afe72288..4f26770972 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -23,10 +23,10 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; +import { ERC1155ProxyWrapper } from '../src/erc1155_proxy_wrapper'; import { ERC1155ProxyContract, IAssetDataContract } from '../src/wrappers'; import { artifacts } from './artifacts'; -import { ERC1155ProxyWrapper } from './utils/erc1155_proxy_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts index 0f66004f7f..5f48bda4dd 100644 --- a/contracts/asset-proxy/test/proxies.ts +++ b/contracts/asset-proxy/test/proxies.ts @@ -29,12 +29,12 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; +import { ERC1155ProxyWrapper } from '../src/erc1155_proxy_wrapper'; +import { ERC20Wrapper } from '../src/erc20_wrapper'; +import { ERC721Wrapper } from '../src/erc721_wrapper'; import { ERC1155ProxyContract, ERC20ProxyContract, ERC721ProxyContract } from '../src/wrappers'; import { artifacts } from './artifacts'; -import { ERC1155ProxyWrapper } from './utils/erc1155_proxy_wrapper'; -import { ERC20Wrapper } from './utils/erc20_wrapper'; -import { ERC721Wrapper } from './utils/erc721_wrapper'; import { IAssetDataContract, IAssetProxyContract, MultiAssetProxyContract } from './wrappers'; chaiSetup.configure(); diff --git a/contracts/asset-proxy/test/utils/index.ts b/contracts/asset-proxy/test/utils/index.ts deleted file mode 100644 index 897806e703..0000000000 --- a/contracts/asset-proxy/test/utils/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './erc20_wrapper'; -export * from './erc721_wrapper'; -export * from './erc1155_proxy_wrapper'; diff --git a/contracts/coordinator/test/utils/approval_factory.ts b/contracts/coordinator/src/approval_factory.ts similarity index 91% rename from contracts/coordinator/test/utils/approval_factory.ts rename to contracts/coordinator/src/approval_factory.ts index 2ee069de03..97c2ae999a 100644 --- a/contracts/coordinator/test/utils/approval_factory.ts +++ b/contracts/coordinator/src/approval_factory.ts @@ -1,7 +1,8 @@ import { hexConcat, signingUtils } from '@0x/contracts-test-utils'; import { SignatureType, SignedZeroExTransaction } from '@0x/types'; -import { hashUtils, SignedCoordinatorApproval } from './index'; +import { hashUtils } from './hash_utils'; +import { SignedCoordinatorApproval } from './types'; export class ApprovalFactory { private readonly _privateKey: Buffer; diff --git a/contracts/coordinator/test/utils/hash_utils.ts b/contracts/coordinator/src/hash_utils.ts similarity index 100% rename from contracts/coordinator/test/utils/hash_utils.ts rename to contracts/coordinator/src/hash_utils.ts diff --git a/contracts/coordinator/src/index.ts b/contracts/coordinator/src/index.ts index 63441fd29c..fc96ee9ddc 100644 --- a/contracts/coordinator/src/index.ts +++ b/contracts/coordinator/src/index.ts @@ -1,4 +1,4 @@ export * from './artifacts'; export * from './wrappers'; -export { ApprovalFactory } from '../test/utils/approval_factory'; -export { SignedCoordinatorApproval } from '../test/utils/types'; +export { ApprovalFactory } from './approval_factory'; +export { SignedCoordinatorApproval } from './types'; diff --git a/contracts/coordinator/test/utils/types.ts b/contracts/coordinator/src/types.ts similarity index 100% rename from contracts/coordinator/test/utils/types.ts rename to contracts/coordinator/src/types.ts diff --git a/contracts/coordinator/test/libs.ts b/contracts/coordinator/test/libs.ts index 094797c243..44ca15253d 100644 --- a/contracts/coordinator/test/libs.ts +++ b/contracts/coordinator/test/libs.ts @@ -2,7 +2,7 @@ import { blockchainTests, constants, expect, randomAddress } from '@0x/contracts import { transactionHashUtils } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; -import { hashUtils } from './utils/hash_utils'; +import { hashUtils } from '../src/hash_utils'; import { artifacts } from './artifacts'; diff --git a/contracts/coordinator/test/mixins.ts b/contracts/coordinator/test/mixins.ts index d5a76d1ce5..2534fa676d 100644 --- a/contracts/coordinator/test/mixins.ts +++ b/contracts/coordinator/test/mixins.ts @@ -13,7 +13,7 @@ import { CoordinatorRevertErrors, transactionHashUtils } from '@0x/order-utils'; import { SignatureType, SignedOrder } from '@0x/types'; import { BigNumber, LibBytesRevertErrors } from '@0x/utils'; -import { ApprovalFactory } from './utils/approval_factory'; +import { ApprovalFactory } from '../src/approval_factory'; import { artifacts } from './artifacts'; diff --git a/contracts/coordinator/test/utils/index.ts b/contracts/coordinator/test/utils/index.ts deleted file mode 100644 index bd5bd79dae..0000000000 --- a/contracts/coordinator/test/utils/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { hashUtils } from './hash_utils'; -export { ApprovalFactory } from './approval_factory'; -export * from './types'; diff --git a/contracts/erc1155/test/utils/erc1155_wrapper.ts b/contracts/erc1155/src/erc1155_wrapper.ts similarity index 99% rename from contracts/erc1155/test/utils/erc1155_wrapper.ts rename to contracts/erc1155/src/erc1155_wrapper.ts index 3e616792a9..a0c3b21848 100644 --- a/contracts/erc1155/test/utils/erc1155_wrapper.ts +++ b/contracts/erc1155/src/erc1155_wrapper.ts @@ -5,9 +5,9 @@ import * as chai from 'chai'; import { LogWithDecodedArgs, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { ERC1155MintableContract, ERC1155TransferSingleEventArgs } from '../../src/wrappers'; +import { ERC1155MintableContract, ERC1155TransferSingleEventArgs } from './wrappers'; -import { artifacts } from '../artifacts'; +import { artifacts } from './artifacts'; const expect = chai.expect; diff --git a/contracts/erc1155/src/index.ts b/contracts/erc1155/src/index.ts index 334373edbd..9b5503a9b4 100644 --- a/contracts/erc1155/src/index.ts +++ b/contracts/erc1155/src/index.ts @@ -1,3 +1,3 @@ export * from './wrappers'; export * from './artifacts'; -export { Erc1155Wrapper } from '../test/utils/erc1155_wrapper'; +export { Erc1155Wrapper } from './erc1155_wrapper'; diff --git a/contracts/erc1155/test/erc1155_token.ts b/contracts/erc1155/test/erc1155_token.ts index bf2eda28f5..b5279cc1f5 100644 --- a/contracts/erc1155/test/erc1155_token.ts +++ b/contracts/erc1155/test/erc1155_token.ts @@ -16,7 +16,7 @@ import * as _ from 'lodash'; import { ERC1155MintableContract } from '../src/wrappers'; import { artifacts } from './artifacts'; -import { Erc1155Wrapper } from './utils/erc1155_wrapper'; +import { Erc1155Wrapper } from '../src/erc1155_wrapper'; import { DummyERC1155ReceiverBatchTokenReceivedEventArgs, DummyERC1155ReceiverContract } from './wrappers'; chaiSetup.configure(); const expect = chai.expect; diff --git a/contracts/exchange/test/balance_stores/balance_store.ts b/contracts/exchange/src/balance_stores/balance_store.ts similarity index 100% rename from contracts/exchange/test/balance_stores/balance_store.ts rename to contracts/exchange/src/balance_stores/balance_store.ts diff --git a/contracts/exchange/test/balance_stores/blockchain_balance_store.ts b/contracts/exchange/src/balance_stores/blockchain_balance_store.ts similarity index 100% rename from contracts/exchange/test/balance_stores/blockchain_balance_store.ts rename to contracts/exchange/src/balance_stores/blockchain_balance_store.ts diff --git a/contracts/exchange/test/balance_stores/local_balance_store.ts b/contracts/exchange/src/balance_stores/local_balance_store.ts similarity index 100% rename from contracts/exchange/test/balance_stores/local_balance_store.ts rename to contracts/exchange/src/balance_stores/local_balance_store.ts diff --git a/contracts/exchange/test/balance_stores/types.ts b/contracts/exchange/src/balance_stores/types.ts similarity index 100% rename from contracts/exchange/test/balance_stores/types.ts rename to contracts/exchange/src/balance_stores/types.ts diff --git a/contracts/exchange/test/utils/exchange_data_encoder.ts b/contracts/exchange/src/exchange_data_encoder.ts similarity index 98% rename from contracts/exchange/test/utils/exchange_data_encoder.ts rename to contracts/exchange/src/exchange_data_encoder.ts index 8d8f60f52c..24022757fb 100644 --- a/contracts/exchange/test/utils/exchange_data_encoder.ts +++ b/contracts/exchange/src/exchange_data_encoder.ts @@ -2,7 +2,7 @@ import { constants, ExchangeFunctionName, provider } from '@0x/contracts-test-ut import { orderHashUtils } from '@0x/order-utils'; import { SignedOrder } from '@0x/types'; -import { IExchangeContract } from '../wrappers'; +import { IExchangeContract } from './wrappers'; export const exchangeDataEncoder = { encodeOrdersToExchangeData(fnName: ExchangeFunctionName, orders: SignedOrder[] = []): string { diff --git a/contracts/exchange/src/index.ts b/contracts/exchange/src/index.ts index 8beaae9fc4..db2a3f1ec4 100644 --- a/contracts/exchange/src/index.ts +++ b/contracts/exchange/src/index.ts @@ -1,6 +1,5 @@ export * from './artifacts'; export * from './wrappers'; -export { BlockchainBalanceStore } from '../test/balance_stores/blockchain_balance_store'; -export { LocalBalanceStore } from '../test/balance_stores/local_balance_store'; -export { TokenOwnersByName } from '../test/balance_stores/types'; -export * from '../test/utils/exchange_data_encoder'; +export { BlockchainBalanceStore } from './balance_stores/blockchain_balance_store'; +export { LocalBalanceStore } from './balance_stores/local_balance_store'; +export { exchangeDataEncoder } from './exchange_data_encoder'; diff --git a/contracts/exchange/test/assertion_wrappers/fill_order_wrapper.ts b/contracts/exchange/test/assertion_wrappers/fill_order_wrapper.ts index aac0377a27..c6df6a38ca 100644 --- a/contracts/exchange/test/assertion_wrappers/fill_order_wrapper.ts +++ b/contracts/exchange/test/assertion_wrappers/fill_order_wrapper.ts @@ -16,14 +16,10 @@ import * as _ from 'lodash'; import { ExchangeContract } from '../wrappers'; -import { - BalanceStore, - BlockchainBalanceStore, - LocalBalanceStore, - TokenContractsByName, - TokenIds, - TokenOwnersByName, -} from './../balance_stores'; +import { BalanceStore } from '../../src/balance_stores/balance_store'; +import { BlockchainBalanceStore } from '../../src/balance_stores/blockchain_balance_store'; +import { LocalBalanceStore } from '../../src/balance_stores/local_balance_store'; +import { TokenContractsByName, TokenIds, TokenOwnersByName } from '../../src/balance_stores/types'; export class FillOrderWrapper { private readonly _blockchainBalanceStore: BlockchainBalanceStore; diff --git a/contracts/exchange/test/balance_stores/index.ts b/contracts/exchange/test/balance_stores/index.ts deleted file mode 100644 index cb0e290bca..0000000000 --- a/contracts/exchange/test/balance_stores/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { BalanceStore } from './balance_store'; -export { LocalBalanceStore } from './local_balance_store'; -export { BlockchainBalanceStore } from './blockchain_balance_store'; -export * from './types'; diff --git a/contracts/exchange/test/core.ts b/contracts/exchange/test/core.ts index 4464faba0a..c8059fa765 100644 --- a/contracts/exchange/test/core.ts +++ b/contracts/exchange/test/core.ts @@ -40,7 +40,8 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { ExchangeWrapper, ValidatorWalletAction } from './utils'; +import { ValidatorWalletAction } from './utils/constants'; +import { ExchangeWrapper } from './utils/exchange_wrapper'; import { artifacts } from './artifacts'; import { FillOrderWrapper } from './assertion_wrappers/fill_order_wrapper'; diff --git a/contracts/exchange/test/signature_validator.ts b/contracts/exchange/test/signature_validator.ts index c15b7645b7..ef0f2ff195 100644 --- a/contracts/exchange/test/signature_validator.ts +++ b/contracts/exchange/test/signature_validator.ts @@ -25,7 +25,7 @@ import { TestValidatorWalletContract, } from './wrappers'; -import { ValidatorWalletAction } from './utils'; +import { ValidatorWalletAction } from './utils/constants'; // tslint:disable:no-unnecessary-type-assertion blockchainTests.resets('MixinSignatureValidator', env => { diff --git a/contracts/exchange/test/transactions.ts b/contracts/exchange/test/transactions.ts index 5101e2e229..5ecff45135 100644 --- a/contracts/exchange/test/transactions.ts +++ b/contracts/exchange/test/transactions.ts @@ -19,8 +19,10 @@ import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; +import { exchangeDataEncoder } from '../src/exchange_data_encoder'; + import { artifacts as localArtifacts } from './artifacts'; -import { exchangeDataEncoder, ExchangeWrapper } from './utils'; +import { ExchangeWrapper } from './utils/exchange_wrapper'; import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, diff --git a/contracts/exchange/test/utils/index.ts b/contracts/exchange/test/utils/index.ts deleted file mode 100644 index 3fe740f591..0000000000 --- a/contracts/exchange/test/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './exchange_wrapper'; -export * from './exchange_data_encoder'; -export * from './types'; -export * from './constants'; diff --git a/contracts/integrations/test/utils/deployment_manager.ts b/contracts/integrations/src/deployment_manager.ts similarity index 100% rename from contracts/integrations/test/utils/deployment_manager.ts rename to contracts/integrations/src/deployment_manager.ts diff --git a/contracts/integrations/test/utils/function_assertions.ts b/contracts/integrations/src/function_assertions.ts similarity index 100% rename from contracts/integrations/test/utils/function_assertions.ts rename to contracts/integrations/src/function_assertions.ts diff --git a/contracts/integrations/src/index.ts b/contracts/integrations/src/index.ts index 97179831da..cd34376cb1 100644 --- a/contracts/integrations/src/index.ts +++ b/contracts/integrations/src/index.ts @@ -1,4 +1,4 @@ export * from './artifacts'; export * from './wrappers'; -export * from '../test/utils/function_assertions'; -export * from '../test/utils/deployment_manager'; +export * from './function_assertions'; +export { DeploymentManager } from './deployment_manager'; diff --git a/contracts/integrations/test/utils/wrapper_interfaces.ts b/contracts/integrations/src/wrapper_interfaces.ts similarity index 100% rename from contracts/integrations/test/utils/wrapper_interfaces.ts rename to contracts/integrations/src/wrapper_interfaces.ts diff --git a/contracts/integrations/test/actors/base.ts b/contracts/integrations/test/actors/base.ts index a763e02f8d..546868af0f 100644 --- a/contracts/integrations/test/actors/base.ts +++ b/contracts/integrations/test/actors/base.ts @@ -5,7 +5,7 @@ import { SignatureType, SignedZeroExTransaction, ZeroExTransaction } from '@0x/t import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; export type Constructor = new (...args: any[]) => T; diff --git a/contracts/integrations/test/actors/taker.ts b/contracts/integrations/test/actors/taker.ts index a63311b139..9985e72f1b 100644 --- a/contracts/integrations/test/actors/taker.ts +++ b/contracts/integrations/test/actors/taker.ts @@ -2,7 +2,7 @@ import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs, TxData } from 'ethereum-types'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; import { Actor, Constructor } from './base'; diff --git a/contracts/integrations/test/coordinator/coordinator_test.ts b/contracts/integrations/test/coordinator/coordinator_test.ts index 54141a680e..52312b596b 100644 --- a/contracts/integrations/test/coordinator/coordinator_test.ts +++ b/contracts/integrations/test/coordinator/coordinator_test.ts @@ -25,7 +25,7 @@ import { BigNumber } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; import { deployCoordinatorAsync } from './deploy_coordinator'; diff --git a/contracts/integrations/test/coordinator/deploy_coordinator.ts b/contracts/integrations/test/coordinator/deploy_coordinator.ts index f5b1c93842..ff8f7af1cd 100644 --- a/contracts/integrations/test/coordinator/deploy_coordinator.ts +++ b/contracts/integrations/test/coordinator/deploy_coordinator.ts @@ -3,7 +3,7 @@ import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange'; import { BlockchainTestsEnvironment } from '@0x/contracts-test-utils'; import { BigNumber } from '@0x/utils'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; /** * Deploys a Coordinator contract configured to work alongside the provided `deployment`. diff --git a/contracts/integrations/test/forwarder/deploy_forwarder.ts b/contracts/integrations/test/forwarder/deploy_forwarder.ts index 88056fb423..fd75b4d209 100644 --- a/contracts/integrations/test/forwarder/deploy_forwarder.ts +++ b/contracts/integrations/test/forwarder/deploy_forwarder.ts @@ -3,7 +3,7 @@ import { artifacts, ForwarderContract } from '@0x/contracts-exchange-forwarder'; import { BlockchainTestsEnvironment } from '@0x/contracts-test-utils'; import { assetDataUtils } from '@0x/order-utils'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; /** * Deploys a Forwarder contract configured to work alongside the provided `deployment`. diff --git a/contracts/integrations/test/forwarder/forwarder_test.ts b/contracts/integrations/test/forwarder/forwarder_test.ts index f521b9e44c..c6dfb93e52 100644 --- a/contracts/integrations/test/forwarder/forwarder_test.ts +++ b/contracts/integrations/test/forwarder/forwarder_test.ts @@ -21,7 +21,7 @@ import { ForwarderRevertErrors } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; import { deployForwarderAsync } from './deploy_forwarder'; import { ForwarderTestFactory } from './forwarder_test_factory'; diff --git a/contracts/integrations/test/forwarder/forwarder_test_factory.ts b/contracts/integrations/test/forwarder/forwarder_test_factory.ts index fcc0b83199..3fd626eaf2 100644 --- a/contracts/integrations/test/forwarder/forwarder_test_factory.ts +++ b/contracts/integrations/test/forwarder/forwarder_test_factory.ts @@ -7,7 +7,7 @@ import { BigNumber, RevertError } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { Actor, FeeRecipient, Maker } from '../actors'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; // Necessary bookkeeping to validate Forwarder results interface ForwarderFillState { diff --git a/contracts/integrations/test/framework-unit-tests/deployment_manager_test.ts b/contracts/integrations/test/framework-unit-tests/deployment_manager_test.ts index c94a6ab557..7a570471be 100644 --- a/contracts/integrations/test/framework-unit-tests/deployment_manager_test.ts +++ b/contracts/integrations/test/framework-unit-tests/deployment_manager_test.ts @@ -1,8 +1,8 @@ import { constants as stakingConstants } from '@0x/contracts-staking'; import { blockchainTests, expect } from '@0x/contracts-test-utils'; -import { DeploymentManager } from '../utils/deployment_manager'; -import { Authorizable, Ownable } from '../utils/wrapper_interfaces'; +import { DeploymentManager } from '../../src/deployment_manager'; +import { Authorizable, Ownable } from '../../src/wrapper_interfaces'; blockchainTests('Deployment Manager', env => { let owner: string; diff --git a/contracts/integrations/test/framework-unit-tests/function_assertion_test.ts b/contracts/integrations/test/framework-unit-tests/function_assertion_test.ts index f7e639d655..4d5175e70a 100644 --- a/contracts/integrations/test/framework-unit-tests/function_assertion_test.ts +++ b/contracts/integrations/test/framework-unit-tests/function_assertion_test.ts @@ -2,7 +2,7 @@ import { blockchainTests, constants, expect, filterLogsToArguments, getRandomInt import { BigNumber, StringRevertError } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { FunctionAssertion, Result } from '../utils/function_assertions'; +import { FunctionAssertion, Result } from '../../src/function_assertions'; import { artifacts } from '../artifacts'; import { TestFrameworkContract, TestFrameworkEventEventArgs, TestFrameworkEvents } from '../wrappers'; diff --git a/contracts/integrations/test/internal-integration-tests/deployment_test.ts b/contracts/integrations/test/internal-integration-tests/deployment_test.ts index 2cf46eb373..d5845a6192 100644 --- a/contracts/integrations/test/internal-integration-tests/deployment_test.ts +++ b/contracts/integrations/test/internal-integration-tests/deployment_test.ts @@ -33,7 +33,7 @@ import { AssetProxyId } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { TxData } from 'ethereum-types'; -import { AssetProxyDispatcher, Authorizable, Ownable } from '../utils/wrapper_interfaces'; +import { AssetProxyDispatcher, Authorizable, Ownable } from '../../src/wrapper_interfaces'; // tslint:disable:no-unnecessary-type-assertion blockchainTests('Deployment and Configuration End to End Tests', env => { diff --git a/contracts/integrations/test/internal-integration-tests/exchange_wrapper_test.ts b/contracts/integrations/test/internal-integration-tests/exchange_wrapper_test.ts index dbeed40f75..11059fc115 100644 --- a/contracts/integrations/test/internal-integration-tests/exchange_wrapper_test.ts +++ b/contracts/integrations/test/internal-integration-tests/exchange_wrapper_test.ts @@ -30,7 +30,7 @@ import * as _ from 'lodash'; import { Actor } from '../actors/base'; import { Maker } from '../actors/maker'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; const { addFillResults, safeGetPartialAmountFloor } = ReferenceFunctions; diff --git a/contracts/integrations/test/internal-integration-tests/fillorder_test.ts b/contracts/integrations/test/internal-integration-tests/fillorder_test.ts index ed22b09206..5ae42df1f2 100644 --- a/contracts/integrations/test/internal-integration-tests/fillorder_test.ts +++ b/contracts/integrations/test/internal-integration-tests/fillorder_test.ts @@ -21,7 +21,7 @@ import { BigNumber } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { actorAddressesByName, FeeRecipient, Maker, OperatorStakerMaker, StakerKeeper, Taker } from '../actors'; -import { DeploymentManager } from '../utils/deployment_manager'; +import { DeploymentManager } from '../../src/deployment_manager'; const devUtils = new DevUtilsContract(constants.NULL_ADDRESS, provider); blockchainTests.resets('fillOrder integration tests', env => { diff --git a/contracts/staking/test/utils/constants.ts b/contracts/staking/src/constants.ts similarity index 100% rename from contracts/staking/test/utils/constants.ts rename to contracts/staking/src/constants.ts diff --git a/contracts/staking/src/index.ts b/contracts/staking/src/index.ts index 8fe6f0eff3..4369c93603 100644 --- a/contracts/staking/src/index.ts +++ b/contracts/staking/src/index.ts @@ -1,4 +1,4 @@ export * from './wrappers'; export * from './artifacts'; -export { constants } from '../test/utils/constants'; -export { StakeInfo, StakeStatus } from '../test/utils/types'; +export { constants } from './constants'; +export { StakeInfo, StakeStatus } from './types'; diff --git a/contracts/staking/test/utils/types.ts b/contracts/staking/src/types.ts similarity index 100% rename from contracts/staking/test/utils/types.ts rename to contracts/staking/src/types.ts diff --git a/contracts/staking/test/actors/finalizer_actor.ts b/contracts/staking/test/actors/finalizer_actor.ts index 2d2e099b3c..ef2400e99b 100644 --- a/contracts/staking/test/actors/finalizer_actor.ts +++ b/contracts/staking/test/actors/finalizer_actor.ts @@ -12,7 +12,7 @@ import { OperatorShareByPoolId, RewardBalanceByPoolId, RewardByPoolId, -} from '../utils/types'; +} from '../../src/types'; import { BaseActor } from './base_actor'; diff --git a/contracts/staking/test/actors/staker_actor.ts b/contracts/staking/test/actors/staker_actor.ts index 469f235730..ab5413c1f3 100644 --- a/contracts/staking/test/actors/staker_actor.ts +++ b/contracts/staking/test/actors/staker_actor.ts @@ -3,7 +3,7 @@ import { BigNumber, RevertError } from '@0x/utils'; import * as _ from 'lodash'; import { StakingApiWrapper } from '../utils/api_wrapper'; -import { StakeBalances, StakeInfo, StakeStatus, StoredBalance } from '../utils/types'; +import { StakeBalances, StakeInfo, StakeStatus, StoredBalance } from '../../src/types'; import { BaseActor } from './base_actor'; diff --git a/contracts/staking/test/epoch_test.ts b/contracts/staking/test/epoch_test.ts index ab5d470f34..978ad0126a 100644 --- a/contracts/staking/test/epoch_test.ts +++ b/contracts/staking/test/epoch_test.ts @@ -3,7 +3,7 @@ import { blockchainTests, expect } from '@0x/contracts-test-utils'; import * as _ from 'lodash'; import { deployAndConfigureContractsAsync, StakingApiWrapper } from './utils/api_wrapper'; -import { constants as stakingConstants } from './utils/constants'; +import { constants as stakingConstants } from '../src/constants'; // tslint:disable:no-unnecessary-type-assertion blockchainTests('Epochs', env => { diff --git a/contracts/staking/test/migration_test.ts b/contracts/staking/test/migration_test.ts index fa67d56d82..614e7f6bef 100644 --- a/contracts/staking/test/migration_test.ts +++ b/contracts/staking/test/migration_test.ts @@ -13,7 +13,7 @@ import { import { artifacts } from './artifacts'; -import { constants as stakingConstants } from './utils/constants'; +import { constants as stakingConstants } from '../src/constants'; blockchainTests('Migration tests', env => { let authorizedAddress: string; diff --git a/contracts/staking/test/pools_test.ts b/contracts/staking/test/pools_test.ts index 7dc69c08c8..89e7c5417f 100644 --- a/contracts/staking/test/pools_test.ts +++ b/contracts/staking/test/pools_test.ts @@ -6,7 +6,7 @@ import * as _ from 'lodash'; import { MakerActor } from './actors/maker_actor'; import { PoolOperatorActor } from './actors/pool_operator_actor'; import { deployAndConfigureContractsAsync, StakingApiWrapper } from './utils/api_wrapper'; -import { constants as stakingConstants } from './utils/constants'; +import { constants as stakingConstants } from '../src/constants'; // tslint:disable:no-unnecessary-type-assertion // tslint:disable:max-file-line-count diff --git a/contracts/staking/test/unit_tests/finalizer_test.ts b/contracts/staking/test/unit_tests/finalizer_test.ts index 5653bf8210..41a00af73d 100644 --- a/contracts/staking/test/unit_tests/finalizer_test.ts +++ b/contracts/staking/test/unit_tests/finalizer_test.ts @@ -13,7 +13,7 @@ import { LogEntry } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { constants as stakingConstants } from '../utils/constants'; +import { constants as stakingConstants } from '.../src/constants'; import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils'; import { diff --git a/contracts/staking/test/unit_tests/mixin_cumulative_rewards_test.ts b/contracts/staking/test/unit_tests/mixin_cumulative_rewards_test.ts index da70af2c8a..657e0eef4e 100644 --- a/contracts/staking/test/unit_tests/mixin_cumulative_rewards_test.ts +++ b/contracts/staking/test/unit_tests/mixin_cumulative_rewards_test.ts @@ -2,7 +2,7 @@ import { blockchainTests, expect } from '@0x/contracts-test-utils'; import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; -import { constants as stakingConstants } from '../utils/constants'; +import { constants as stakingConstants } from '.../src/constants'; import { toBaseUnitAmount } 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 6e2e702440..d0edd90f2e 100644 --- a/contracts/staking/test/unit_tests/mixin_scheduler_test.ts +++ b/contracts/staking/test/unit_tests/mixin_scheduler_test.ts @@ -3,7 +3,7 @@ import { StakingRevertErrors } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; import { LogWithDecodedArgs } from 'ethereum-types'; -import { constants as stakingConstants } from '../utils/constants'; +import { constants as stakingConstants } from '.../src/constants'; import { artifacts } from '../artifacts'; import { diff --git a/contracts/staking/test/unit_tests/mixin_stake_storage_test.ts b/contracts/staking/test/unit_tests/mixin_stake_storage_test.ts index 31a5e186e1..0e8b5a2965 100644 --- a/contracts/staking/test/unit_tests/mixin_stake_storage_test.ts +++ b/contracts/staking/test/unit_tests/mixin_stake_storage_test.ts @@ -2,8 +2,8 @@ import { blockchainTests, expect, Numberish } from '@0x/contracts-test-utils'; import { StakingRevertErrors } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; -import { constants } from '../utils/constants'; -import { StoredBalance } from '../utils/types'; +import { constants } from '.../src/constants'; +import { StoredBalance } from '../../src/types'; import { artifacts } from '../artifacts'; import { TestMixinStakeStorageContract } from '../wrappers'; diff --git a/contracts/staking/test/unit_tests/mixin_staking_pool_rewards.ts b/contracts/staking/test/unit_tests/mixin_staking_pool_rewards.ts index d2b84a0ec4..a125b9d90b 100644 --- a/contracts/staking/test/unit_tests/mixin_staking_pool_rewards.ts +++ b/contracts/staking/test/unit_tests/mixin_staking_pool_rewards.ts @@ -14,7 +14,7 @@ import { import { BigNumber } from '@0x/utils'; import { LogEntry, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { StoredBalance } from '../utils/types'; +import { StoredBalance } from '../../src/types'; import { artifacts } from '../artifacts'; import { TestMixinStakingPoolRewardsContract, TestMixinStakingPoolRewardsEvents as Events } from '../wrappers'; diff --git a/contracts/staking/test/unit_tests/params_test.ts b/contracts/staking/test/unit_tests/params_test.ts index ebca87e66a..3a1b1a9d0a 100644 --- a/contracts/staking/test/unit_tests/params_test.ts +++ b/contracts/staking/test/unit_tests/params_test.ts @@ -6,8 +6,8 @@ import * as _ from 'lodash'; import { artifacts } from '../artifacts'; import { IStakingEventsParamsSetEventArgs, TestMixinParamsContract } from '../wrappers'; -import { constants as stakingConstants } from '../utils/constants'; -import { StakingParams } from '../utils/types'; +import { constants as stakingConstants } from '.../src/constants'; +import { StakingParams } from '../../src/types'; blockchainTests('Configurable Parameters unit tests', env => { let testContract: TestMixinParamsContract; diff --git a/contracts/staking/test/unit_tests/stake_balances_test.ts b/contracts/staking/test/unit_tests/stake_balances_test.ts index 7e6b50db63..688a1e5988 100644 --- a/contracts/staking/test/unit_tests/stake_balances_test.ts +++ b/contracts/staking/test/unit_tests/stake_balances_test.ts @@ -11,8 +11,8 @@ import { BigNumber, SafeMathRevertErrors } from '@0x/utils'; import { artifacts } from '../artifacts'; import { TestMixinStakeBalancesContract } from '../wrappers'; -import { constants as stakingConstants } from '../utils/constants'; -import { StakeStatus, StoredBalance } from '../utils/types'; +import { constants as stakingConstants } from '.../src/constants'; +import { StakeStatus, StoredBalance } from '../../src/types'; blockchainTests.resets('MixinStakeBalances unit tests', env => { let testContract: TestMixinStakeBalancesContract; diff --git a/contracts/staking/test/unit_tests/stake_test.ts b/contracts/staking/test/unit_tests/stake_test.ts index d17c212ac3..1c50d162cf 100644 --- a/contracts/staking/test/unit_tests/stake_test.ts +++ b/contracts/staking/test/unit_tests/stake_test.ts @@ -13,7 +13,7 @@ import { StakingRevertErrors } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; -import { StakeStatus } from '../utils/types'; +import { StakeStatus } from '../../src/types'; import { artifacts } from '../artifacts'; import { diff --git a/contracts/staking/test/unit_tests/staking_proxy_test.ts b/contracts/staking/test/unit_tests/staking_proxy_test.ts index 53744112da..627181b2b2 100644 --- a/contracts/staking/test/unit_tests/staking_proxy_test.ts +++ b/contracts/staking/test/unit_tests/staking_proxy_test.ts @@ -11,7 +11,7 @@ import { TestStakingProxyUnitContract, } from '../wrappers'; -import { constants as stakingConstants } from '../utils/constants'; +import { constants as stakingConstants } from '.../src/constants'; 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 e31d52e0f6..229b88181c 100644 --- a/contracts/staking/test/unit_tests/zrx_vault_test.ts +++ b/contracts/staking/test/unit_tests/zrx_vault_test.ts @@ -13,7 +13,7 @@ import { RevertReason } from '@0x/types'; import { AuthorizableRevertErrors, BigNumber, SafeMathRevertErrors } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { constants as stakingConstants } from '../utils/constants'; +import { constants as stakingConstants } from '.../src/constants'; import { artifacts } from '../artifacts'; import { diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts deleted file mode 100644 index 4fac46c6b4..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts +++ /dev/null @@ -1,207 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { - AwaitTransactionSuccessOpts, - EventCallback, - IndexedFilterValues, - SendTransactionOpts, - SimpleContractArtifact, -} from '@0x/types'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import { assert } from '@0x/assert'; -import * as ethers from 'ethers'; -// tslint:enable:no-unused-variable - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class EthBalanceCheckerContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - /** - * Batch fetches ETH balances - */ - public getEthBalances = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param addresses Array of addresses. - * @returns Array of ETH balances. - */ - async callAsync( - addresses: string[], - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - assert.isArray('addresses', addresses); - assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (defaultBlock !== undefined) { - assert.isBlockParam('defaultBlock', defaultBlock); - } - const self = (this as any) as EthBalanceCheckerContract; - const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - callDataWithDefaults.from = callDataWithDefaults.from - ? callDataWithDefaults.from.toLowerCase() - : callDataWithDefaults.from; - let rawCallResult; - try { - rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - } catch (err) { - BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): Promise { - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - if (artifact.compilerOutput === undefined) { - throw new Error('Compiler output not found in the artifact file'); - } - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; - if (Object.keys(logDecodeDependencies) !== undefined) { - for (const key of Object.keys(logDecodeDependencies)) { - logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; - } - } - return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): Promise { - assert.isHexString('bytecode', bytecode); - assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ - schemas.addressSchema, - schemas.numberSchema, - schemas.jsNumber, - ]); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`EthBalanceChecker successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new EthBalanceCheckerContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - constant: true, - inputs: [ - { - name: 'addresses', - type: 'address[]', - }, - ], - name: 'getEthBalances', - outputs: [ - { - name: '', - type: 'uint256[]', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = EthBalanceCheckerContract.deployedBytecode, - ) { - super( - 'EthBalanceChecker', - EthBalanceCheckerContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - } -} - -// tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align -// tslint:enable:trailing-comma whitespace no-trailing-whitespace