aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/contracts/test/ether_token.ts3
-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
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts10
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts8
-rw-r--r--packages/contracts/test/token_registry.ts3
-rw-r--r--packages/contracts/test/token_transfer_proxy/auth.ts3
-rw-r--r--packages/contracts/test/token_transfer_proxy/transfer_from.ts5
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts3
-rw-r--r--packages/contracts/test/unlimited_allowance_token_v2.ts3
-rw-r--r--packages/contracts/test/zrx_token.ts3
-rw-r--r--packages/contracts/util/types.ts25
13 files changed, 60 insertions, 47 deletions
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts
index fd7321280..2bcc0e2c5 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -5,6 +5,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import { constants } from '../util/constants';
+import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -24,7 +25,7 @@ describe('EtherToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
account = accounts[0];
- const etherToken = await deployer.deployAsync('WETH9');
+ const etherToken = await deployer.deployAsync(ContractName.EtherToken);
etherTokenAddress = etherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
gasPrice,
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);
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index ff8a01d14..eee923020 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -9,7 +9,7 @@ import * as multiSigWalletJSON from '../../build/contracts/MultiSigWalletWithTim
import { artifacts } from '../util/artifacts';
import { constants } from '../util/constants';
import { MultiSigWrapper } from '../util/multi_sig_wrapper';
-import { SubmissionContractEventArgs } from '../util/types';
+import { ContractName, SubmissionContractEventArgs } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -52,7 +52,11 @@ describe('MultiSigWalletWithTimeLock', () => {
describe('changeTimeLock', () => {
describe('initially non-time-locked', async () => {
before('deploy a walet', async () => {
- multiSig = await deployer.deployAsync('MultiSigWalletWithTimeLock', [owners, SIGNATURES_REQUIRED, 0]);
+ multiSig = await deployer.deployAsync(ContractName.MultiSigWalletWithTimeLock, [
+ owners,
+ SIGNATURES_REQUIRED,
+ 0,
+ ]);
multiSigWrapper = new MultiSigWrapper(multiSig);
const secondsTimeLocked = await multiSig.secondsTimeLocked();
@@ -140,7 +144,7 @@ describe('MultiSigWalletWithTimeLock', () => {
});
describe('initially time-locked', async () => {
before('deploy a walet', async () => {
- multiSig = await deployer.deployAsync('MultiSigWalletWithTimeLock', [
+ multiSig = await deployer.deployAsync(ContractName.MultiSigWalletWithTimeLock, [
owners,
SIGNATURES_REQUIRED,
SECONDS_TIME_LOCKED,
diff --git a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
index e8261b6f1..826815265 100644
--- a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
@@ -9,7 +9,7 @@ import { artifacts } from '../util/artifacts';
import { constants } from '../util/constants';
import { crypto } from '../util/crypto';
import { MultiSigWrapper } from '../util/multi_sig_wrapper';
-import { SubmissionContractEventArgs, TransactionDataParams } from '../util/types';
+import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -52,11 +52,11 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
.slice(0, 20)
.toString('hex')}`;
const initialOwner = accounts[0];
- tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
+ tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
await tokenTransferProxy.addAuthorizedAddress(authorizedAddress, {
from: initialOwner,
});
- multiSig = await deployer.deployAsync('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', [
+ multiSig = await deployer.deployAsync(ContractName.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress, [
owners,
requiredApprovals,
SECONDS_TIME_LOCKED,
@@ -106,7 +106,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
});
it('should throw if tx destination is not the tokenTransferProxy', async () => {
- const invalidTokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
+ const invalidTokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
const invalidDestination = invalidTokenTransferProxy.address;
const dataParams: TransactionDataParams = {
name: 'removeAuthorizedAddress',
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
index 549b2f175..f84a99e8f 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -8,6 +8,7 @@ import * as Web3 from 'web3';
import { constants } from '../util/constants';
import { TokenRegWrapper } from '../util/token_registry_wrapper';
+import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -27,7 +28,7 @@ describe('TokenRegistry', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
notOwner = accounts[1];
- tokenReg = await deployer.deployAsync('TokenRegistry');
+ tokenReg = await deployer.deployAsync(ContractName.TokenRegistry);
tokenRegWrapper = new TokenRegWrapper(tokenReg);
});
beforeEach(async () => {
diff --git a/packages/contracts/test/token_transfer_proxy/auth.ts b/packages/contracts/test/token_transfer_proxy/auth.ts
index 6b9767148..52e7d3f02 100644
--- a/packages/contracts/test/token_transfer_proxy/auth.ts
+++ b/packages/contracts/test/token_transfer_proxy/auth.ts
@@ -4,6 +4,7 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { constants } from '../../util/constants';
+import { ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
@@ -22,7 +23,7 @@ describe('TokenTransferProxy', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = address = accounts[0];
notOwner = accounts[1];
- tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
+ tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
diff --git a/packages/contracts/test/token_transfer_proxy/transfer_from.ts b/packages/contracts/test/token_transfer_proxy/transfer_from.ts
index deabf8fbc..3e88d9432 100644
--- a/packages/contracts/test/token_transfer_proxy/transfer_from.ts
+++ b/packages/contracts/test/token_transfer_proxy/transfer_from.ts
@@ -5,6 +5,7 @@ import * as Web3 from 'web3';
import { Balances } from '../../util/balances';
import { constants } from '../../util/constants';
+import { ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
@@ -28,8 +29,8 @@ describe('TokenTransferProxy', () => {
before(async () => {
accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = notAuthorized = accounts[0];
- tokenTransferProxy = await deployer.deployAsync('TokenTransferProxy');
- rep = await deployer.deployAsync('DummyToken');
+ tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
+ rep = await deployer.deployAsync(ContractName.DummyToken);
dmyBalances = new Balances([rep], [accounts[0], accounts[1]]);
await Promise.all([
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index b21bb8323..1c66c39b8 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -6,6 +6,7 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { constants } from '../util/constants';
+import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -32,7 +33,7 @@ describe('UnlimitedAllowanceToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- token = await deployer.deployAsync('DummyToken');
+ token = await deployer.deployAsync(ContractName.DummyToken);
await token.mint(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});
diff --git a/packages/contracts/test/unlimited_allowance_token_v2.ts b/packages/contracts/test/unlimited_allowance_token_v2.ts
index d97259cd2..a36e44154 100644
--- a/packages/contracts/test/unlimited_allowance_token_v2.ts
+++ b/packages/contracts/test/unlimited_allowance_token_v2.ts
@@ -6,6 +6,7 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { constants } from '../util/constants';
+import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -32,7 +33,7 @@ describe('UnlimitedAllowanceTokenV2', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- token = await deployer.deployAsync('DummyToken_v2');
+ token = await deployer.deployAsync(ContractName.DummyToken_v2);
await token.mint(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index ffc3ec17f..2caef7da8 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -6,6 +6,7 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { constants } from '../util/constants';
+import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
@@ -33,7 +34,7 @@ describe('ZRXToken', () => {
zeroEx = new ZeroEx(web3.currentProvider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
- zrx = await deployer.deployAsync('ZRXToken');
+ zrx = await deployer.deployAsync(ContractName.ZRXToken);
zrxAddress = zrx.address;
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
diff --git a/packages/contracts/util/types.ts b/packages/contracts/util/types.ts
index baeb15577..0db04cd76 100644
--- a/packages/contracts/util/types.ts
+++ b/packages/contracts/util/types.ts
@@ -119,20 +119,21 @@ export enum ExchangeContractErrs {
ERROR_INSUFFICIENT_BALANCE_OR_ALLOWANCE,
}
-export type ArtifactContractName =
- | 'TokenTransferProxy'
- | 'TokenRegistry'
- | 'MultiSigWalletWithTimeLock'
- | 'Exchange'
- | 'ZRXToken'
- | 'DummyToken'
- | 'DummyToken_v2'
- | 'WETH9'
- | 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress'
- | 'MaliciousToken';
+export enum ContractName {
+ TokenTransferProxy = 'TokenTransferProxy',
+ TokenRegistry = 'TokenRegistry',
+ MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
+ Exchange = 'Exchange',
+ ZRXToken = 'ZRXToken',
+ DummyToken = 'DummyToken',
+ DummyToken_v2 = 'DummyToken_v2',
+ EtherToken = 'WETH9',
+ MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
+ MaliciousToken = 'MaliciousToken',
+}
export interface Artifact {
- contract_name: ArtifactContractName;
+ contract_name: ContractName;
networks: {
[networkId: number]: {
abi: Web3.ContractAbi;