diff options
Diffstat (limited to 'packages/contracts/test/exchange/helpers.ts')
-rw-r--r-- | packages/contracts/test/exchange/helpers.ts | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 7af9866d5..965edeba8 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -5,21 +5,21 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); -import { Artifacts } from '../../util/artifacts'; +import { constants } from '../../util/constants'; import { ExchangeWrapper } from '../../util/exchange_wrapper'; import { Order } from '../../util/order'; import { OrderFactory } from '../../util/order_factory'; import { chaiSetup } from '../utils/chai_setup'; +import { deployer } from '../utils/deployer'; chaiSetup.configure(); const expect = chai.expect; -const { Exchange, TokenRegistry } = new Artifacts(artifacts); const web3 = web3Factory.create(); +const web3Wrapper = new Web3Wrapper(web3.currentProvider); const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL); describe('Exchange', () => { - const web3Wrapper = new Web3Wrapper(web3.currentProvider); let maker: string; let feeRecipient: string; @@ -31,24 +31,29 @@ describe('Exchange', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); maker = accounts[0]; feeRecipient = accounts[1] || accounts[accounts.length - 1]; - const [tokenRegistry, exchange] = await Promise.all([TokenRegistry.deployed(), Exchange.deployed()]); - exchangeWrapper = new ExchangeWrapper(exchange); - const [repAddress, dgdAddress] = await Promise.all([ - tokenRegistry.getTokenAddressBySymbol('REP'), - tokenRegistry.getTokenAddressBySymbol('DGD'), + const tokenRegistry = await deployer.deployAsync('TokenRegistry'); + const tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy'); + const [rep, dgd, zrx] = await Promise.all([ + deployer.deployAsync('DummyToken'), + deployer.deployAsync('DummyToken'), + deployer.deployAsync('DummyToken'), ]); + const exchange = await deployer.deployAsync('Exchange', [zrx.address, tokenTransferProxy.address]); + await tokenTransferProxy.addAuthorizedAddress(exchange.address, { from: accounts[0] }); + const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); + exchangeWrapper = new ExchangeWrapper(exchange, zeroEx); const defaultOrderParams = { - exchangeContractAddress: Exchange.address, + exchangeContractAddress: exchange.address, maker, feeRecipient, - makerToken: repAddress, - takerToken: dgdAddress, + makerToken: rep.address, + takerToken: dgd.address, makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18), takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18), }; - orderFactory = new OrderFactory(defaultOrderParams); + orderFactory = new OrderFactory(web3Wrapper, defaultOrderParams); order = await orderFactory.newSignedOrderAsync(); }); |