Skip to content

Commit

Permalink
Refactor contracts-* exports so none in test dir so npmignore works a…
Browse files Browse the repository at this point in the history
…s intended
  • Loading branch information
fabioberger committed Nov 11, 2019
1 parent 67e7b5c commit 6324a92
Show file tree
Hide file tree
Showing 64 changed files with 72 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
6 changes: 3 additions & 3 deletions contracts/asset-proxy/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion contracts/asset-proxy/test/erc1155_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions contracts/asset-proxy/test/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions contracts/asset-proxy/test/utils/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions contracts/coordinator/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/coordinator/test/libs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion contracts/coordinator/test/mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 0 additions & 3 deletions contracts/coordinator/test/utils/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion contracts/erc1155/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './wrappers';
export * from './artifacts';
export { Erc1155Wrapper } from '../test/utils/erc1155_wrapper';
export { Erc1155Wrapper } from './erc1155_wrapper';
2 changes: 1 addition & 1 deletion contracts/erc1155/test/erc1155_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions contracts/exchange/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
12 changes: 4 additions & 8 deletions contracts/exchange/test/assertion_wrappers/fill_order_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions contracts/exchange/test/balance_stores/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion contracts/exchange/test/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/test/signature_validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
4 changes: 3 additions & 1 deletion contracts/exchange/test/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions contracts/exchange/test/utils/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/integrations/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion contracts/integrations/test/actors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T = {}> = new (...args: any[]) => T;

Expand Down
2 changes: 1 addition & 1 deletion contracts/integrations/test/actors/taker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion contracts/integrations/test/forwarder/deploy_forwarder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion contracts/integrations/test/forwarder/forwarder_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions contracts/staking/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/staking/test/actors/finalizer_actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
OperatorShareByPoolId,
RewardBalanceByPoolId,
RewardByPoolId,
} from '../utils/types';
} from '../../src/types';

import { BaseActor } from './base_actor';

Expand Down
2 changes: 1 addition & 1 deletion contracts/staking/test/actors/staker_actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion contracts/staking/test/epoch_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion contracts/staking/test/migration_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/staking/test/pools_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/staking/test/unit_tests/finalizer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 6324a92

Please sign in to comment.