aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-26 18:39:31 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-30 23:01:37 +0800
commit9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c (patch)
treeb8c0c1efc2558b750a4ccfead3bd5d4e19bf0d08 /packages/contracts/test/exchange
parent6f13d107c4ca90049249e44a90b45cac2b490762 (diff)
downloaddexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar.gz
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar.bz2
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar.lz
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar.xz
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.tar.zst
dexon-sol-tools-9d62e5fb6f0dc6dc451604f02fb4374a36fcac3c.zip
Use an enum for contract name
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r--packages/contracts/test/exchange/core.ts14
-rw-r--r--packages/contracts/test/exchange/helpers.ts13
-rw-r--r--packages/contracts/test/exchange/wrapper.ts14
3 files changed, 21 insertions, 20 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index ac8c7229e..f2e330507 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -19,7 +19,7 @@ import { crypto } from '../../util/crypto';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { Order } from '../../util/order';
import { OrderFactory } from '../../util/order_factory';
-import { BalancesByOwner, ExchangeContractErrs } from '../../util/types';
+import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
@@ -58,12 +58,12 @@ describe('Exchange', () => {
taker = accounts[1] || accounts[accounts.length - 1];
feeRecipient = accounts[2] || accounts[accounts.length - 1];
[rep, dgd, zrx] = await Promise.all([
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
]);
- tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
- exchange = await deployer.deployAsync('Exchange', [zrx.address, tokenTransferProxy.address]);
+ tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
+ exchange = await deployer.deployAsync(ContractName.Exchange, [zrx.address, tokenTransferProxy.address]);
await tokenTransferProxy.addAuthorizedAddress(exchange.address, { from: accounts[0] });
zeroEx = new ZeroEx(web3.currentProvider, {
exchangeContractAddress: exchange.address,
@@ -669,7 +669,7 @@ describe('Exchange', () => {
it('should throw if getBalance or getAllowance attempts to change state and \
shouldThrowOnInsufficientBalanceOrAllowance = false', async () => {
- const maliciousToken = await deployer.deployAsync('MaliciousToken');
+ const maliciousToken = await deployer.deployAsync(ContractName.MaliciousToken);
await maliciousToken.approve(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: taker });
order = await orderFactory.newSignedOrderAsync({
diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts
index 965edeba8..a4707452e 100644
--- a/packages/contracts/test/exchange/helpers.ts
+++ b/packages/contracts/test/exchange/helpers.ts
@@ -9,6 +9,7 @@ import { constants } from '../../util/constants';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { Order } from '../../util/order';
import { OrderFactory } from '../../util/order_factory';
+import { ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
@@ -31,14 +32,14 @@ describe('Exchange', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
maker = accounts[0];
feeRecipient = accounts[1] || accounts[accounts.length - 1];
- const tokenRegistry = await deployer.deployAsync('TokenRegistry');
- const tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
+ const tokenRegistry = await deployer.deployAsync(ContractName.TokenRegistry);
+ const tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
const [rep, dgd, zrx] = await Promise.all([
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
]);
- const exchange = await deployer.deployAsync('Exchange', [zrx.address, tokenTransferProxy.address]);
+ const exchange = await deployer.deployAsync(ContractName.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);
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 2253f4cb7..c749c016e 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -11,7 +11,7 @@ import { constants } from '../../util/constants';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { Order } from '../../util/order';
import { OrderFactory } from '../../util/order_factory';
-import { BalancesByOwner } from '../../util/types';
+import { BalancesByOwner, ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
@@ -49,13 +49,13 @@ describe('Exchange', () => {
taker = accounts[1] || accounts[accounts.length - 1];
feeRecipient = accounts[2] || accounts[accounts.length - 1];
[rep, dgd, zrx] = await Promise.all([
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
- deployer.deployAsync('DummyToken'),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
+ deployer.deployAsync(ContractName.DummyToken),
]);
- tokenRegistry = await deployer.deployAsync('TokenRegistry');
- tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
- exchange = await deployer.deployAsync('Exchange', [zrx.address, tokenTransferProxy.address]);
+ tokenRegistry = await deployer.deployAsync(ContractName.TokenRegistry);
+ tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
+ exchange = await deployer.deployAsync(ContractName.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);