aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/wrapper.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/wrapper.ts
parent709026bf1a49d468850b4ebed845c8598fa4fd75 (diff)
downloaddexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.gz
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.zst
dexon-sol-tools-387363283ca03ac1d6c9be5b7be2107790bbf79d.zip
Remove truffle from tests
Diffstat (limited to 'packages/contracts/test/exchange/wrapper.ts')
-rw-r--r--packages/contracts/test/exchange/wrapper.ts60
1 files changed, 30 insertions, 30 deletions
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 93f9bf876..2253f4cb7 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -4,24 +4,24 @@ import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
+import * as Web3 from 'web3';
-import { Artifacts } from '../../util/artifacts';
import { Balances } from '../../util/balances';
import { constants } from '../../util/constants';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { Order } from '../../util/order';
import { OrderFactory } from '../../util/order_factory';
-import { BalancesByOwner, ContractInstance } from '../../util/types';
+import { BalancesByOwner } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
+import { deployer } from '../utils/deployer';
chaiSetup.configure();
const expect = chai.expect;
-const { Exchange, TokenTransferProxy, DummyToken, 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 tokenOwner: string;
let taker: string;
@@ -30,11 +30,12 @@ describe('Exchange', () => {
const INIT_BAL = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
const INIT_ALLOW = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
- let rep: ContractInstance;
- let dgd: ContractInstance;
- let zrx: ContractInstance;
- let exchange: ContractInstance;
- let tokenRegistry: ContractInstance;
+ let rep: Web3.ContractInstance;
+ let dgd: Web3.ContractInstance;
+ let zrx: Web3.ContractInstance;
+ let exchange: Web3.ContractInstance;
+ let tokenRegistry: Web3.ContractInstance;
+ let tokenTransferProxy: Web3.ContractInstance;
let balances: BalancesByOwner;
@@ -47,44 +48,43 @@ describe('Exchange', () => {
tokenOwner = maker = accounts[0];
taker = accounts[1] || accounts[accounts.length - 1];
feeRecipient = accounts[2] || accounts[accounts.length - 1];
- [tokenRegistry, exchange] = await Promise.all([TokenRegistry.deployed(), Exchange.deployed()]);
- exWrapper = new ExchangeWrapper(exchange);
- const [repAddress, dgdAddress, zrxAddress] = await Promise.all([
- tokenRegistry.getTokenAddressBySymbol('REP'),
- tokenRegistry.getTokenAddressBySymbol('DGD'),
- tokenRegistry.getTokenAddressBySymbol('ZRX'),
+ [rep, dgd, zrx] = await Promise.all([
+ deployer.deployAsync('DummyToken'),
+ deployer.deployAsync('DummyToken'),
+ deployer.deployAsync('DummyToken'),
]);
+ tokenRegistry = await deployer.deployAsync('TokenRegistry');
+ tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
+ 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 });
+ exWrapper = 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);
- [rep, dgd, zrx] = await Promise.all([
- DummyToken.at(repAddress),
- DummyToken.at(dgdAddress),
- DummyToken.at(zrxAddress),
- ]);
+ orderFactory = new OrderFactory(web3Wrapper, defaultOrderParams);
dmyBalances = new Balances([rep, dgd, zrx], [maker, taker, feeRecipient]);
await Promise.all([
- rep.approve(TokenTransferProxy.address, INIT_ALLOW, { from: maker }),
- rep.approve(TokenTransferProxy.address, INIT_ALLOW, { from: taker }),
+ rep.approve(tokenTransferProxy.address, INIT_ALLOW, { from: maker }),
+ rep.approve(tokenTransferProxy.address, INIT_ALLOW, { from: taker }),
rep.setBalance(maker, INIT_BAL, { from: tokenOwner }),
rep.setBalance(taker, INIT_BAL, { from: tokenOwner }),
- dgd.approve(TokenTransferProxy.address, INIT_ALLOW, { from: maker }),
- dgd.approve(TokenTransferProxy.address, INIT_ALLOW, { from: taker }),
+ dgd.approve(tokenTransferProxy.address, INIT_ALLOW, { from: maker }),
+ dgd.approve(tokenTransferProxy.address, INIT_ALLOW, { from: taker }),
dgd.setBalance(maker, INIT_BAL, { from: tokenOwner }),
dgd.setBalance(taker, INIT_BAL, { from: tokenOwner }),
- zrx.approve(TokenTransferProxy.address, INIT_ALLOW, { from: maker }),
- zrx.approve(TokenTransferProxy.address, INIT_ALLOW, { from: taker }),
+ zrx.approve(tokenTransferProxy.address, INIT_ALLOW, { from: maker }),
+ zrx.approve(tokenTransferProxy.address, INIT_ALLOW, { from: taker }),
zrx.setBalance(maker, INIT_BAL, { from: tokenOwner }),
zrx.setBalance(taker, INIT_BAL, { from: tokenOwner }),
]);