Fix remaining build issues
This commit is contained in:
parent
f011be9347
commit
15a5bc02ef
@ -36,7 +36,7 @@
|
|||||||
"compile:truffle": "truffle compile"
|
"compile:truffle": "truffle compile"
|
||||||
},
|
},
|
||||||
"config": {
|
"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."
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
37
contracts/coordinator/test/artifacts.ts
Normal file
37
contracts/coordinator/test/artifacts.ts
Normal 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,
|
||||||
|
};
|
@ -1,7 +1,8 @@
|
|||||||
import { constants as exchangeConstants, exchangeDataEncoder, ExchangeFunctionName } from '@0x/contracts-exchange';
|
import { exchangeDataEncoder } from '@0x/contracts-exchange';
|
||||||
import {
|
import {
|
||||||
blockchainTests,
|
blockchainTests,
|
||||||
constants,
|
constants,
|
||||||
|
ExchangeFunctionName,
|
||||||
expect,
|
expect,
|
||||||
hexConcat,
|
hexConcat,
|
||||||
hexSlice,
|
hexSlice,
|
||||||
@ -144,7 +145,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('decodeOrdersFromFillData', () => {
|
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 () => {
|
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||||
const orders = [defaultOrder];
|
const orders = [defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -158,7 +159,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
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 () => {
|
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||||
const orders = [defaultOrder, defaultOrder];
|
const orders = [defaultOrder, defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -172,7 +173,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
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 () => {
|
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||||
const orders = [defaultOrder, defaultOrder];
|
const orders = [defaultOrder, defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -186,7 +187,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
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 () => {
|
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||||
const orders = [defaultOrder, defaultOrder];
|
const orders = [defaultOrder, defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -200,7 +201,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
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 () => {
|
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||||
const orders = [defaultOrder, defaultOrder];
|
const orders = [defaultOrder, defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -227,7 +228,7 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Single order approvals', () => {
|
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 () => {
|
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1]`, async () => {
|
||||||
const orders = [defaultOrder];
|
const orders = [defaultOrder];
|
||||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
@ -341,9 +342,9 @@ blockchainTests.resets('Mixins tests', env => {
|
|||||||
});
|
});
|
||||||
describe('Batch order approvals', () => {
|
describe('Batch order approvals', () => {
|
||||||
for (const fnName of [
|
for (const fnName of [
|
||||||
...exchangeConstants.BATCH_FILL_FN_NAMES,
|
...constants.BATCH_FILL_FN_NAMES,
|
||||||
...exchangeConstants.MARKET_FILL_FN_NAMES,
|
...constants.MARKET_FILL_FN_NAMES,
|
||||||
...exchangeConstants.MATCH_ORDER_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 () => {
|
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver1], approval_sig=[approver1]`, async () => {
|
||||||
const orders = [defaultOrder, defaultOrder];
|
const orders = [defaultOrder, defaultOrder];
|
||||||
|
19
contracts/coordinator/test/wrappers.ts
Normal file
19
contracts/coordinator/test/wrappers.ts
Normal 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';
|
@ -16,7 +16,21 @@
|
|||||||
"generated-artifacts/MixinCoordinatorApprovalVerifier.json",
|
"generated-artifacts/MixinCoordinatorApprovalVerifier.json",
|
||||||
"generated-artifacts/MixinCoordinatorCore.json",
|
"generated-artifacts/MixinCoordinatorCore.json",
|
||||||
"generated-artifacts/MixinCoordinatorRegistryCore.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"]
|
"exclude": ["./deploy/solc/solc_bin"]
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"compile:truffle": "truffle compile"
|
"compile:truffle": "truffle compile"
|
||||||
},
|
},
|
||||||
"config": {
|
"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."
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
29
contracts/exchange-forwarder/test/artifacts.ts
Normal file
29
contracts/exchange-forwarder/test/artifacts.ts
Normal 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,
|
||||||
|
};
|
15
contracts/exchange-forwarder/test/wrappers.ts
Normal file
15
contracts/exchange-forwarder/test/wrappers.ts
Normal 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';
|
@ -12,7 +12,17 @@
|
|||||||
"generated-artifacts/MixinAssets.json",
|
"generated-artifacts/MixinAssets.json",
|
||||||
"generated-artifacts/MixinExchangeWrapper.json",
|
"generated-artifacts/MixinExchangeWrapper.json",
|
||||||
"generated-artifacts/MixinForwarderCore.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"]
|
"exclude": ["./deploy/solc/solc_bin"]
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export * from './artifacts';
|
export * from './artifacts';
|
||||||
export * from './wrappers';
|
export * from './wrappers';
|
||||||
export * from '../test/balance_stores';
|
export * from '../test/balance_stores';
|
||||||
export * from '../test/utils';
|
export * from '../test/utils/exchange_data_encoder';
|
||||||
export * from './wrapper_interfaces';
|
|
||||||
|
@ -17,13 +17,14 @@ import * as _ from 'lodash';
|
|||||||
import {
|
import {
|
||||||
BalanceStore,
|
BalanceStore,
|
||||||
BlockchainBalanceStore,
|
BlockchainBalanceStore,
|
||||||
ExchangeContract,
|
|
||||||
LocalBalanceStore,
|
LocalBalanceStore,
|
||||||
TokenContractsByName,
|
TokenContractsByName,
|
||||||
TokenIds,
|
TokenIds,
|
||||||
TokenOwnersByName,
|
TokenOwnersByName,
|
||||||
} from '../../src';
|
} from '../../src';
|
||||||
|
|
||||||
|
import { ExchangeContract } from '../wrappers';
|
||||||
|
|
||||||
export class FillOrderWrapper {
|
export class FillOrderWrapper {
|
||||||
private readonly _blockchainBalanceStore: BlockchainBalanceStore;
|
private readonly _blockchainBalanceStore: BlockchainBalanceStore;
|
||||||
|
|
||||||
|
@ -41,16 +41,21 @@ import { LogWithDecodedArgs } from 'ethereum-types';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { Erc1155Wrapper } from '../../erc1155/lib/src';
|
import { Erc1155Wrapper } from '../../erc1155/lib/src';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ExchangeWrapper,
|
||||||
|
ValidatorWalletAction,
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
artifacts,
|
artifacts,
|
||||||
|
} from './artifacts';
|
||||||
|
import { FillOrderWrapper } from './assertion_wrappers/fill_order_wrapper';
|
||||||
|
import {
|
||||||
ExchangeCancelEventArgs,
|
ExchangeCancelEventArgs,
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
ExchangeWrapper,
|
|
||||||
TestValidatorWalletContract,
|
TestValidatorWalletContract,
|
||||||
ValidatorWalletAction,
|
} from './wrappers';
|
||||||
} from '../src';
|
|
||||||
|
|
||||||
import { FillOrderWrapper } from './assertion_wrappers/fill_order_wrapper';
|
|
||||||
|
|
||||||
// tslint:disable:no-unnecessary-type-assertion
|
// tslint:disable:no-unnecessary-type-assertion
|
||||||
blockchainTests.resets('Exchange core', () => {
|
blockchainTests.resets('Exchange core', () => {
|
||||||
|
@ -24,11 +24,11 @@ import * as chai from 'chai';
|
|||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
|
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
|
||||||
TestAssetProxyDispatcherContract,
|
TestAssetProxyDispatcherContract,
|
||||||
} from '../src';
|
} from './wrappers';
|
||||||
|
|
||||||
import { dependencyArtifacts } from './utils/dependency_artifacts';
|
import { dependencyArtifacts } from './utils/dependency_artifacts';
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
TestExchangeInternalsContract,
|
TestExchangeInternalsContract,
|
||||||
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
|
TestExchangeInternalsDispatchTransferFromCalledEventArgs,
|
||||||
TestExchangeInternalsFillEventArgs,
|
TestExchangeInternalsFillEventArgs,
|
||||||
} from '../src';
|
} from './wrappers';
|
||||||
|
|
||||||
blockchainTests('Exchange core internal functions', env => {
|
blockchainTests('Exchange core internal functions', env => {
|
||||||
const CHAIN_ID = 1337;
|
const CHAIN_ID = 1337;
|
||||||
|
@ -11,7 +11,8 @@ import { ExchangeRevertErrors, generatePseudoRandomSalt } from '@0x/order-utils'
|
|||||||
import { BigNumber, RevertError } from '@0x/utils';
|
import { BigNumber, RevertError } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { artifacts, TestLibExchangeRichErrorDecoderContract } from '../src';
|
import { artifacts } from './artifacts';
|
||||||
|
import { TestLibExchangeRichErrorDecoderContract } from './wrappers';
|
||||||
|
|
||||||
blockchainTests.resets('LibExchangeRichErrorDecoder', ({ provider, txDefaults }) => {
|
blockchainTests.resets('LibExchangeRichErrorDecoder', ({ provider, txDefaults }) => {
|
||||||
const ASSET_PROXY_ID_LENGTH = 4;
|
const ASSET_PROXY_ID_LENGTH = 4;
|
||||||
|
@ -30,7 +30,12 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
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';
|
import { MatchOrderTester, TokenBalances } from './utils/match_order_tester';
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { blockchainTests } from '@0x/contracts-test-utils';
|
import { blockchainTests } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber } from '@0x/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
|
// 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
|
// tests. For more information and a more accurate view of the tests, check out
|
||||||
|
@ -2,12 +2,12 @@ import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
|
|||||||
import { BigNumber, OwnableRevertErrors } from '@0x/utils';
|
import { BigNumber, OwnableRevertErrors } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
ExchangeProtocolFeeCollectorAddressEventArgs,
|
ExchangeProtocolFeeCollectorAddressEventArgs,
|
||||||
ExchangeProtocolFeeMultiplierEventArgs,
|
ExchangeProtocolFeeMultiplierEventArgs,
|
||||||
} from '../src';
|
} from './wrappers';
|
||||||
|
|
||||||
blockchainTests.resets('MixinProtocolFees', env => {
|
blockchainTests.resets('MixinProtocolFees', env => {
|
||||||
let accounts: string[];
|
let accounts: string[];
|
||||||
|
@ -3,7 +3,8 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { DataItem, MethodAbi, TupleDataItem } from 'ethereum-types';
|
import { DataItem, MethodAbi, TupleDataItem } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { artifacts, ReentrancyTesterContract } from '../src';
|
import { artifacts } from './artifacts';
|
||||||
|
import { ReentrancyTesterContract} from './wrappers';
|
||||||
|
|
||||||
import { constants as TestConstants } from './utils/constants';
|
import { constants as TestConstants } from './utils/constants';
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ import { BigNumber, StringRevertError } from '@0x/utils';
|
|||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
IEIP1271DataContract,
|
IEIP1271DataContract,
|
||||||
TestSignatureValidatorContract,
|
TestSignatureValidatorContract,
|
||||||
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
|
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
|
||||||
TestValidatorWalletContract,
|
TestValidatorWalletContract,
|
||||||
} from '../src';
|
} from './wrappers';
|
||||||
|
|
||||||
import { ValidatorWalletAction } from './utils';
|
import { ValidatorWalletAction } from './utils';
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
blockchainTests,
|
blockchainTests,
|
||||||
constants,
|
constants,
|
||||||
describe,
|
describe,
|
||||||
|
ExchangeFunctionName,
|
||||||
expect,
|
expect,
|
||||||
getLatestBlockTimestampAsync,
|
getLatestBlockTimestampAsync,
|
||||||
OrderFactory,
|
OrderFactory,
|
||||||
@ -18,19 +19,16 @@ import { LogWithDecodedArgs, MethodAbi } from 'ethereum-types';
|
|||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { artifacts as localArtifacts } from './artifacts';
|
||||||
|
import { exchangeDataEncoder, ExchangeWrapper } from './utils';
|
||||||
import {
|
import {
|
||||||
artifacts as localArtifacts,
|
|
||||||
constants as exchangeConstants,
|
|
||||||
ExchangeCancelEventArgs,
|
ExchangeCancelEventArgs,
|
||||||
ExchangeCancelUpToEventArgs,
|
ExchangeCancelUpToEventArgs,
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
exchangeDataEncoder,
|
|
||||||
ExchangeFillEventArgs,
|
ExchangeFillEventArgs,
|
||||||
ExchangeFunctionName,
|
|
||||||
ExchangeSignatureValidatorApprovalEventArgs,
|
ExchangeSignatureValidatorApprovalEventArgs,
|
||||||
ExchangeTransactionExecutionEventArgs,
|
ExchangeTransactionExecutionEventArgs,
|
||||||
ExchangeWrapper,
|
} from './wrappers';
|
||||||
} from '../src/';
|
|
||||||
|
|
||||||
const artifacts = { ...erc20Artifacts, ...localArtifacts };
|
const artifacts = { ...erc20Artifacts, ...localArtifacts };
|
||||||
|
|
||||||
@ -210,9 +208,9 @@ blockchainTests.resets('Exchange transactions', env => {
|
|||||||
});
|
});
|
||||||
describe('fill methods', () => {
|
describe('fill methods', () => {
|
||||||
for (const fnName of [
|
for (const fnName of [
|
||||||
...exchangeConstants.SINGLE_FILL_FN_NAMES,
|
...constants.SINGLE_FILL_FN_NAMES,
|
||||||
...exchangeConstants.BATCH_FILL_FN_NAMES,
|
...constants.BATCH_FILL_FN_NAMES,
|
||||||
...exchangeConstants.MARKET_FILL_FN_NAMES,
|
...constants.MARKET_FILL_FN_NAMES,
|
||||||
]) {
|
]) {
|
||||||
it(`${fnName} should revert if signature is invalid and not called by signer`, async () => {
|
it(`${fnName} should revert if signature is invalid and not called by signer`, async () => {
|
||||||
const orders = [await orderFactory.newSignedOrderAsync()];
|
const orders = [await orderFactory.newSignedOrderAsync()];
|
||||||
@ -301,7 +299,7 @@ blockchainTests.resets('Exchange transactions', env => {
|
|||||||
|
|
||||||
const decodedReturnData = abiEncoder.decodeReturnValues(returnData);
|
const decodedReturnData = abiEncoder.decodeReturnValues(returnData);
|
||||||
const fillResults =
|
const fillResults =
|
||||||
exchangeConstants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1
|
constants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1
|
||||||
? decodedReturnData.fillResults[0]
|
? decodedReturnData.fillResults[0]
|
||||||
: decodedReturnData.fillResults;
|
: decodedReturnData.fillResults;
|
||||||
|
|
||||||
|
@ -5,7 +5,11 @@ import { BigNumber, StringRevertError } from '@0x/utils';
|
|||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
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 }) => {
|
blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDefaults }) => {
|
||||||
let transactionsContract: TestTransactionsContract;
|
let transactionsContract: TestTransactionsContract;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ExchangeFunctionName } from './types';
|
import { ExchangeFunctionName } from '@0x/contracts-test-utils';
|
||||||
|
|
||||||
export const constants = {
|
export const constants = {
|
||||||
// These are functions not secured by the `nonReentrant`, directly or
|
// These are functions not secured by the `nonReentrant`, directly or
|
||||||
@ -13,28 +13,6 @@ export const constants = {
|
|||||||
ExchangeFunctionName.SetProtocolFeeCollectorAddress,
|
ExchangeFunctionName.SetProtocolFeeCollectorAddress,
|
||||||
ExchangeFunctionName.DetachProtocolFeeCollector,
|
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 {
|
export enum ValidatorWalletAction {
|
||||||
|
@ -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 { orderHashUtils } from '@0x/order-utils';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
|
|
||||||
import { constants as exchangeConstants, ExchangeFunctionName, IExchangeContract } from '../../src';
|
import { IExchangeContract } from '../wrappers';
|
||||||
|
|
||||||
export const exchangeDataEncoder = {
|
export const exchangeDataEncoder = {
|
||||||
encodeOrdersToExchangeData(fnName: ExchangeFunctionName, orders: SignedOrder[] = []): string {
|
encodeOrdersToExchangeData(fnName: ExchangeFunctionName, orders: SignedOrder[] = []): string {
|
||||||
const exchangeInstance = new IExchangeContract(constants.NULL_ADDRESS, provider);
|
const exchangeInstance = new IExchangeContract(constants.NULL_ADDRESS, provider);
|
||||||
let data;
|
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(
|
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
|
||||||
orders[0],
|
orders[0],
|
||||||
orders[0].takerAssetAmount,
|
orders[0].takerAssetAmount,
|
||||||
orders[0].signature,
|
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(
|
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
|
||||||
orders,
|
orders,
|
||||||
orders.map(order => order.takerAssetAmount),
|
orders.map(order => order.takerAssetAmount),
|
||||||
orders.map(order => order.signature),
|
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';
|
const fillAsset = /Buy/.test(fnName) ? 'makerAssetAmount' : 'takerAssetAmount';
|
||||||
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
|
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
|
||||||
orders,
|
orders,
|
||||||
orders.map(order => order[fillAsset]).reduce((prev, curr) => prev.plus(curr)),
|
orders.map(order => order[fillAsset]).reduce((prev, curr) => prev.plus(curr)),
|
||||||
orders.map(order => order.signature),
|
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(
|
data = exchangeInstance.matchOrders.getABIEncodedTransactionData(
|
||||||
orders[0],
|
orders[0],
|
||||||
orders[1],
|
orders[1],
|
||||||
|
@ -11,7 +11,7 @@ import { AbiEncoder, BigNumber } from '@0x/utils';
|
|||||||
import { MethodAbi, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { MethodAbi, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { ExchangeContract } from '../../src';
|
import { ExchangeContract } from '../wrappers';
|
||||||
|
|
||||||
import { AbiDecodedFillOrderData } from './types';
|
import { AbiDecodedFillOrderData } from './types';
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ import { LogWithDecodedArgs, TxData } from 'ethereum-types';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import 'make-promises-safe';
|
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 { AssetWrapper } from './asset_wrapper';
|
||||||
import { ExchangeWrapper } from './exchange_wrapper';
|
import { ExchangeWrapper } from './exchange_wrapper';
|
||||||
|
@ -12,12 +12,13 @@ import { TxData, Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import { LogEntry } from 'ethereum-types';
|
import { LogEntry } from 'ethereum-types';
|
||||||
|
|
||||||
|
import { artifacts } from '../artifacts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
IsolatedExchangeContract,
|
IsolatedExchangeContract,
|
||||||
IsolatedExchangeDispatchTransferFromCalledEventArgs as DispatchTransferFromCallArgs,
|
IsolatedExchangeDispatchTransferFromCalledEventArgs as DispatchTransferFromCallArgs,
|
||||||
IsolatedExchangeFillEventArgs as FillEventArgs,
|
IsolatedExchangeFillEventArgs as FillEventArgs,
|
||||||
} from '../../src';
|
} from '../wrappers';
|
||||||
|
|
||||||
export interface AssetBalances {
|
export interface AssetBalances {
|
||||||
[assetData: string]: { [address: string]: BigNumber };
|
[assetData: string]: { [address: string]: BigNumber };
|
||||||
|
@ -36,3 +36,13 @@ export enum ExchangeFunctionName {
|
|||||||
SetProtocolFeeCollectorAddress = 'setProtocolFeeCollectorAddress',
|
SetProtocolFeeCollectorAddress = 'setProtocolFeeCollectorAddress',
|
||||||
DetachProtocolFeeCollector = 'detachProtocolFeeCollector',
|
DetachProtocolFeeCollector = 'detachProtocolFeeCollector',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum TradeSide {
|
||||||
|
Maker = 'maker',
|
||||||
|
Taker = 'taker',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum TransferType {
|
||||||
|
Trade = 'trade',
|
||||||
|
Fee = 'fee',
|
||||||
|
}
|
||||||
|
@ -16,12 +16,12 @@ import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
|
|||||||
import * as ethjs from 'ethereumjs-util';
|
import * as ethjs from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
import {
|
import {
|
||||||
artifacts,
|
|
||||||
TestWrapperFunctionsCancelOrderCalledEventArgs as CancelOrderCalledEventArgs,
|
TestWrapperFunctionsCancelOrderCalledEventArgs as CancelOrderCalledEventArgs,
|
||||||
TestWrapperFunctionsContract,
|
TestWrapperFunctionsContract,
|
||||||
TestWrapperFunctionsFillOrderCalledEventArgs as FillOrderCalledEventArgs,
|
TestWrapperFunctionsFillOrderCalledEventArgs as FillOrderCalledEventArgs,
|
||||||
} from '../src';
|
} from './wrappers';
|
||||||
|
|
||||||
blockchainTests('Exchange wrapper functions unit tests.', env => {
|
blockchainTests('Exchange wrapper functions unit tests.', env => {
|
||||||
const CHAIN_ID = 0x74657374;
|
const CHAIN_ID = 0x74657374;
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
"@0x/contracts-dev-utils": "^0.1.0-beta.1",
|
"@0x/contracts-dev-utils": "^0.1.0-beta.1",
|
||||||
"@0x/contracts-erc20": "^2.3.0-beta.1",
|
"@0x/contracts-erc20": "^2.3.0-beta.1",
|
||||||
"@0x/contracts-erc721": "^2.2.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-exchange-libs": "^3.1.0-beta.1",
|
||||||
"@0x/contracts-utils": "^3.3.0-beta.1",
|
"@0x/contracts-utils": "^3.3.0-beta.1",
|
||||||
"@0x/order-utils": "^8.5.0-beta.1",
|
"@0x/order-utils": "^8.5.0-beta.1",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
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 { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { ExchangeRevertErrors } from '@0x/order-utils';
|
import { ExchangeRevertErrors } from '@0x/order-utils';
|
||||||
import { Order, RevertReason, SignedOrder } from '@0x/types';
|
import { Order, RevertReason, SignedOrder } from '@0x/types';
|
||||||
@ -52,7 +52,6 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
|||||||
let zrxAssetData: string;
|
let zrxAssetData: string;
|
||||||
let zrxToken: DummyERC20TokenContract;
|
let zrxToken: DummyERC20TokenContract;
|
||||||
let exchangeInstance: ExchangeContract;
|
let exchangeInstance: ExchangeContract;
|
||||||
let exchangeWrapper: ExchangeWrapper;
|
|
||||||
let devUtils: DevUtilsContract;
|
let devUtils: DevUtilsContract;
|
||||||
|
|
||||||
let orderFactory: OrderFactory;
|
let orderFactory: OrderFactory;
|
||||||
@ -139,9 +138,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
|||||||
zrxAssetData,
|
zrxAssetData,
|
||||||
new BigNumber(chainId),
|
new BigNumber(chainId),
|
||||||
);
|
);
|
||||||
exchangeWrapper = new ExchangeWrapper(exchangeInstance);
|
|
||||||
// Register proxies
|
// Register proxies
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
|
erc20Proxy.address,
|
||||||
|
{
|
||||||
|
from: owner,
|
||||||
|
},
|
||||||
|
);
|
||||||
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
||||||
from: owner,
|
from: owner,
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
|
|||||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||||
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
|
import { ExchangeContract } from '@0x/contracts-exchange';
|
||||||
import {
|
import {
|
||||||
chaiSetup,
|
chaiSetup,
|
||||||
constants,
|
constants,
|
||||||
@ -98,9 +98,18 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
zrxAssetData,
|
zrxAssetData,
|
||||||
new BigNumber(chainId),
|
new BigNumber(chainId),
|
||||||
);
|
);
|
||||||
const exchangeWrapper = new ExchangeWrapper(exchangeInstance);
|
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
erc20Proxy.address,
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
|
{
|
||||||
|
from: owner,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await exchangeInstance.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
|
erc721Proxy.address,
|
||||||
|
{
|
||||||
|
from: owner,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
||||||
from: owner,
|
from: owner,
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||||
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
|
import { ExchangeContract } from '@0x/contracts-exchange';
|
||||||
import {
|
import {
|
||||||
chaiSetup,
|
chaiSetup,
|
||||||
constants,
|
constants,
|
||||||
@ -15,6 +15,7 @@ import {
|
|||||||
expectContractCreationFailedAsync,
|
expectContractCreationFailedAsync,
|
||||||
LogDecoder,
|
LogDecoder,
|
||||||
OrderFactory,
|
OrderFactory,
|
||||||
|
orderUtils,
|
||||||
provider,
|
provider,
|
||||||
sendTransactionResult,
|
sendTransactionResult,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
@ -53,7 +54,6 @@ describe('OrderMatcher', () => {
|
|||||||
let orderMatcher: OrderMatcherContract;
|
let orderMatcher: OrderMatcherContract;
|
||||||
|
|
||||||
let erc20BalancesByOwner: ERC20BalancesByOwner;
|
let erc20BalancesByOwner: ERC20BalancesByOwner;
|
||||||
let exchangeWrapper: ExchangeWrapper;
|
|
||||||
let erc20Wrapper: ERC20Wrapper;
|
let erc20Wrapper: ERC20Wrapper;
|
||||||
let orderFactoryLeft: OrderFactory;
|
let orderFactoryLeft: OrderFactory;
|
||||||
let orderFactoryRight: OrderFactory;
|
let orderFactoryRight: OrderFactory;
|
||||||
@ -117,10 +117,18 @@ describe('OrderMatcher', () => {
|
|||||||
await devUtils.encodeERC20AssetData.callAsync(zrxToken.address),
|
await devUtils.encodeERC20AssetData.callAsync(zrxToken.address),
|
||||||
new BigNumber(chainId),
|
new BigNumber(chainId),
|
||||||
);
|
);
|
||||||
exchangeWrapper = new ExchangeWrapper(exchange);
|
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
erc20Proxy.address,
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
|
{
|
||||||
// Authorize ERC20 trades by exchange
|
from: owner,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
|
erc721Proxy.address,
|
||||||
|
{
|
||||||
|
from: owner,
|
||||||
|
},
|
||||||
|
); // Authorize ERC20 trades by exchange
|
||||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||||
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
|
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
|
||||||
from: owner,
|
from: owner,
|
||||||
@ -486,12 +494,20 @@ describe('OrderMatcher', () => {
|
|||||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||||
});
|
});
|
||||||
await exchangeWrapper.fillOrderAsync(signedOrderLeft, takerAddress, {
|
let params = orderUtils.createFill(signedOrderLeft, signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5));
|
||||||
takerAssetFillAmount: signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5),
|
await exchange.fillOrder.awaitTransactionSuccessAsync(
|
||||||
});
|
params.order,
|
||||||
await exchangeWrapper.fillOrderAsync(signedOrderRight, takerAddress, {
|
params.takerAssetFillAmount,
|
||||||
takerAssetFillAmount: signedOrderRight.takerAssetAmount.dividedToIntegerBy(5),
|
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(
|
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||||
signedOrderLeft,
|
signedOrderLeft,
|
||||||
signedOrderRight,
|
signedOrderRight,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"compile": "sol-compiler",
|
"compile": "sol-compiler",
|
||||||
"watch": "sol-compiler -w",
|
"watch": "sol-compiler -w",
|
||||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
"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",
|
"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",
|
"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",
|
"coverage:report:text": "istanbul report text",
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"compile:truffle": "truffle compile"
|
"compile:truffle": "truffle compile"
|
||||||
},
|
},
|
||||||
"config": {
|
"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."
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TokenOwnersByName } from '@0x/contracts-exchange';
|
import { ObjectMap } from '@0x/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { Actor } from './base';
|
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.
|
* Utility function to convert Actors into an object mapping readable names to addresses.
|
||||||
* Useful for BalanceStore.
|
* 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));
|
return _.zipObject(actors.map(actor => actor.name), actors.map(actor => actor.address));
|
||||||
}
|
}
|
||||||
|
9
contracts/integrations/test/artifacts.ts
Normal file
9
contracts/integrations/test/artifacts.ts
Normal 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 };
|
@ -2,18 +2,17 @@ import { CoordinatorContract, SignedCoordinatorApproval } from '@0x/contracts-co
|
|||||||
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||||
import {
|
import {
|
||||||
BlockchainBalanceStore,
|
BlockchainBalanceStore,
|
||||||
constants as exchangeConstants,
|
|
||||||
ExchangeCancelEventArgs,
|
ExchangeCancelEventArgs,
|
||||||
ExchangeCancelUpToEventArgs,
|
ExchangeCancelUpToEventArgs,
|
||||||
exchangeDataEncoder,
|
exchangeDataEncoder,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
ExchangeFillEventArgs,
|
ExchangeFillEventArgs,
|
||||||
ExchangeFunctionName,
|
|
||||||
LocalBalanceStore,
|
LocalBalanceStore,
|
||||||
} from '@0x/contracts-exchange';
|
} from '@0x/contracts-exchange';
|
||||||
import {
|
import {
|
||||||
blockchainTests,
|
blockchainTests,
|
||||||
constants,
|
constants,
|
||||||
|
ExchangeFunctionName,
|
||||||
expect,
|
expect,
|
||||||
hexConcat,
|
hexConcat,
|
||||||
hexSlice,
|
hexSlice,
|
||||||
@ -174,7 +173,7 @@ blockchainTests.resets('Coordinator integration tests', env => {
|
|||||||
let transaction: SignedZeroExTransaction;
|
let transaction: SignedZeroExTransaction;
|
||||||
let approval: SignedCoordinatorApproval;
|
let approval: SignedCoordinatorApproval;
|
||||||
|
|
||||||
for (const fnName of exchangeConstants.SINGLE_FILL_FN_NAMES) {
|
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
order = await maker.signOrderAsync();
|
order = await maker.signOrderAsync();
|
||||||
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, [order]);
|
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, [order]);
|
||||||
@ -321,7 +320,7 @@ blockchainTests.resets('Coordinator integration tests', env => {
|
|||||||
let transaction: SignedZeroExTransaction;
|
let transaction: SignedZeroExTransaction;
|
||||||
let approval: SignedCoordinatorApproval;
|
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 () => {
|
before(async () => {
|
||||||
orders = [await maker.signOrderAsync(), await maker.signOrderAsync()];
|
orders = [await maker.signOrderAsync(), await maker.signOrderAsync()];
|
||||||
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Authorizable, Ownable } from '@0x/contracts-exchange';
|
|
||||||
import { constants as stakingConstants } from '@0x/contracts-staking';
|
import { constants as stakingConstants } from '@0x/contracts-staking';
|
||||||
import { blockchainTests, expect } from '@0x/contracts-test-utils';
|
import { blockchainTests, expect } from '@0x/contracts-test-utils';
|
||||||
|
|
||||||
import { DeploymentManager } from '../utils/deployment_manager';
|
import { DeploymentManager } from '../utils/deployment_manager';
|
||||||
|
import { Authorizable, Ownable } from '../utils/wrapper_interfaces';
|
||||||
|
|
||||||
blockchainTests('Deployment Manager', env => {
|
blockchainTests('Deployment Manager', env => {
|
||||||
let owner: string;
|
let owner: string;
|
||||||
|
@ -8,14 +8,11 @@ import {
|
|||||||
} from '@0x/contracts-asset-proxy';
|
} from '@0x/contracts-asset-proxy';
|
||||||
import {
|
import {
|
||||||
artifacts as exchangeArtifacts,
|
artifacts as exchangeArtifacts,
|
||||||
AssetProxyDispatcher,
|
|
||||||
Authorizable,
|
|
||||||
ExchangeAssetProxyRegisteredEventArgs,
|
ExchangeAssetProxyRegisteredEventArgs,
|
||||||
ExchangeContract,
|
ExchangeContract,
|
||||||
ExchangeEvents,
|
ExchangeEvents,
|
||||||
ExchangeProtocolFeeCollectorAddressEventArgs,
|
ExchangeProtocolFeeCollectorAddressEventArgs,
|
||||||
ExchangeProtocolFeeMultiplierEventArgs,
|
ExchangeProtocolFeeMultiplierEventArgs,
|
||||||
Ownable,
|
|
||||||
} from '@0x/contracts-exchange';
|
} from '@0x/contracts-exchange';
|
||||||
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
|
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
|
||||||
import {
|
import {
|
||||||
@ -36,6 +33,8 @@ import { AssetProxyId } from '@0x/types';
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { TxData } from 'ethereum-types';
|
import { TxData } from 'ethereum-types';
|
||||||
|
|
||||||
|
import { AssetProxyDispatcher, Authorizable, Ownable } from '../utils/wrapper_interfaces';
|
||||||
|
|
||||||
// tslint:disable:no-unnecessary-type-assertion
|
// tslint:disable:no-unnecessary-type-assertion
|
||||||
blockchainTests('Deployment and Configuration End to End Tests', env => {
|
blockchainTests('Deployment and Configuration End to End Tests', env => {
|
||||||
// Available Addresses
|
// Available Addresses
|
||||||
|
@ -2,8 +2,8 @@ import { DevUtilsContract } from '@0x/contracts-dev-utils';
|
|||||||
import { IERC20TokenEvents, IERC20TokenTransferEventArgs } from '@0x/contracts-erc20';
|
import { IERC20TokenEvents, IERC20TokenTransferEventArgs } from '@0x/contracts-erc20';
|
||||||
import {
|
import {
|
||||||
BlockchainBalanceStore,
|
BlockchainBalanceStore,
|
||||||
IExchangeEvents,
|
ExchangeEvents,
|
||||||
IExchangeFillEventArgs,
|
ExchangeFillEventArgs,
|
||||||
LocalBalanceStore,
|
LocalBalanceStore,
|
||||||
} from '@0x/contracts-exchange';
|
} from '@0x/contracts-exchange';
|
||||||
import {
|
import {
|
||||||
@ -142,7 +142,7 @@ blockchainTests.resets('fillOrder integration tests', env => {
|
|||||||
|
|
||||||
function verifyFillEvents(order: SignedOrder, receipt: TransactionReceiptWithDecodedLogs): void {
|
function verifyFillEvents(order: SignedOrder, receipt: TransactionReceiptWithDecodedLogs): void {
|
||||||
// Ensure that the fill event was correct.
|
// Ensure that the fill event was correct.
|
||||||
verifyEvents<IExchangeFillEventArgs>(
|
verifyEvents<ExchangeFillEventArgs>(
|
||||||
receipt,
|
receipt,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ blockchainTests.resets('fillOrder integration tests', env => {
|
|||||||
protocolFeePaid: DeploymentManager.protocolFee,
|
protocolFeePaid: DeploymentManager.protocolFee,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
IExchangeEvents.Fill,
|
ExchangeEvents.Fill,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Ensure that the transfer events were correctly emitted.
|
// Ensure that the transfer events were correctly emitted.
|
||||||
|
@ -9,13 +9,7 @@ import {
|
|||||||
import { artifacts as ERC1155Artifacts, ERC1155MintableContract } from '@0x/contracts-erc1155';
|
import { artifacts as ERC1155Artifacts, ERC1155MintableContract } from '@0x/contracts-erc1155';
|
||||||
import { artifacts as ERC20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
|
import { artifacts as ERC20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
|
||||||
import { artifacts as ERC721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
import { artifacts as ERC721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
import {
|
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
|
||||||
artifacts as exchangeArtifacts,
|
|
||||||
AssetProxyDispatcher,
|
|
||||||
Authorizable,
|
|
||||||
ExchangeContract,
|
|
||||||
Ownable,
|
|
||||||
} from '@0x/contracts-exchange';
|
|
||||||
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
|
import { artifacts as multisigArtifacts, ZeroExGovernorContract } from '@0x/contracts-multisig';
|
||||||
import {
|
import {
|
||||||
artifacts as stakingArtifacts,
|
artifacts as stakingArtifacts,
|
||||||
@ -28,6 +22,8 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { TxData } from 'ethereum-types';
|
import { TxData } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { AssetProxyDispatcher, Authorizable, Ownable } from './wrapper_interfaces';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a batch of authorities to a list of authorizable contracts.
|
* Adds a batch of authorities to a list of authorizable contracts.
|
||||||
* @param owner The owner of the authorizable contracts.
|
* @param owner The owner of the authorizable contracts.
|
||||||
|
6
contracts/integrations/test/wrappers.ts
Normal file
6
contracts/integrations/test/wrappers.ts
Normal 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';
|
@ -2,5 +2,5 @@
|
|||||||
"extends": "../../tsconfig",
|
"extends": "../../tsconfig",
|
||||||
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
|
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
|
||||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||||
"files": ["generated-artifacts/TestFramework.json"]
|
"files": ["generated-artifacts/TestFramework.json", "test/generated-artifacts/TestFramework.json"]
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { ExchangeFunctionName } from './types';
|
||||||
|
|
||||||
const TESTRPC_PRIVATE_KEYS_STRINGS = [
|
const TESTRPC_PRIVATE_KEYS_STRINGS = [
|
||||||
'0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
|
'0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
|
||||||
'0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
|
'0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
|
||||||
@ -84,4 +86,26 @@ export const constants = {
|
|||||||
PPM_DENOMINATOR: 1e6,
|
PPM_DENOMINATOR: 1e6,
|
||||||
PPM_100_PERCENT: 1e6,
|
PPM_100_PERCENT: 1e6,
|
||||||
MAX_CODE_SIZE: 24576,
|
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,
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -57,6 +57,7 @@ export {
|
|||||||
Token,
|
Token,
|
||||||
TokenBalances,
|
TokenBalances,
|
||||||
TransactionDataParams,
|
TransactionDataParams,
|
||||||
|
ExchangeFunctionName,
|
||||||
} from './types';
|
} from './types';
|
||||||
export { blockchainTests, BlockchainTestsEnvironment, describe } from './mocha_blockchain';
|
export { blockchainTests, BlockchainTestsEnvironment, describe } from './mocha_blockchain';
|
||||||
export { chaiSetup, expect } from './chai_setup';
|
export { chaiSetup, expect } from './chai_setup';
|
||||||
|
@ -171,3 +171,33 @@ export interface FillEventArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type Numberish = BigNumber | string | number;
|
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',
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"compile": "sol-compiler",
|
"compile": "sol-compiler",
|
||||||
"watch": "sol-compiler -w",
|
"watch": "sol-compiler -w",
|
||||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
"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",
|
"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",
|
"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",
|
"coverage:report:text": "istanbul report text",
|
||||||
|
@ -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 { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -32,7 +32,7 @@ const signature =
|
|||||||
|
|
||||||
describe('LibTransactionDecoder', () => {
|
describe('LibTransactionDecoder', () => {
|
||||||
let libTxDecoder: LibTransactionDecoderContract;
|
let libTxDecoder: LibTransactionDecoderContract;
|
||||||
const exchangeInterface = new IExchangeContract(constants.NULL_ADDRESS, provider, txDefaults);
|
const exchangeInterface = new ExchangeContract(constants.NULL_ADDRESS, provider, txDefaults);
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
libTxDecoder = await LibTransactionDecoderContract.deployFrom0xArtifactAsync(
|
libTxDecoder = await LibTransactionDecoderContract.deployFrom0xArtifactAsync(
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from '@0x/contracts-asset-proxy';
|
} from '@0x/contracts-asset-proxy';
|
||||||
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
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 {
|
import {
|
||||||
chaiSetup,
|
chaiSetup,
|
||||||
constants,
|
constants,
|
||||||
@ -93,10 +93,24 @@ describe('OrderValidationUtils/OrderTransferSimulatorUtils', () => {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
);
|
);
|
||||||
const exchangeWrapper = new ExchangeWrapper(exchange);
|
await exchange.registerAssetProxy.awaitTransactionSuccessAsync(
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
erc20Proxy.address,
|
||||||
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
|
{
|
||||||
await exchangeWrapper.registerAssetProxyAsync(multiAssetProxy.address, owner);
|
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 erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner });
|
||||||
await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner });
|
await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user