Fix remaining build issues

This commit is contained in:
fabioberger 2019-11-11 00:13:44 +00:00
parent f011be9347
commit 15a5bc02ef
50 changed files with 369 additions and 133 deletions

View File

@ -36,7 +36,7 @@
"compile:truffle": "truffle compile"
},
"config": {
"abis": "./generated-artifacts/@(Coordinator|CoordinatorRegistry|ICoordinatorApprovalVerifier|ICoordinatorCore|ICoordinatorRegistryCore|ICoordinatorSignatureValidator|LibConstants|LibCoordinatorApproval|LibCoordinatorRichErrors|LibEIP712CoordinatorDomain|MixinCoordinatorApprovalVerifier|MixinCoordinatorCore|MixinCoordinatorRegistryCore|MixinSignatureValidator).json",
"abis": "./test/generated-artifacts/@(Coordinator|CoordinatorRegistry|ICoordinatorApprovalVerifier|ICoordinatorCore|ICoordinatorRegistryCore|ICoordinatorSignatureValidator|LibConstants|LibCoordinatorApproval|LibCoordinatorRichErrors|LibEIP712CoordinatorDomain|MixinCoordinatorApprovalVerifier|MixinCoordinatorCore|MixinCoordinatorRegistryCore|MixinSignatureValidator).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {

View File

@ -0,0 +1,37 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
import { ContractArtifact } from 'ethereum-types';
import * as Coordinator from '../test/generated-artifacts/Coordinator.json';
import * as CoordinatorRegistry from '../test/generated-artifacts/CoordinatorRegistry.json';
import * as ICoordinatorApprovalVerifier from '../test/generated-artifacts/ICoordinatorApprovalVerifier.json';
import * as ICoordinatorCore from '../test/generated-artifacts/ICoordinatorCore.json';
import * as ICoordinatorRegistryCore from '../test/generated-artifacts/ICoordinatorRegistryCore.json';
import * as ICoordinatorSignatureValidator from '../test/generated-artifacts/ICoordinatorSignatureValidator.json';
import * as LibConstants from '../test/generated-artifacts/LibConstants.json';
import * as LibCoordinatorApproval from '../test/generated-artifacts/LibCoordinatorApproval.json';
import * as LibCoordinatorRichErrors from '../test/generated-artifacts/LibCoordinatorRichErrors.json';
import * as LibEIP712CoordinatorDomain from '../test/generated-artifacts/LibEIP712CoordinatorDomain.json';
import * as MixinCoordinatorApprovalVerifier from '../test/generated-artifacts/MixinCoordinatorApprovalVerifier.json';
import * as MixinCoordinatorCore from '../test/generated-artifacts/MixinCoordinatorCore.json';
import * as MixinCoordinatorRegistryCore from '../test/generated-artifacts/MixinCoordinatorRegistryCore.json';
import * as MixinSignatureValidator from '../test/generated-artifacts/MixinSignatureValidator.json';
export const artifacts = {
Coordinator: Coordinator as ContractArtifact,
MixinCoordinatorApprovalVerifier: MixinCoordinatorApprovalVerifier as ContractArtifact,
MixinCoordinatorCore: MixinCoordinatorCore as ContractArtifact,
MixinSignatureValidator: MixinSignatureValidator as ContractArtifact,
ICoordinatorApprovalVerifier: ICoordinatorApprovalVerifier as ContractArtifact,
ICoordinatorCore: ICoordinatorCore as ContractArtifact,
ICoordinatorSignatureValidator: ICoordinatorSignatureValidator as ContractArtifact,
LibConstants: LibConstants as ContractArtifact,
LibCoordinatorApproval: LibCoordinatorApproval as ContractArtifact,
LibCoordinatorRichErrors: LibCoordinatorRichErrors as ContractArtifact,
LibEIP712CoordinatorDomain: LibEIP712CoordinatorDomain as ContractArtifact,
CoordinatorRegistry: CoordinatorRegistry as ContractArtifact,
MixinCoordinatorRegistryCore: MixinCoordinatorRegistryCore as ContractArtifact,
ICoordinatorRegistryCore: ICoordinatorRegistryCore as ContractArtifact,
};

View File

@ -1,7 +1,8 @@
import { constants as exchangeConstants, exchangeDataEncoder, ExchangeFunctionName } from '@0x/contracts-exchange';
import { exchangeDataEncoder } from '@0x/contracts-exchange';
import {
blockchainTests,
constants,
ExchangeFunctionName,
expect,
hexConcat,
hexSlice,
@ -144,7 +145,7 @@ blockchainTests.resets('Mixins tests', env => {
});
describe('decodeOrdersFromFillData', () => {
for (const fnName of exchangeConstants.SINGLE_FILL_FN_NAMES) {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -158,7 +159,7 @@ blockchainTests.resets('Mixins tests', env => {
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of exchangeConstants.BATCH_FILL_FN_NAMES) {
for (const fnName of constants.BATCH_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -172,7 +173,7 @@ blockchainTests.resets('Mixins tests', env => {
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of exchangeConstants.MARKET_FILL_FN_NAMES) {
for (const fnName of constants.MARKET_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -186,7 +187,7 @@ blockchainTests.resets('Mixins tests', env => {
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of exchangeConstants.MATCH_ORDER_FN_NAMES) {
for (const fnName of constants.MATCH_ORDER_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -200,7 +201,7 @@ blockchainTests.resets('Mixins tests', env => {
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of exchangeConstants.CANCEL_ORDER_FN_NAMES) {
for (const fnName of constants.CANCEL_ORDER_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -227,7 +228,7 @@ blockchainTests.resets('Mixins tests', env => {
});
describe('Single order approvals', () => {
for (const fnName of exchangeConstants.SINGLE_FILL_FN_NAMES) {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
@ -341,9 +342,9 @@ blockchainTests.resets('Mixins tests', env => {
});
describe('Batch order approvals', () => {
for (const fnName of [
...exchangeConstants.BATCH_FILL_FN_NAMES,
...exchangeConstants.MARKET_FILL_FN_NAMES,
...exchangeConstants.MATCH_ORDER_FN_NAMES,
...constants.BATCH_FILL_FN_NAMES,
...constants.MARKET_FILL_FN_NAMES,
...constants.MATCH_ORDER_FN_NAMES,
]) {
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver1], approval_sig=[approver1]`, async () => {
const orders = [defaultOrder, defaultOrder];

View File

@ -0,0 +1,19 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../test/generated-wrappers/coordinator';
export * from '../test/generated-wrappers/coordinator_registry';
export * from '../test/generated-wrappers/i_coordinator_approval_verifier';
export * from '../test/generated-wrappers/i_coordinator_core';
export * from '../test/generated-wrappers/i_coordinator_registry_core';
export * from '../test/generated-wrappers/i_coordinator_signature_validator';
export * from '../test/generated-wrappers/lib_constants';
export * from '../test/generated-wrappers/lib_coordinator_approval';
export * from '../test/generated-wrappers/lib_coordinator_rich_errors';
export * from '../test/generated-wrappers/lib_e_i_p712_coordinator_domain';
export * from '../test/generated-wrappers/mixin_coordinator_approval_verifier';
export * from '../test/generated-wrappers/mixin_coordinator_core';
export * from '../test/generated-wrappers/mixin_coordinator_registry_core';
export * from '../test/generated-wrappers/mixin_signature_validator';

View File

@ -16,7 +16,21 @@
"generated-artifacts/MixinCoordinatorApprovalVerifier.json",
"generated-artifacts/MixinCoordinatorCore.json",
"generated-artifacts/MixinCoordinatorRegistryCore.json",
"generated-artifacts/MixinSignatureValidator.json"
"generated-artifacts/MixinSignatureValidator.json",
"test/generated-artifacts/Coordinator.json",
"test/generated-artifacts/CoordinatorRegistry.json",
"test/generated-artifacts/ICoordinatorApprovalVerifier.json",
"test/generated-artifacts/ICoordinatorCore.json",
"test/generated-artifacts/ICoordinatorRegistryCore.json",
"test/generated-artifacts/ICoordinatorSignatureValidator.json",
"test/generated-artifacts/LibConstants.json",
"test/generated-artifacts/LibCoordinatorApproval.json",
"test/generated-artifacts/LibCoordinatorRichErrors.json",
"test/generated-artifacts/LibEIP712CoordinatorDomain.json",
"test/generated-artifacts/MixinCoordinatorApprovalVerifier.json",
"test/generated-artifacts/MixinCoordinatorCore.json",
"test/generated-artifacts/MixinCoordinatorRegistryCore.json",
"test/generated-artifacts/MixinSignatureValidator.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}

View File

@ -35,7 +35,7 @@
"compile:truffle": "truffle compile"
},
"config": {
"abis": "./generated-artifacts/@(Forwarder|IAssets|IForwarder|IForwarderCore|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinWeth).json",
"abis": "./test/generated-artifacts/@(Forwarder|IAssets|IForwarder|IForwarderCore|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinWeth).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {

View File

@ -0,0 +1,29 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
import { ContractArtifact } from 'ethereum-types';
import * as Forwarder from '../test/generated-artifacts/Forwarder.json';
import * as IAssets from '../test/generated-artifacts/IAssets.json';
import * as IForwarder from '../test/generated-artifacts/IForwarder.json';
import * as IForwarderCore from '../test/generated-artifacts/IForwarderCore.json';
import * as LibConstants from '../test/generated-artifacts/LibConstants.json';
import * as LibForwarderRichErrors from '../test/generated-artifacts/LibForwarderRichErrors.json';
import * as MixinAssets from '../test/generated-artifacts/MixinAssets.json';
import * as MixinExchangeWrapper from '../test/generated-artifacts/MixinExchangeWrapper.json';
import * as MixinForwarderCore from '../test/generated-artifacts/MixinForwarderCore.json';
import * as MixinWeth from '../test/generated-artifacts/MixinWeth.json';
export const artifacts = {
Forwarder: Forwarder as ContractArtifact,
MixinAssets: MixinAssets as ContractArtifact,
MixinExchangeWrapper: MixinExchangeWrapper as ContractArtifact,
MixinForwarderCore: MixinForwarderCore as ContractArtifact,
MixinWeth: MixinWeth as ContractArtifact,
IAssets: IAssets as ContractArtifact,
IForwarder: IForwarder as ContractArtifact,
IForwarderCore: IForwarderCore as ContractArtifact,
LibConstants: LibConstants as ContractArtifact,
LibForwarderRichErrors: LibForwarderRichErrors as ContractArtifact,
};

View File

@ -0,0 +1,15 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../test/generated-wrappers/forwarder';
export * from '../test/generated-wrappers/i_assets';
export * from '../test/generated-wrappers/i_forwarder';
export * from '../test/generated-wrappers/i_forwarder_core';
export * from '../test/generated-wrappers/lib_constants';
export * from '../test/generated-wrappers/lib_forwarder_rich_errors';
export * from '../test/generated-wrappers/mixin_assets';
export * from '../test/generated-wrappers/mixin_exchange_wrapper';
export * from '../test/generated-wrappers/mixin_forwarder_core';
export * from '../test/generated-wrappers/mixin_weth';

View File

@ -12,7 +12,17 @@
"generated-artifacts/MixinAssets.json",
"generated-artifacts/MixinExchangeWrapper.json",
"generated-artifacts/MixinForwarderCore.json",
"generated-artifacts/MixinWeth.json"
"generated-artifacts/MixinWeth.json",
"test/generated-artifacts/Forwarder.json",
"test/generated-artifacts/IAssets.json",
"test/generated-artifacts/IForwarder.json",
"test/generated-artifacts/IForwarderCore.json",
"test/generated-artifacts/LibConstants.json",
"test/generated-artifacts/LibForwarderRichErrors.json",
"test/generated-artifacts/MixinAssets.json",
"test/generated-artifacts/MixinExchangeWrapper.json",
"test/generated-artifacts/MixinForwarderCore.json",
"test/generated-artifacts/MixinWeth.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}

View File

@ -1,5 +1,4 @@
export * from './artifacts';
export * from './wrappers';
export * from '../test/balance_stores';
export * from '../test/utils';
export * from './wrapper_interfaces';
export * from '../test/utils/exchange_data_encoder';

View File

@ -17,13 +17,14 @@ import * as _ from 'lodash';
import {
BalanceStore,
BlockchainBalanceStore,
ExchangeContract,
LocalBalanceStore,
TokenContractsByName,
TokenIds,
TokenOwnersByName,
} from '../../src';
import { ExchangeContract } from '../wrappers';
export class FillOrderWrapper {
private readonly _blockchainBalanceStore: BlockchainBalanceStore;

View File

@ -41,16 +41,21 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import { Erc1155Wrapper } from '../../erc1155/lib/src';
import {
ExchangeWrapper,
ValidatorWalletAction,
} from './utils';
import {
artifacts,
} from './artifacts';
import { FillOrderWrapper } from './assertion_wrappers/fill_order_wrapper';
import {
ExchangeCancelEventArgs,
ExchangeContract,
ExchangeWrapper,
TestValidatorWalletContract,
ValidatorWalletAction,
} from '../src';
import { FillOrderWrapper } from './assertion_wrappers/fill_order_wrapper';
} from './wrappers';
// tslint:disable:no-unnecessary-type-assertion
blockchainTests.resets('Exchange core', () => {

View File

@ -24,11 +24,11 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import {
artifacts,
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
TestAssetProxyDispatcherContract,
} from '../src';
} from './wrappers';
import { dependencyArtifacts } from './utils/dependency_artifacts';

View File

@ -7,12 +7,12 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import {
artifacts,
TestExchangeInternalsContract,
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
TestExchangeInternalsFillEventArgs,
} from '../src';
} from './wrappers';
blockchainTests('Exchange core internal functions', env => {
const CHAIN_ID = 1337;

View File

@ -11,7 +11,8 @@ import { ExchangeRevertErrors, generatePseudoRandomSalt } from '@0x/order-utils'
import { BigNumber, RevertError } from '@0x/utils';
import * as _ from 'lodash';
import { artifacts, TestLibExchangeRichErrorDecoderContract } from '../src';
import { artifacts } from './artifacts';
import { TestLibExchangeRichErrorDecoderContract } from './wrappers';
blockchainTests.resets('LibExchangeRichErrorDecoder', ({ provider, txDefaults }) => {
const ASSET_PROXY_ID_LENGTH = 4;

View File

@ -30,7 +30,12 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
import { artifacts, ExchangeContract, ExchangeWrapper } from '../src';
import { ExchangeWrapper } from './utils/exchange_wrapper';
import { artifacts } from './artifacts';
import {
ExchangeContract,
} from './wrappers';
import { MatchOrderTester, TokenBalances } from './utils/match_order_tester';

View File

@ -1,7 +1,8 @@
import { blockchainTests } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { artifacts, TestProtocolFeesContract, TestProtocolFeesReceiverContract } from '../src';
import { artifacts } from './artifacts';
import { TestProtocolFeesContract, TestProtocolFeesReceiverContract} from './wrappers';
// The contents of this test suite does not inform the reader about the assertions made in these
// tests. For more information and a more accurate view of the tests, check out

View File

@ -2,12 +2,12 @@ import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { BigNumber, OwnableRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import { artifacts } from './artifacts';
import {
artifacts,
ExchangeContract,
ExchangeProtocolFeeCollectorAddressEventArgs,
ExchangeProtocolFeeMultiplierEventArgs,
} from '../src';
} from './wrappers';
blockchainTests.resets('MixinProtocolFees', env => {
let accounts: string[];

View File

@ -3,7 +3,8 @@ import { BigNumber } from '@0x/utils';
import { DataItem, MethodAbi, TupleDataItem } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, ReentrancyTesterContract } from '../src';
import { artifacts } from './artifacts';
import { ReentrancyTesterContract} from './wrappers';
import { constants as TestConstants } from './utils/constants';

View File

@ -17,13 +17,13 @@ import { BigNumber, StringRevertError } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import { artifacts } from './artifacts';
import {
artifacts,
IEIP1271DataContract,
TestSignatureValidatorContract,
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
TestValidatorWalletContract,
} from '../src';
} from './wrappers';
import { ValidatorWalletAction } from './utils';

View File

@ -6,6 +6,7 @@ import {
blockchainTests,
constants,
describe,
ExchangeFunctionName,
expect,
getLatestBlockTimestampAsync,
OrderFactory,
@ -18,19 +19,16 @@ import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { artifacts as localArtifacts } from './artifacts';
import { exchangeDataEncoder, ExchangeWrapper } from './utils';
import {
artifacts as localArtifacts,
constants as exchangeConstants,
ExchangeCancelEventArgs,
ExchangeCancelUpToEventArgs,
ExchangeContract,
exchangeDataEncoder,
ExchangeFillEventArgs,
ExchangeFunctionName,
ExchangeSignatureValidatorApprovalEventArgs,
ExchangeTransactionExecutionEventArgs,
ExchangeWrapper,
} from '../src/';
} from './wrappers';
const artifacts = { ...erc20Artifacts, ...localArtifacts };
@ -210,9 +208,9 @@ blockchainTests.resets('Exchange transactions', env => {
});
describe('fill methods', () => {
for (const fnName of [
...exchangeConstants.SINGLE_FILL_FN_NAMES,
...exchangeConstants.BATCH_FILL_FN_NAMES,
...exchangeConstants.MARKET_FILL_FN_NAMES,
...constants.SINGLE_FILL_FN_NAMES,
...constants.BATCH_FILL_FN_NAMES,
...constants.MARKET_FILL_FN_NAMES,
]) {
it(`${fnName} should revert if signature is invalid and not called by signer`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
@ -301,7 +299,7 @@ blockchainTests.resets('Exchange transactions', env => {
const decodedReturnData = abiEncoder.decodeReturnValues(returnData);
const fillResults =
exchangeConstants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1
constants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1
? decodedReturnData.fillResults[0]
: decodedReturnData.fillResults;

View File

@ -5,7 +5,11 @@ import { BigNumber, StringRevertError } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, TestTransactionsContract, TestTransactionsTransactionExecutionEventArgs } from '../src';
import { artifacts } from './artifacts';
import {
TestTransactionsContract,
TestTransactionsTransactionExecutionEventArgs,
} from './wrappers';
blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDefaults }) => {
let transactionsContract: TestTransactionsContract;

View File

@ -1,4 +1,4 @@
import { ExchangeFunctionName } from './types';
import { ExchangeFunctionName } from '@0x/contracts-test-utils';
export const constants = {
// These are functions not secured by the `nonReentrant`, directly or
@ -13,28 +13,6 @@ export const constants = {
ExchangeFunctionName.SetProtocolFeeCollectorAddress,
ExchangeFunctionName.DetachProtocolFeeCollector,
],
SINGLE_FILL_FN_NAMES: [ExchangeFunctionName.FillOrder, ExchangeFunctionName.FillOrKillOrder],
BATCH_FILL_FN_NAMES: [
ExchangeFunctionName.BatchFillOrders,
ExchangeFunctionName.BatchFillOrKillOrders,
ExchangeFunctionName.BatchFillOrdersNoThrow,
],
MARKET_FILL_FN_NAMES: [
ExchangeFunctionName.MarketBuyOrdersFillOrKill,
ExchangeFunctionName.MarketSellOrdersFillOrKill,
ExchangeFunctionName.MarketBuyOrdersNoThrow,
ExchangeFunctionName.MarketSellOrdersNoThrow,
],
MATCH_ORDER_FN_NAMES: [ExchangeFunctionName.MatchOrders, ExchangeFunctionName.MatchOrdersWithMaximalFill],
BATCH_MATCH_ORDER_FN_NAMES: [
ExchangeFunctionName.BatchMatchOrders,
ExchangeFunctionName.BatchMatchOrdersWithMaximalFill,
],
CANCEL_ORDER_FN_NAMES: [
ExchangeFunctionName.CancelOrder,
ExchangeFunctionName.BatchCancelOrders,
ExchangeFunctionName.CancelOrdersUpTo,
],
};
export enum ValidatorWalletAction {

View File

@ -1,33 +1,33 @@
import { constants, provider } from '@0x/contracts-test-utils';
import { constants, ExchangeFunctionName, provider } from '@0x/contracts-test-utils';
import { orderHashUtils } from '@0x/order-utils';
import { SignedOrder } from '@0x/types';
import { constants as exchangeConstants, ExchangeFunctionName, IExchangeContract } from '../../src';
import { IExchangeContract } from '../wrappers';
export const exchangeDataEncoder = {
encodeOrdersToExchangeData(fnName: ExchangeFunctionName, orders: SignedOrder[] = []): string {
const exchangeInstance = new IExchangeContract(constants.NULL_ADDRESS, provider);
let data;
if (exchangeConstants.SINGLE_FILL_FN_NAMES.indexOf(fnName) !== -1) {
if (constants.SINGLE_FILL_FN_NAMES.indexOf(fnName) !== -1) {
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders[0],
orders[0].takerAssetAmount,
orders[0].signature,
);
} else if (exchangeConstants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1) {
} else if (constants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1) {
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders,
orders.map(order => order.takerAssetAmount),
orders.map(order => order.signature),
);
} else if (exchangeConstants.MARKET_FILL_FN_NAMES.indexOf(fnName) !== -1) {
} else if (constants.MARKET_FILL_FN_NAMES.indexOf(fnName) !== -1) {
const fillAsset = /Buy/.test(fnName) ? 'makerAssetAmount' : 'takerAssetAmount';
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders,
orders.map(order => order[fillAsset]).reduce((prev, curr) => prev.plus(curr)),
orders.map(order => order.signature),
);
} else if (exchangeConstants.MATCH_ORDER_FN_NAMES.indexOf(fnName) !== -1) {
} else if (constants.MATCH_ORDER_FN_NAMES.indexOf(fnName) !== -1) {
data = exchangeInstance.matchOrders.getABIEncodedTransactionData(
orders[0],
orders[1],

View File

@ -11,7 +11,7 @@ import { AbiEncoder, BigNumber } from '@0x/utils';
import { MethodAbi, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { ExchangeContract } from '../../src';
import { ExchangeContract } from '../wrappers';
import { AbiDecodedFillOrderData } from './types';

View File

@ -15,7 +15,9 @@ import { LogWithDecodedArgs, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
import { artifacts, ExchangeContract, ExchangeFillEventArgs } from '../../src';
import { artifacts } from '../artifacts';
import { ExchangeContract, ExchangeFillEventArgs } from '../wrappers';
import { AssetWrapper } from './asset_wrapper';
import { ExchangeWrapper } from './exchange_wrapper';

View File

@ -12,12 +12,13 @@ import { TxData, Web3Wrapper } from '@0x/web3-wrapper';
import * as crypto from 'crypto';
import { LogEntry } from 'ethereum-types';
import { artifacts } from '../artifacts';
import {
artifacts,
IsolatedExchangeContract,
IsolatedExchangeDispatchTransferFromCalledEventArgs as DispatchTransferFromCallArgs,
IsolatedExchangeFillEventArgs as FillEventArgs,
} from '../../src';
} from '../wrappers';
export interface AssetBalances {
[assetData: string]: { [address: string]: BigNumber };

View File

@ -36,3 +36,13 @@ export enum ExchangeFunctionName {
SetProtocolFeeCollectorAddress = 'setProtocolFeeCollectorAddress',
DetachProtocolFeeCollector = 'detachProtocolFeeCollector',
}
export enum TradeSide {
Maker = 'maker',
Taker = 'taker',
}
export enum TransferType {
Trade = 'trade',
Fee = 'fee',
}

View File

@ -16,12 +16,12 @@ import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
import * as ethjs from 'ethereumjs-util';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import {
artifacts,
TestWrapperFunctionsCancelOrderCalledEventArgs as CancelOrderCalledEventArgs,
TestWrapperFunctionsContract,
TestWrapperFunctionsFillOrderCalledEventArgs as FillOrderCalledEventArgs,
} from '../src';
} from './wrappers';
blockchainTests('Exchange wrapper functions unit tests.', env => {
const CHAIN_ID = 0x74657374;

View File

@ -77,7 +77,6 @@
"@0x/contracts-dev-utils": "^0.1.0-beta.1",
"@0x/contracts-erc20": "^2.3.0-beta.1",
"@0x/contracts-erc721": "^2.2.0-beta.1",
"@0x/contracts-exchange": "^2.2.0-beta.1",
"@0x/contracts-exchange-libs": "^3.1.0-beta.1",
"@0x/contracts-utils": "^3.3.0-beta.1",
"@0x/order-utils": "^8.5.0-beta.1",

View File

@ -1,5 +1,5 @@
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import { ExchangeContract } from '@0x/contracts-exchange';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { ExchangeRevertErrors } from '@0x/order-utils';
import { Order, RevertReason, SignedOrder } from '@0x/types';
@ -52,7 +52,6 @@ describe(ContractName.BalanceThresholdFilter, () => {
let zrxAssetData: string;
let zrxToken: DummyERC20TokenContract;
let exchangeInstance: ExchangeContract;
let exchangeWrapper: ExchangeWrapper;
let devUtils: DevUtilsContract;
let orderFactory: OrderFactory;
@ -139,9 +138,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
zrxAssetData,
new BigNumber(chainId),
);
exchangeWrapper = new ExchangeWrapper(exchangeInstance);
// Register proxies
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
erc20Proxy.address,
{
from: owner,
},
);
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
from: owner,
});

View File

@ -2,7 +2,7 @@ import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import { ExchangeContract } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@ -98,9 +98,18 @@ describe(ContractName.DutchAuction, () => {
zrxAssetData,
new BigNumber(chainId),
);
const exchangeWrapper = new ExchangeWrapper(exchangeInstance);
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
erc20Proxy.address,
{
from: owner,
},
);
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
erc721Proxy.address,
{
from: owner,
},
);
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
from: owner,

View File

@ -7,7 +7,7 @@ import {
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import { ExchangeContract } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@ -15,6 +15,7 @@ import {
expectContractCreationFailedAsync,
LogDecoder,
OrderFactory,
orderUtils,
provider,
sendTransactionResult,
txDefaults,
@ -53,7 +54,6 @@ describe('OrderMatcher', () => {
let orderMatcher: OrderMatcherContract;
let erc20BalancesByOwner: ERC20BalancesByOwner;
let exchangeWrapper: ExchangeWrapper;
let erc20Wrapper: ERC20Wrapper;
let orderFactoryLeft: OrderFactory;
let orderFactoryRight: OrderFactory;
@ -117,10 +117,18 @@ describe('OrderMatcher', () => {
await devUtils.encodeERC20AssetData.callAsync(zrxToken.address),
new BigNumber(chainId),
);
exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
// Authorize ERC20 trades by exchange
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
erc20Proxy.address,
{
from: owner,
},
);
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
erc721Proxy.address,
{
from: owner,
},
); // Authorize ERC20 trades by exchange
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
@ -486,12 +494,20 @@ describe('OrderMatcher', () => {
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
});
await exchangeWrapper.fillOrderAsync(signedOrderLeft, takerAddress, {
takerAssetFillAmount: signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5),
});
await exchangeWrapper.fillOrderAsync(signedOrderRight, takerAddress, {
takerAssetFillAmount: signedOrderRight.takerAssetAmount.dividedToIntegerBy(5),
});
let params = orderUtils.createFill(signedOrderLeft, signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5));
await exchange.fillOrder.awaitTransactionSuccessAsync(
params.order,
params.takerAssetFillAmount,
params.signature,
{ from: takerAddress },
);
params = orderUtils.createFill(signedOrderRight, signedOrderRight.takerAssetAmount.dividedToIntegerBy(5));
await exchange.fillOrder.awaitTransactionSuccessAsync(
params.order,
params.takerAssetFillAmount,
params.signature,
{ from: takerAddress },
);
const data = exchange.matchOrders.getABIEncodedTransactionData(
signedOrderLeft,
signedOrderRight,

View File

@ -22,7 +22,7 @@
"compile": "sol-compiler",
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
@ -36,7 +36,7 @@
"compile:truffle": "truffle compile"
},
"config": {
"abis": "./generated-artifacts/@(TestFramework).json",
"abis": "./test/generated-artifacts/@(TestFramework).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {

View File

@ -1,4 +1,4 @@
import { TokenOwnersByName } from '@0x/contracts-exchange';
import { ObjectMap } from '@0x/types';
import * as _ from 'lodash';
import { Actor } from './base';
@ -7,6 +7,6 @@ import { Actor } from './base';
* Utility function to convert Actors into an object mapping readable names to addresses.
* Useful for BalanceStore.
*/
export function actorAddressesByName(actors: Actor[]): TokenOwnersByName {
export function actorAddressesByName(actors: Actor[]): ObjectMap<string> {
return _.zipObject(actors.map(actor => actor.name), actors.map(actor => actor.address));
}

View File

@ -0,0 +1,9 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
import { ContractArtifact } from 'ethereum-types';
import * as TestFramework from '../test/generated-artifacts/TestFramework.json';
export const artifacts = { TestFramework: TestFramework as ContractArtifact };

View File

@ -2,18 +2,17 @@ import { CoordinatorContract, SignedCoordinatorApproval } from '@0x/contracts-co
import { DevUtilsContract } from '@0x/contracts-dev-utils';
import {
BlockchainBalanceStore,
constants as exchangeConstants,
ExchangeCancelEventArgs,
ExchangeCancelUpToEventArgs,
exchangeDataEncoder,
ExchangeEvents,
ExchangeFillEventArgs,
ExchangeFunctionName,
LocalBalanceStore,
} from '@0x/contracts-exchange';
import {
blockchainTests,
constants,
ExchangeFunctionName,
expect,
hexConcat,
hexSlice,
@ -174,7 +173,7 @@ blockchainTests.resets('Coordinator integration tests', env => {
let transaction: SignedZeroExTransaction;
let approval: SignedCoordinatorApproval;
for (const fnName of exchangeConstants.SINGLE_FILL_FN_NAMES) {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
before(async () => {
order = await maker.signOrderAsync();
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, [order]);
@ -321,7 +320,7 @@ blockchainTests.resets('Coordinator integration tests', env => {
let transaction: SignedZeroExTransaction;
let approval: SignedCoordinatorApproval;
for (const fnName of [...exchangeConstants.MARKET_FILL_FN_NAMES, ...exchangeConstants.BATCH_FILL_FN_NAMES]) {
for (const fnName of [...constants.MARKET_FILL_FN_NAMES, ...constants.BATCH_FILL_FN_NAMES]) {
before(async () => {
orders = [await maker.signOrderAsync(), await maker.signOrderAsync()];
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);

View File

@ -1,8 +1,8 @@
import { Authorizable, Ownable } from '@0x/contracts-exchange';
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';
blockchainTests('Deployment Manager', env => {
let owner: string;

View File

@ -8,14 +8,11 @@ import {
} from '@0x/contracts-asset-proxy';
import {
artifacts as exchangeArtifacts,
AssetProxyDispatcher,
Authorizable,
ExchangeAssetProxyRegisteredEventArgs,
ExchangeContract,
ExchangeEvents,
ExchangeProtocolFeeCollectorAddressEventArgs,
ExchangeProtocolFeeMultiplierEventArgs,
Ownable,
} from '@0x/contracts-exchange';
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
import {
@ -36,6 +33,8 @@ import { AssetProxyId } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { TxData } from 'ethereum-types';
import { AssetProxyDispatcher, Authorizable, Ownable } from '../utils/wrapper_interfaces';
// tslint:disable:no-unnecessary-type-assertion
blockchainTests('Deployment and Configuration End to End Tests', env => {
// Available Addresses

View File

@ -2,8 +2,8 @@ import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { IERC20TokenEvents, IERC20TokenTransferEventArgs } from '@0x/contracts-erc20';
import {
BlockchainBalanceStore,
IExchangeEvents,
IExchangeFillEventArgs,
ExchangeEvents,
ExchangeFillEventArgs,
LocalBalanceStore,
} from '@0x/contracts-exchange';
import {
@ -142,7 +142,7 @@ blockchainTests.resets('fillOrder integration tests', env => {
function verifyFillEvents(order: SignedOrder, receipt: TransactionReceiptWithDecodedLogs): void {
// Ensure that the fill event was correct.
verifyEvents<IExchangeFillEventArgs>(
verifyEvents<ExchangeFillEventArgs>(
receipt,
[
{
@ -162,7 +162,7 @@ blockchainTests.resets('fillOrder integration tests', env => {
protocolFeePaid: DeploymentManager.protocolFee,
},
],
IExchangeEvents.Fill,
ExchangeEvents.Fill,
);
// Ensure that the transfer events were correctly emitted.

View File

@ -9,13 +9,7 @@ import {
import { artifacts as ERC1155Artifacts, ERC1155MintableContract } from '@0x/contracts-erc1155';
import { artifacts as ERC20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
import { artifacts as ERC721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
import {
artifacts as exchangeArtifacts,
AssetProxyDispatcher,
Authorizable,
ExchangeContract,
Ownable,
} from '@0x/contracts-exchange';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
import {
artifacts as stakingArtifacts,
@ -28,6 +22,8 @@ import { BigNumber } from '@0x/utils';
import { TxData } from 'ethereum-types';
import * as _ from 'lodash';
import { AssetProxyDispatcher, Authorizable, Ownable } from './wrapper_interfaces';
/**
* Adds a batch of authorities to a list of authorizable contracts.
* @param owner The owner of the authorizable contracts.

View File

@ -0,0 +1,6 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../test/generated-wrappers/test_framework';

View File

@ -2,5 +2,5 @@
"extends": "../../tsconfig",
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": ["generated-artifacts/TestFramework.json"]
"files": ["generated-artifacts/TestFramework.json", "test/generated-artifacts/TestFramework.json"]
}

View File

@ -3,6 +3,8 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { ExchangeFunctionName } from './types';
const TESTRPC_PRIVATE_KEYS_STRINGS = [
'0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
'0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
@ -84,4 +86,26 @@ export const constants = {
PPM_DENOMINATOR: 1e6,
PPM_100_PERCENT: 1e6,
MAX_CODE_SIZE: 24576,
SINGLE_FILL_FN_NAMES: [ExchangeFunctionName.FillOrder, ExchangeFunctionName.FillOrKillOrder],
BATCH_FILL_FN_NAMES: [
ExchangeFunctionName.BatchFillOrders,
ExchangeFunctionName.BatchFillOrKillOrders,
ExchangeFunctionName.BatchFillOrdersNoThrow,
],
MARKET_FILL_FN_NAMES: [
ExchangeFunctionName.MarketBuyOrdersFillOrKill,
ExchangeFunctionName.MarketSellOrdersFillOrKill,
ExchangeFunctionName.MarketBuyOrdersNoThrow,
ExchangeFunctionName.MarketSellOrdersNoThrow,
],
MATCH_ORDER_FN_NAMES: [ExchangeFunctionName.MatchOrders, ExchangeFunctionName.MatchOrdersWithMaximalFill],
BATCH_MATCH_ORDER_FN_NAMES: [
ExchangeFunctionName.BatchMatchOrders,
ExchangeFunctionName.BatchMatchOrdersWithMaximalFill,
],
CANCEL_ORDER_FN_NAMES: [
ExchangeFunctionName.CancelOrder,
ExchangeFunctionName.BatchCancelOrders,
ExchangeFunctionName.CancelOrdersUpTo,
],
};

View File

@ -57,6 +57,7 @@ export {
Token,
TokenBalances,
TransactionDataParams,
ExchangeFunctionName,
} from './types';
export { blockchainTests, BlockchainTestsEnvironment, describe } from './mocha_blockchain';
export { chaiSetup, expect } from './chai_setup';

View File

@ -171,3 +171,33 @@ export interface FillEventArgs {
}
export type Numberish = BigNumber | string | number;
export enum ExchangeFunctionName {
BatchCancelOrders = 'batchCancelOrders',
BatchExecuteTransactions = 'batchExecuteTransactions',
BatchFillOrKillOrders = 'batchFillOrKillOrders',
BatchFillOrders = 'batchFillOrders',
BatchFillOrdersNoThrow = 'batchFillOrdersNoThrow',
BatchMatchOrders = 'batchMatchOrders',
BatchMatchOrdersWithMaximalFill = 'batchMatchOrdersWithMaximalFill',
CancelOrder = 'cancelOrder',
CancelOrdersUpTo = 'cancelOrdersUpTo',
ExecuteTransaction = 'executeTransaction',
FillOrKillOrder = 'fillOrKillOrder',
FillOrder = 'fillOrder',
FillOrderNoThrow = 'fillOrderNoThrow',
MarketBuyOrdersNoThrow = 'marketBuyOrdersNoThrow',
MarketSellOrdersNoThrow = 'marketSellOrdersNoThrow',
MarketBuyOrdersFillOrKill = 'marketBuyOrdersFillOrKill',
MarketSellOrdersFillOrKill = 'marketSellOrdersFillOrKill',
MatchOrders = 'matchOrders',
MatchOrdersWithMaximalFill = 'matchOrdersWithMaximalFill',
PreSign = 'preSign',
RegisterAssetProxy = 'registerAssetProxy',
SetSignatureValidatorApproval = 'setSignatureValidatorApproval',
SimulateDispatchTransferFromCalls = 'simulateDispatchTransferFromCalls',
TransferOwnership = 'transferOwnership',
SetProtocolFeeMultiplier = 'setProtocolFeeMultiplier',
SetProtocolFeeCollectorAddress = 'setProtocolFeeCollectorAddress',
DetachProtocolFeeCollector = 'detachProtocolFeeCollector',
}

View File

@ -23,7 +23,7 @@
"compile": "sol-compiler",
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",

View File

@ -1,4 +1,4 @@
import { IExchangeContract } from '@0x/contracts-exchange';
import { ExchangeContract } from '@0x/contracts-exchange';
import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { BigNumber } from '@0x/utils';
@ -32,7 +32,7 @@ const signature =
describe('LibTransactionDecoder', () => {
let libTxDecoder: LibTransactionDecoderContract;
const exchangeInterface = new IExchangeContract(constants.NULL_ADDRESS, provider, txDefaults);
const exchangeInterface = new ExchangeContract(constants.NULL_ADDRESS, provider, txDefaults);
before(async () => {
await blockchainLifecycle.startAsync();
libTxDecoder = await LibTransactionDecoderContract.deployFrom0xArtifactAsync(

View File

@ -8,7 +8,7 @@ import {
} from '@0x/contracts-asset-proxy';
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@ -93,10 +93,24 @@ describe('OrderValidationUtils/OrderTransferSimulatorUtils', () => {
txDefaults,
artifacts,
);
const exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(multiAssetProxy.address, owner);
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
erc20Proxy.address,
{
from: owner,
},
);
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
erc721Proxy.address,
{
from: owner,
},
);
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
multiAssetProxy.address,
{
from: owner,
},
);
await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner });
await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner });