Refactor contracts-* exports so none in test dir so npmignore works as intended
This commit is contained in:
parent
67e7b5c124
commit
6324a92ec5
@ -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[];
|
@ -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[];
|
@ -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[];
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -1,3 +0,0 @@
|
||||
export * from './erc20_wrapper';
|
||||
export * from './erc721_wrapper';
|
||||
export * from './erc1155_proxy_wrapper';
|
@ -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;
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
export { hashUtils } from './hash_utils';
|
||||
export { ApprovalFactory } from './approval_factory';
|
||||
export * from './types';
|
@ -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;
|
||||
|
@ -1,3 +1,3 @@
|
||||
export * from './wrappers';
|
||||
export * from './artifacts';
|
||||
export { Erc1155Wrapper } from '../test/utils/erc1155_wrapper';
|
||||
export { Erc1155Wrapper } from './erc1155_wrapper';
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -1,4 +0,0 @@
|
||||
export { BalanceStore } from './balance_store';
|
||||
export { LocalBalanceStore } from './local_balance_store';
|
||||
export { BlockchainBalanceStore } from './blockchain_balance_store';
|
||||
export * from './types';
|
@ -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';
|
||||
|
@ -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 => {
|
||||
|
@ -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,
|
||||
|
@ -1,4 +0,0 @@
|
||||
export * from './exchange_wrapper';
|
||||
export * from './exchange_data_encoder';
|
||||
export * from './types';
|
||||
export * from './constants';
|
@ -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';
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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';
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
@ -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 => {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 => {
|
||||
|
@ -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';
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
OperatorShareByPoolId,
|
||||
RewardBalanceByPoolId,
|
||||
RewardByPoolId,
|
||||
} from '../utils/types';
|
||||
} from '../../src/types';
|
||||
|
||||
import { BaseActor } from './base_actor';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 => {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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';
|
||||
|
@ -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 {
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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!';
|
||||
|
@ -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 {
|
||||
|
@ -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<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber[]> {
|
||||
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<BigNumber[]>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
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<TxData>,
|
||||
logDecodeDependencies: { [contractName: string]: ContractAbi },
|
||||
): Promise<EthBalanceCheckerContract> {
|
||||
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<TxData>,
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user