aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/helpers.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-23 04:53:32 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-30 23:01:36 +0800
commit387363283ca03ac1d6c9be5b7be2107790bbf79d (patch)
tree7f9ce518e2f4931321901dfeb2675d70854e996d /packages/contracts/test/exchange/helpers.ts
parent709026bf1a49d468850b4ebed845c8598fa4fd75 (diff)
downloaddexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.gz
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.bz2
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.lz
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.xz
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.zst
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.zip
Remove truffle from tests
Diffstat (limited to 'packages/contracts/test/exchange/helpers.ts')
-rw-r--r--packages/contracts/test/exchange/helpers.ts29
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();
});