diff options
Diffstat (limited to 'contracts/extensions/test')
-rw-r--r-- | contracts/extensions/test/balance_threshold_filter.ts | 6 | ||||
-rw-r--r-- | contracts/extensions/test/dutch_auction.ts | 18 | ||||
-rw-r--r-- | contracts/extensions/test/order_matcher.ts | 47 | ||||
-rw-r--r-- | contracts/extensions/test/order_validator.ts | 18 | ||||
-rw-r--r-- | contracts/extensions/test/utils/balance_threshold_wrapper.ts | 15 | ||||
-rw-r--r-- | contracts/extensions/test/utils/dutch_auction_test_wrapper.ts | 10 |
6 files changed, 51 insertions, 63 deletions
diff --git a/contracts/extensions/test/balance_threshold_filter.ts b/contracts/extensions/test/balance_threshold_filter.ts index c79a72f5a..34eb319de 100644 --- a/contracts/extensions/test/balance_threshold_filter.ts +++ b/contracts/extensions/test/balance_threshold_filter.ts @@ -1,3 +1,4 @@ +import { ExchangeWrapper } from '@0x/contracts-exchange'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; import { Order, RevertReason, SignedOrder } from '@0x/types'; @@ -9,7 +10,6 @@ import * as _ from 'lodash'; import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; import { DummyERC20TokenContract } from '@0x/contracts-erc20'; -import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -24,7 +24,7 @@ import { web3Wrapper, } from '@0x/contracts-test-utils'; -import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper } from '../src'; +import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper, ExchangeContract } from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -127,7 +127,7 @@ describe(ContractName.BalanceThresholdFilter, () => { await erc20Wrapper.setBalancesAndAllowancesAsync(); // Deploy Exchange contract exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - exchangeArtifacts.Exchange, + artifacts.Exchange, provider, txDefaults, zrxAssetData, diff --git a/contracts/extensions/test/dutch_auction.ts b/contracts/extensions/test/dutch_auction.ts index 34ff25c3d..efe813ffc 100644 --- a/contracts/extensions/test/dutch_auction.ts +++ b/contracts/extensions/test/dutch_auction.ts @@ -1,8 +1,6 @@ import { DutchAuctionWrapper } from '@0x/contract-wrappers'; import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; -import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20'; -import { DummyERC721TokenContract } from '@0x/contracts-erc721'; -import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; +import { ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -23,7 +21,15 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { artifacts, DutchAuctionContract, DutchAuctionTestWrapper } from '../src'; +import { + artifacts, + DummyERC20TokenContract, + DummyERC721TokenContract, + DutchAuctionContract, + DutchAuctionTestWrapper, + ExchangeContract, + WETH9Contract, +} from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -82,12 +88,12 @@ describe(ContractName.DutchAuction, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults); erc20Wrapper.addDummyTokenContract(wethContract as any); const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - exchangeArtifacts.Exchange, + artifacts.Exchange, provider, txDefaults, zrxAssetData, diff --git a/contracts/extensions/test/order_matcher.ts b/contracts/extensions/test/order_matcher.ts index 0b2f9ddbb..d726de8e0 100644 --- a/contracts/extensions/test/order_matcher.ts +++ b/contracts/extensions/test/order_matcher.ts @@ -1,17 +1,5 @@ -import { - artifacts as proxyArtifacts, - ERC20ProxyContract, - ERC20Wrapper, - ERC721ProxyContract, -} from '@0x/contracts-asset-proxy'; -import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20'; -import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721'; -import { - artifacts as exchangeArtifacts, - ExchangeContract, - ExchangeFillEventArgs, - ExchangeWrapper, -} from '@0x/contracts-exchange'; +import { ERC20Wrapper } from '@0x/contracts-asset-proxy'; +import { ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -34,7 +22,16 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts, OrderMatcherContract } from '../src'; +import { + artifacts, + DummyERC20TokenContract, + DummyERC721TokenContract, + ERC20ProxyContract, + ERC721ProxyContract, + ExchangeContract, + ExchangeFillEventArgs, + OrderMatcherContract, +} from '../src'; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); chaiSetup.configure(); @@ -104,14 +101,10 @@ describe('OrderMatcher', () => { erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); // Deploy ERC721 proxy - erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync( - proxyArtifacts.ERC721Proxy, - provider, - txDefaults, - ); + erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(artifacts.ERC721Proxy, provider, txDefaults); // Depoy exchange exchange = await ExchangeContract.deployFrom0xArtifactAsync( - exchangeArtifacts.Exchange, + artifacts.Exchange, provider, txDefaults, assetDataUtils.encodeERC20AssetData(zrxToken.address), @@ -200,7 +193,7 @@ describe('OrderMatcher', () => { describe('constructor', () => { it('should revert if assetProxy is unregistered', async () => { const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - exchangeArtifacts.Exchange, + artifacts.Exchange, provider, txDefaults, constants.NULL_BYTES, @@ -454,7 +447,7 @@ describe('OrderMatcher', () => { signedOrderLeft.signature, signedOrderRight.signature, ); - const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts }); + const logDecoder = new LogDecoder(web3Wrapper, artifacts); const txReceipt = await logDecoder.getTxWithDecodedLogsAsync( await web3Wrapper.sendTransactionAsync({ data, @@ -492,7 +485,7 @@ describe('OrderMatcher', () => { signedOrderLeft.signature, signedOrderRight.signature, ); - const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts }); + const logDecoder = new LogDecoder(web3Wrapper, artifacts); const txReceipt = await logDecoder.getTxWithDecodedLogsAsync( await web3Wrapper.sendTransactionAsync({ data, @@ -729,7 +722,7 @@ describe('OrderMatcher', () => { }); it('should allow owner to withdraw ERC721 tokens', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - erc721Artifacts.DummyERC721Token, + artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, @@ -774,7 +767,7 @@ describe('OrderMatcher', () => { }); it('should be able to approve an ERC721 token by passing in allowance = 1', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - erc721Artifacts.DummyERC721Token, + artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, @@ -791,7 +784,7 @@ describe('OrderMatcher', () => { }); it('should be able to approve an ERC721 token by passing in allowance > 1', async () => { const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync( - erc721Artifacts.DummyERC721Token, + artifacts.DummyERC721Token, provider, txDefaults, constants.DUMMY_TOKEN_NAME, diff --git a/contracts/extensions/test/order_validator.ts b/contracts/extensions/test/order_validator.ts index 88dae14fb..ec31cafbc 100644 --- a/contracts/extensions/test/order_validator.ts +++ b/contracts/extensions/test/order_validator.ts @@ -1,7 +1,5 @@ -import { ERC20ProxyContract, ERC20Wrapper, ERC721ProxyContract, ERC721Wrapper } from '@0x/contracts-asset-proxy'; -import { DummyERC20TokenContract } from '@0x/contracts-erc20'; -import { DummyERC721TokenContract } from '@0x/contracts-erc721'; -import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange'; +import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy'; +import { ExchangeWrapper } from '@0x/contracts-exchange'; import { chaiSetup, constants, @@ -18,7 +16,15 @@ import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { artifacts, OrderValidatorContract } from '../src'; +import { + artifacts, + DummyERC20TokenContract, + DummyERC721TokenContract, + ERC20ProxyContract, + ERC721ProxyContract, + ExchangeContract, + OrderValidatorContract, +} from '../src'; chaiSetup.configure(); const expect = chai.expect; @@ -74,7 +80,7 @@ describe('OrderValidator', () => { const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); exchange = await ExchangeContract.deployFrom0xArtifactAsync( - exchangeArtifacts.Exchange, + artifacts.Exchange, provider, txDefaults, zrxAssetData, diff --git a/contracts/extensions/test/utils/balance_threshold_wrapper.ts b/contracts/extensions/test/utils/balance_threshold_wrapper.ts index 3178d992e..ab59c5688 100644 --- a/contracts/extensions/test/utils/balance_threshold_wrapper.ts +++ b/contracts/extensions/test/utils/balance_threshold_wrapper.ts @@ -1,6 +1,3 @@ -import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; -import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; -import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange'; import { FillResults, formatters, @@ -15,8 +12,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter'; -import { artifacts } from '../../src/artifacts'; +import { artifacts, BalanceThresholdFilterContract, ExchangeContract } from '../../src'; export class BalanceThresholdWrapper { private readonly _balanceThresholdFilter: BalanceThresholdFilterContract; @@ -34,12 +30,7 @@ export class BalanceThresholdWrapper { this._exchange = exchangeContract; this._signerTransactionFactory = signerTransactionFactory; this._web3Wrapper = new Web3Wrapper(provider); - this._logDecoder = new LogDecoder(this._web3Wrapper, { - ...artifacts, - ...erc20Artifacts, - ...erc721Artifacts, - ...exchangeArtifacts, - }); + this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts); } public async fillOrderAsync( signedOrder: SignedOrder, @@ -227,7 +218,7 @@ export class BalanceThresholdWrapper { from: string, ): Promise<TransactionReceiptWithDecodedLogs> { const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight); - const data = await this._exchange.matchOrders.getABIEncodedTransactionData( + const data = this._exchange.matchOrders.getABIEncodedTransactionData( params.left, params.right, params.leftSignature, diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts index 5899ffcac..06cdc21d5 100644 --- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -1,6 +1,3 @@ -import { artifacts as erc20Artifacts } from '@0x/contracts-erc20'; -import { artifacts as erc721Artifacts } from '@0x/contracts-erc721'; -import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange'; import { LogDecoder } from '@0x/contracts-test-utils'; import { DutchAuctionDetails, SignedOrder } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; @@ -18,12 +15,7 @@ export class DutchAuctionTestWrapper { constructor(contractInstance: DutchAuctionContract, provider: Provider) { this._dutchAuctionContract = contractInstance; this._web3Wrapper = new Web3Wrapper(provider); - this._logDecoder = new LogDecoder(this._web3Wrapper, { - ...artifacts, - ...erc20Artifacts, - ...erc721Artifacts, - ...exchangeArtifacts, - }); + this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts); } /** * Matches the buy and sell orders at an amount given the following: the current block time, the auction |