From 6cf39896f1106f414f83cda1dc42472117e872ae Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Fri, 29 Jun 2018 13:12:46 -0700 Subject: Update expectRevertReasonOrAlwaysFailingTransactionAsync to check status codes --- packages/contracts/test/exchange/match_orders.ts | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'packages/contracts/test/exchange') diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index e23ab9851..7bdb9c385 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -651,13 +651,7 @@ describe('matchOrders', () => { }); // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( - matchOrderTester.matchOrdersAndVerifyBalancesAsync( - signedOrderLeft, - signedOrderRight, - takerAddress, - erc20BalancesByOwner, - erc721TokenIdsByOwner, - ), + exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), RevertReason.NegativeSpreadRequired, ); }); @@ -680,13 +674,7 @@ describe('matchOrders', () => { }); // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( - matchOrderTester.matchOrdersAndVerifyBalancesAsync( - signedOrderLeft, - signedOrderRight, - takerAddress, - erc20BalancesByOwner, - erc721TokenIdsByOwner, - ), + exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), // We are assuming assetData fields of the right order are the // reverse of the left order, rather than checking equality. This // saves a bunch of gas, but as a result if the assetData fields are @@ -715,13 +703,7 @@ describe('matchOrders', () => { }); // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( - matchOrderTester.matchOrdersAndVerifyBalancesAsync( - signedOrderLeft, - signedOrderRight, - takerAddress, - erc20BalancesByOwner, - erc721TokenIdsByOwner, - ), + exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), RevertReason.InvalidOrderSignature, ); }); -- cgit v1.2.3 From d4852092b84936a7c2db207899321ad2a1955e64 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Fri, 29 Jun 2018 14:34:46 -0700 Subject: Make registerAssetProxy append only --- packages/contracts/test/exchange/core.ts | 6 +- packages/contracts/test/exchange/dispatcher.ts | 161 +++++------------------ packages/contracts/test/exchange/match_orders.ts | 6 +- packages/contracts/test/exchange/transactions.ts | 4 +- packages/contracts/test/exchange/wrapper.ts | 6 +- 5 files changed, 42 insertions(+), 141 deletions(-) (limited to 'packages/contracts/test/exchange') diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 0c7381aac..682de01c2 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils'; -import { AssetProxyId, RevertReason, SignedOrder } from '@0xproject/types'; +import { RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -90,8 +90,8 @@ describe('Exchange core', () => { assetProxyUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner); await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index e35cca845..8c1052922 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -3,24 +3,29 @@ import { assetProxyUtils } from '@0xproject/order-utils'; import { AssetProxyId, RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy'; -import { TestAssetProxyDispatcherContract } from '../../src/generated_contract_wrappers/test_asset_proxy_dispatcher'; +import { + AssetProxyRegisteredContractEventArgs, + TestAssetProxyDispatcherContract, +} from '../../src/generated_contract_wrappers/test_asset_proxy_dispatcher'; import { artifacts } from '../../src/utils/artifacts'; import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; +import { LogDecoder } from '../../src/utils/log_decoder'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - +// tslint:disable:no-unnecessary-type-assertion describe('AssetProxyDispatcher', () => { let owner: string; let notOwner: string; @@ -82,14 +87,8 @@ describe('AssetProxyDispatcher', () => { }); describe('registerAssetProxy', () => { it('should record proxy upon registration', async () => { - const prevProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -98,46 +97,30 @@ describe('AssetProxyDispatcher', () => { it('should be able to record multiple proxies', async () => { // Record first proxy - const prevERC20ProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevERC20ProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); expect(proxyAddress).to.be.equal(erc20Proxy.address); // Record another proxy - const prevERC721ProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC721, - erc721Proxy.address, - prevERC721ProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, { + from: owner, + }), constants.AWAIT_TRANSACTION_MINED_MS, ); proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721); expect(proxyAddress).to.be.equal(erc721Proxy.address); }); - it('should replace proxy address upon re-registration', async () => { + it('should throw if a proxy with the same id is already registered', async () => { // Initial registration - const prevProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); - let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); + const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); expect(proxyAddress).to.be.equal(erc20Proxy.address); // Deploy a new version of the ERC20 Transfer Proxy contract const newErc20TransferProxy = await ERC20ProxyContract.deployFrom0xArtifactAsync( @@ -146,114 +129,37 @@ describe('AssetProxyDispatcher', () => { txDefaults, ); // Register new ERC20 Transfer Proxy contract - const newAddress = newErc20TransferProxy.address; - const currentAddress = erc20Proxy.address; - await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - newAddress, - currentAddress, - { from: owner }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - // Verify new asset proxy has replaced initial version - proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(newAddress); - }); - - it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => { - // Initial registration - const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20Proxy.address); - // The following transaction will throw because the currentAddress is no longer constants.NULL_ADDRESS return expectRevertReasonOrAlwaysFailingTransactionAsync( - assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - constants.NULL_ADDRESS, - { from: owner }, - ), - RevertReason.AssetProxyMismatch, + assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, { + from: owner, + }), + RevertReason.AssetProxyAlreadyExists, ); }); - it('should be able to reset proxy address to NULL', async () => { - // Initial registration - const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20Proxy.address); - // The following transaction will reset the proxy address - const newProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - newProxyAddress, - erc20Proxy.address, - { from: owner }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const finalProxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(finalProxyAddress).to.be.equal(newProxyAddress); - }); - it('should throw if requesting address is not owner', async () => { - const prevProxyAddress = constants.NULL_ADDRESS; return expectRevertReasonOrAlwaysFailingTransactionAsync( - assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: notOwner }, - ), + assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: notOwner }), RevertReason.OnlyContractOwner, ); }); - it('should throw if attempting to register a proxy to the incorrect id', async () => { - const prevProxyAddress = constants.NULL_ADDRESS; - return expectRevertReasonOrAlwaysFailingTransactionAsync( - assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC721, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), - RevertReason.AssetProxyIdMismatch, + it('should log an event with correct arguments when an asset proxy is registered', async () => { + const logDecoder = new LogDecoder(web3Wrapper, assetProxyDispatcher.address); + const txReceipt = await logDecoder.getTxWithDecodedLogsAsync( + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), ); + const logs = txReceipt.logs; + const log = logs[0] as LogWithDecodedArgs; + expect(log.args.id).to.equal(AssetProxyId.ERC20); + expect(log.args.assetProxy).to.equal(erc20Proxy.address); }); }); describe('getAssetProxy', () => { it('should return correct address of registered proxy', async () => { - const prevProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -269,14 +175,8 @@ describe('AssetProxyDispatcher', () => { describe('dispatchTransferFrom', () => { it('should dispatch transfer to registered proxy', async () => { // Register ERC20 proxy - const prevProxyAddress = constants.NULL_ADDRESS; await web3Wrapper.awaitTransactionSuccessAsync( - await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20, - erc20Proxy.address, - prevProxyAddress, - { from: owner }, - ), + await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); // Construct metadata for ERC20 proxy @@ -323,3 +223,4 @@ describe('AssetProxyDispatcher', () => { }); }); }); +// tslint:enable:no-unnecessary-type-assertion diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 7bdb9c385..3ebe7e690 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; -import { AssetProxyId, RevertReason } from '@0xproject/types'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -103,8 +103,8 @@ describe('matchOrders', () => { assetProxyUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner); // Authorize ERC20 and ERC721 trades by exchange await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index c4de58bb9..23441e7f8 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { AssetProxyId, OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0xproject/types'; +import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; @@ -91,7 +91,7 @@ describe('Exchange transactions', () => { assetProxyUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }), diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 1af8bde9d..6abb660a8 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; -import { AssetProxyId, RevertReason, SignedOrder } from '@0xproject/types'; +import { RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -87,8 +87,8 @@ describe('Exchange wrappers', () => { assetProxyUtils.encodeERC20AssetData(zrxToken.address), ); exchangeWrapper = new ExchangeWrapper(exchange, provider); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); - await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner); await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { -- cgit v1.2.3 From 2fcc36bbadcb8238ee292afc58c2cd460d1b69da Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 26 Jun 2018 19:12:43 -0700 Subject: Update file structure --- packages/contracts/test/exchange/core.ts | 30 ++++++++++---------- packages/contracts/test/exchange/dispatcher.ts | 23 ++++++++-------- packages/contracts/test/exchange/libs.ts | 14 +++++----- packages/contracts/test/exchange/match_orders.ts | 32 +++++++++++----------- .../contracts/test/exchange/signature_validator.ts | 22 +++++++-------- packages/contracts/test/exchange/transactions.ts | 32 +++++++++++----------- packages/contracts/test/exchange/wrapper.ts | 30 ++++++++++---------- 7 files changed, 91 insertions(+), 92 deletions(-) (limited to 'packages/contracts/test/exchange') diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 682de01c2..db56623f9 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -8,21 +8,21 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; -import { DummyERC721TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c721_token'; -import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; -import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy'; -import { CancelContractEventArgs, ExchangeContract } from '../../src/generated_contract_wrappers/exchange'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { ERC20BalancesByOwner } from '../../src/utils/types'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token'; +import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c721_token'; +import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_proxy'; +import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy'; +import { CancelContractEventArgs, ExchangeContract } from '../../generated_contract_wrappers/exchange'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { OrderFactory } from '../utils/order_factory'; +import { ERC20BalancesByOwner } from '../utils/types'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index 8c1052922..75e281a7c 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -6,21 +6,20 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; -import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; -import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy'; +import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token'; +import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_proxy'; +import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy'; import { AssetProxyRegisteredContractEventArgs, TestAssetProxyDispatcherContract, -} from '../../src/generated_contract_wrappers/test_asset_proxy_dispatcher'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { LogDecoder } from '../../src/utils/log_decoder'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +} from '../../generated_contract_wrappers/test_asset_proxy_dispatcher'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts index c08001198..6ded6329c 100644 --- a/packages/contracts/test/exchange/libs.ts +++ b/packages/contracts/test/exchange/libs.ts @@ -4,13 +4,13 @@ import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import { TestLibsContract } from '../../src/generated_contract_wrappers/test_libs'; -import { addressUtils } from '../../src/utils/address_utils'; -import { artifacts } from '../../src/utils/artifacts'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +import { TestLibsContract } from '../../generated_contract_wrappers/test_libs'; +import { addressUtils } from '../utils/address_utils'; +import { artifacts } from '../utils/artifacts'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { OrderFactory } from '../utils/order_factory'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 3ebe7e690..0d07d156f 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -6,22 +6,22 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; -import { DummyERC721TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c721_token'; -import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; -import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy'; -import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; -import { MatchOrderTester } from '../../src/utils/match_order_tester'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../../src/utils/types'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token'; +import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c721_token'; +import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_proxy'; +import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy'; +import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { MatchOrderTester } from '../utils/match_order_tester'; +import { OrderFactory } from '../utils/order_factory'; +import { ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../utils/types'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index 21cc343b3..1db7dfc6d 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -8,17 +8,17 @@ import ethUtil = require('ethereumjs-util'); import { SignatureValidatorApprovalContractEventArgs, TestSignatureValidatorContract, -} from '../../src/generated_contract_wrappers/test_signature_validator'; -import { TestValidatorContract } from '../../src/generated_contract_wrappers/test_validator'; -import { TestWalletContract } from '../../src/generated_contract_wrappers/test_wallet'; -import { addressUtils } from '../../src/utils/address_utils'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertOrOtherErrorAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { LogDecoder } from '../../src/utils/log_decoder'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +} from '../../generated_contract_wrappers/test_signature_validator'; +import { TestValidatorContract } from '../../generated_contract_wrappers/test_validator'; +import { TestWalletContract } from '../../generated_contract_wrappers/test_wallet'; +import { addressUtils } from '../utils/address_utils'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertOrOtherErrorAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { LogDecoder } from '../utils/log_decoder'; +import { OrderFactory } from '../utils/order_factory'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 23441e7f8..4f8b49e0e 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -5,22 +5,22 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; -import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; -import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange'; -import { ExchangeWrapperContract } from '../../src/generated_contract_wrappers/exchange_wrapper'; -import { WhitelistContract } from '../../src/generated_contract_wrappers/whitelist'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { orderUtils } from '../../src/utils/order_utils'; -import { TransactionFactory } from '../../src/utils/transaction_factory'; -import { ERC20BalancesByOwner, SignedTransaction } from '../../src/utils/types'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token'; +import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_proxy'; +import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; +import { ExchangeWrapperContract } from '../../generated_contract_wrappers/exchange_wrapper'; +import { WhitelistContract } from '../../generated_contract_wrappers/whitelist'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { OrderFactory } from '../utils/order_factory'; +import { orderUtils } from '../utils/order_utils'; +import { TransactionFactory } from '../utils/transaction_factory'; +import { ERC20BalancesByOwner, SignedTransaction } from '../utils/types'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 6abb660a8..7942f7695 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -6,21 +6,21 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c20_token'; -import { DummyERC721TokenContract } from '../../src/generated_contract_wrappers/dummy_e_r_c721_token'; -import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c20_proxy'; -import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy'; -import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange'; -import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { ERC20BalancesByOwner } from '../../src/utils/types'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; +import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token'; +import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c721_token'; +import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_proxy'; +import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy'; +import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; +import { artifacts } from '../utils/artifacts'; +import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { OrderFactory } from '../utils/order_factory'; +import { ERC20BalancesByOwner } from '../utils/types'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; -- cgit v1.2.3 From 41064adc6689deb8febcf833f6987957e845b477 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Fri, 29 Jun 2018 18:05:24 -0700 Subject: Fix build --- packages/contracts/test/exchange/dispatcher.ts | 1 + packages/contracts/test/exchange/fill_order.ts | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'packages/contracts/test/exchange') diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index 75e281a7c..afbf958d9 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -19,6 +19,7 @@ import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { ERC20Wrapper } from '../utils/erc20_wrapper'; import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { LogDecoder } from '../utils/log_decoder'; import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts index d65ab2f9a..22eb401d9 100644 --- a/packages/contracts/test/exchange/fill_order.ts +++ b/packages/contracts/test/exchange/fill_order.ts @@ -1,10 +1,8 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import * as _ from 'lodash'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../../src/utils/core_combinatorial_utils'; -import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; - +import { chaiSetup } from '../utils/chai_setup'; +import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../utils/core_combinatorial_utils'; import { AllowanceAmountScenario, AssetDataScenario, @@ -15,7 +13,8 @@ import { OrderAssetAmountScenario, TakerAssetFillAmountScenario, TakerScenario, -} from '../../src/utils/types'; +} from '../utils/types'; +import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -- cgit v1.2.3