aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
committerFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
commitd370296e82c11d67bbb16a1dc73432c3625682aa (patch)
treec8e5d440bc2b78feae89644c11ba3ed778da6015 /packages/contracts
parentf78b5741c3ba3495c066dc800ce62d8a1f3fb75f (diff)
parentf42f608f3f97a5244f09f17ae5ee184c0f775de3 (diff)
downloaddexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.gz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.zst
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.zip
Merge branch 'development' into breakUp0xjs
* development: Fix ganache subprovider config Fix a bug in compiler config precedence Fix linter errors Fix templates Remove unused deployer docs configs Add a legacy endpoint for the deployer Add a check for compiler output Add a comment Put ARTIFACTS_VERSION in a config Improve a comment Remove _applyDefaultsToDeployTxDataAsync Add a HACK comment Fix linter issues Rename deployer to sol-compiler Remove deployer Remove deployer from 0x.js and migrations Configure migrations with a compiler.json Remove deployer from metacoin and contract tests Update wallet footer and add remove token functionality # Conflicts: # .gitignore # packages/0x.js/package.json # packages/0x.js/src/0x.ts # packages/contracts/package.json # packages/contracts/test/multi_sig_with_time_lock.ts # packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts # packages/contracts/util/artifacts.ts # packages/deployer/test/deployer_test.ts # packages/migrations/package.json
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/package.json11
-rw-r--r--packages/contracts/test/ether_token.ts8
-rw-r--r--packages/contracts/test/exchange/core.ts62
-rw-r--r--packages/contracts/test/exchange/helpers.ts61
-rw-r--r--packages/contracts/test/exchange/wrapper.ts62
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts26
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts38
-rw-r--r--packages/contracts/test/token_registry.ts7
-rw-r--r--packages/contracts/test/token_transfer_proxy/auth.ts12
-rw-r--r--packages/contracts/test/token_transfer_proxy/transfer_from.ts24
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts98
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts15
-rw-r--r--packages/contracts/test/utils/deployer.ts18
-rw-r--r--packages/contracts/test/utils/web3_wrapper.ts6
-rw-r--r--packages/contracts/test/zrx_token.ts7
-rw-r--r--packages/contracts/util/artifacts.ts8
-rw-r--r--packages/contracts/util/constants.ts10
17 files changed, 303 insertions, 170 deletions
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 891488bd9..557effca2 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -16,17 +16,17 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
- "compile": "node ../deployer/lib/src/cli.js compile",
+ "compile": "node ../sol-compiler/lib/src/cli.js",
"clean": "shx rm -rf lib src/contract_wrappers/generated",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
- "lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
+ "lint": "tslint --project .",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test:coverage"
},
"config": {
- "abis": "../migrations/artifacts/1.0.0/@(DummyToken|TokenTransferProxy|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken|Arbitrage|EtherDelta|AccountLevels).json"
+ "abis": "../migrations/artifacts/1.0.0/@(DummyToken|TokenTransferProxy|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken|Arbitrage|EtherDelta|AccountLevels|WETH9|MaliciousToken).json"
},
"repository": {
"type": "git",
@@ -60,7 +60,8 @@
},
"dependencies": {
"0x.js": "^0.37.2",
- "@0xproject/deployer": "^0.4.3",
+ "@0xproject/base-contract": "^0.3.1",
+ "@0xproject/sol-compiler": "^0.4.3",
"@0xproject/types": "^0.6.3",
"@0xproject/typescript-typings": "^0.3.1",
"@0xproject/utils": "^0.6.1",
@@ -68,7 +69,7 @@
"bn.js": "^4.11.8",
"ethereumjs-abi": "^0.6.4",
"ethereumjs-util": "^5.1.1",
- "ethers-contracts": "^2.2.1",
+ "ethers": "^3.0.15",
"lodash": "^4.17.4",
"web3": "^0.20.0"
}
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts
index bb6d4cbec..4eb901dc7 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -4,12 +4,14 @@ import { BigNumber, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
+import { WETH9Contract } from '../src/contract_wrappers/generated/weth9';
+import { artifacts } from '../util/artifacts';
import { constants } from '../util/constants';
import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -24,7 +26,7 @@ describe('EtherToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
account = accounts[0];
- const etherToken = await deployer.deployAsync(ContractName.EtherToken);
+ const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
etherTokenAddress = etherToken.address;
zeroEx = new ZeroEx(provider, {
gasPrice,
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 689b11062..e40b564c6 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -13,7 +13,9 @@ import {
LogErrorContractEventArgs,
LogFillContractEventArgs,
} from '../../src/contract_wrappers/generated/exchange';
+import { MaliciousTokenContract } from '../../src/contract_wrappers/generated/malicious_token';
import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
import { Balances } from '../../util/balances';
import { constants } from '../../util/constants';
import { crypto } from '../../util/crypto';
@@ -21,8 +23,8 @@ import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { OrderFactory } from '../../util/order_factory';
import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -54,25 +56,47 @@ describe('Exchange', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
maker = accounts[0];
[tokenOwner, taker, feeRecipient] = accounts;
- const [repInstance, dgdInstance, zrxInstance] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ [rep, dgd, zrx] = await Promise.all([
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
]);
- rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider);
- dgd = new DummyTokenContract(dgdInstance.abi, dgdInstance.address, provider);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
- const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy);
- tokenTransferProxy = new TokenTransferProxyContract(
- tokenTransferProxyInstance.abi,
- tokenTransferProxyInstance.address,
+ tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
provider,
+ txDefaults,
);
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
zrx.address,
tokenTransferProxy.address,
- ]);
- exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
+ );
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
zeroEx = new ZeroEx(provider, {
exchangeContractAddress: exchange.address,
@@ -689,7 +713,11 @@ describe('Exchange', () => {
it('should throw if getBalance or getAllowance attempts to change state and \
shouldThrowOnInsufficientBalanceOrAllowance = false', async () => {
- const maliciousToken = await deployer.deployAsync(ContractName.MaliciousToken);
+ const maliciousToken = await MaliciousTokenContract.deployFrom0xArtifactAsync(
+ artifacts.MaliciousToken,
+ provider,
+ txDefaults,
+ );
await maliciousToken.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, {
from: taker,
});
diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts
index 8fc30c0b5..441c1bc28 100644
--- a/packages/contracts/test/exchange/helpers.ts
+++ b/packages/contracts/test/exchange/helpers.ts
@@ -11,13 +11,18 @@ import {
LogErrorContractEventArgs,
LogFillContractEventArgs,
} from '../../src/contract_wrappers/generated/exchange';
+
+import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
+import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry';
+import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
import { constants } from '../../util/constants';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { OrderFactory } from '../../util/order_factory';
import { ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -35,19 +40,53 @@ describe('Exchange', () => {
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
[maker, feeRecipient] = accounts;
- const tokenRegistry = await deployer.deployAsync(ContractName.TokenRegistry);
- const tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
+ const tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
+ artifacts.TokenRegistry,
+ provider,
+ txDefaults,
+ );
+ const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
+ provider,
+ txDefaults,
+ );
const [rep, dgd, zrx] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
]);
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
zrx.address,
tokenTransferProxy.address,
- ]);
- const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
- await tokenTransferProxy.addAuthorizedAddress(exchange.address, { from: accounts[0] });
+ );
+ await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
const defaultOrderParams = {
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index c658dca79..57ccd05bd 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -15,14 +15,15 @@ import {
} from '../../src/contract_wrappers/generated/exchange';
import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry';
import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
import { Balances } from '../../util/balances';
import { constants } from '../../util/constants';
import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { OrderFactory } from '../../util/order_factory';
import { BalancesByOwner, ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -54,27 +55,52 @@ describe('Exchange', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
tokenOwner = accounts[0];
[maker, taker, feeRecipient] = accounts;
- const [repInstance, dgdInstance, zrxInstance] = await Promise.all([
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
- deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS),
+ [rep, dgd, zrx] = await Promise.all([
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
]);
- rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider);
- dgd = new DummyTokenContract(dgdInstance.abi, dgdInstance.address, provider);
- zrx = new DummyTokenContract(zrxInstance.abi, zrxInstance.address, provider);
- const tokenRegistryInstance = await deployer.deployAsync(ContractName.TokenRegistry);
- tokenRegistry = new TokenRegistryContract(tokenRegistryInstance.abi, tokenRegistryInstance.address, provider);
- const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy);
- tokenTransferProxy = new TokenTransferProxyContract(
- tokenTransferProxyInstance.abi,
- tokenTransferProxyInstance.address,
+ tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
+ artifacts.TokenRegistry,
+ provider,
+ txDefaults,
+ );
+ tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
provider,
+ txDefaults,
);
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
zrx.address,
tokenTransferProxy.address,
- ]);
- exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
+ );
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
const zeroEx = new ZeroEx(provider, { 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 cf3893780..01bc0ec90 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -14,8 +14,8 @@ import { MultiSigWrapper } from '../util/multi_sig_wrapper';
import { ContractName, SubmissionContractEventArgs } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.compilerOutput.abi;
chaiSetup.configure();
@@ -47,15 +47,13 @@ describe('MultiSigWalletWithTimeLock', () => {
describe('changeTimeLock', () => {
describe('initially non-time-locked', async () => {
before('deploy a wallet', async () => {
- const multiSigInstance = await deployer.deployAsync(ContractName.MultiSigWalletWithTimeLock, [
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
owners,
SIGNATURES_REQUIRED,
- 0,
- ]);
- multiSig = new MultiSigWalletWithTimeLockContract(
- multiSigInstance.abi,
- multiSigInstance.address,
- provider,
+ new BigNumber(0),
);
multiSigWrapper = new MultiSigWrapper((multiSig as any) as MultiSigWalletContract);
@@ -144,15 +142,13 @@ describe('MultiSigWalletWithTimeLock', () => {
});
describe('initially time-locked', async () => {
before('deploy a wallet', async () => {
- const multiSigInstance = await deployer.deployAsync(ContractName.MultiSigWalletWithTimeLock, [
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
owners,
SIGNATURES_REQUIRED,
SECONDS_TIME_LOCKED,
- ]);
- multiSig = new MultiSigWalletWithTimeLockContract(
- multiSigInstance.abi,
- multiSigInstance.address,
- provider,
);
multiSigWrapper = new MultiSigWrapper((multiSig as any) as MultiSigWalletContract);
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 3ff5b82ed..775d43d22 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
@@ -1,6 +1,6 @@
import { LogWithDecodedArgs, ZeroEx } from '0x.js';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
-import { AbiDecoder } from '@0xproject/utils';
+import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as Web3 from 'web3';
@@ -15,8 +15,9 @@ import { MultiSigWrapper } from '../util/multi_sig_wrapper';
import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
+
const PROXY_ABI = artifacts.TokenTransferProxy.compilerOutput.abi;
const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI =
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.compilerOutput.abi;
@@ -29,8 +30,8 @@ const abiDecoder = new AbiDecoder([MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_A
describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
let owners: string[];
- const requiredApprovals = 2;
- const SECONDS_TIME_LOCKED = 1000000;
+ const requiredApprovals = new BigNumber(2);
+ const SECONDS_TIME_LOCKED = new BigNumber(1000000);
// initialize fake addresses
let authorizedAddress: string;
@@ -46,23 +47,22 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
owners = [accounts[0], accounts[1]];
[authorizedAddress, unauthorizedAddress] = accounts;
const initialOwner = accounts[0];
- const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy);
- tokenTransferProxy = new TokenTransferProxyContract(
- tokenTransferProxyInstance.abi,
- tokenTransferProxyInstance.address,
+ tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
provider,
+ txDefaults,
);
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, {
from: initialOwner,
});
- const multiSigInstance = await deployer.deployAsync(
- ContractName.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
- [owners, requiredApprovals, SECONDS_TIME_LOCKED, tokenTransferProxy.address],
- );
- multiSig = new MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract(
- multiSigInstance.abi,
- multiSigInstance.address,
+ multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
provider,
+ txDefaults,
+ owners,
+ requiredApprovals,
+ SECONDS_TIME_LOCKED,
+ tokenTransferProxy.address,
);
await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, {
from: initialOwner,
@@ -110,7 +110,11 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
});
it('should throw if tx destination is not the tokenTransferProxy', async () => {
- const invalidTokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
+ const invalidTokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
+ provider,
+ txDefaults,
+ );
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 4c404176b..8b7c3048d 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -8,13 +8,13 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import { TokenRegistryContract } from '../src/contract_wrappers/generated/token_registry';
+import { artifacts } from '../util/artifacts';
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';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -29,8 +29,7 @@ describe('TokenRegistry', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
notOwner = accounts[1];
- const tokenRegInstance = await deployer.deployAsync(ContractName.TokenRegistry);
- tokenReg = new TokenRegistryContract(tokenRegInstance.abi, tokenRegInstance.address, provider);
+ tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults);
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 885ff3bc1..97e8d0c2e 100644
--- a/packages/contracts/test/token_transfer_proxy/auth.ts
+++ b/packages/contracts/test/token_transfer_proxy/auth.ts
@@ -4,11 +4,12 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
import { constants } from '../../util/constants';
import { ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -23,11 +24,10 @@ describe('TokenTransferProxy', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = address = accounts[0];
notOwner = accounts[1];
- const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy);
- tokenTransferProxy = new TokenTransferProxyContract(
- tokenTransferProxyInstance.abi,
- tokenTransferProxyInstance.address,
+ tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
provider,
+ txDefaults,
);
});
beforeEach(async () => {
diff --git a/packages/contracts/test/token_transfer_proxy/transfer_from.ts b/packages/contracts/test/token_transfer_proxy/transfer_from.ts
index dff1a0cfb..c31d8a1cb 100644
--- a/packages/contracts/test/token_transfer_proxy/transfer_from.ts
+++ b/packages/contracts/test/token_transfer_proxy/transfer_from.ts
@@ -6,12 +6,13 @@ import * as Web3 from 'web3';
import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
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';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -31,15 +32,20 @@ describe('TokenTransferProxy', () => {
before(async () => {
accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = notAuthorized = accounts[0];
- const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy);
- tokenTransferProxy = new TokenTransferProxyContract(
- tokenTransferProxyInstance.abi,
- tokenTransferProxyInstance.address,
+ tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
provider,
+ txDefaults,
+ );
+ rep = await DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
);
- const repInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider);
-
dmyBalances = new Balances([rep], [accounts[0], accounts[1]]);
await Promise.all([
rep.approve.sendTransactionAsync(tokenTransferProxy.address, INIT_ALLOW, {
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index 2fbf850d0..3d07a55a2 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -7,9 +7,13 @@ import * as chai from 'chai';
import ethUtil = require('ethereumjs-util');
import * as Web3 from 'web3';
+import { AccountLevelsContract } from '../../src/contract_wrappers/generated/account_levels';
import { ArbitrageContract } from '../../src/contract_wrappers/generated/arbitrage';
+import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { EtherDeltaContract } from '../../src/contract_wrappers/generated/ether_delta';
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
+import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy';
+import { artifacts } from '../../util/artifacts';
import { Balances } from '../../util/balances';
import { constants } from '../../util/constants';
import { crypto } from '../../util/crypto';
@@ -17,8 +21,8 @@ import { ExchangeWrapper } from '../../util/exchange_wrapper';
import { OrderFactory } from '../../util/order_factory';
import { BalancesByOwner, ContractName } from '../../util/types';
import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+
+import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -37,8 +41,8 @@ describe('Arbitrage', () => {
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
- let weth: Web3.ContractInstance;
- let zrx: Web3.ContractInstance;
+ let weth: DummyTokenContract;
+ let zrx: DummyTokenContract;
let arbitrage: ArbitrageContract;
let etherDelta: EtherDeltaContract;
@@ -55,33 +59,61 @@ describe('Arbitrage', () => {
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
[coinbase, maker, edMaker, edFrontRunner] = accounts;
- weth = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- zrx = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- const accountLevels = await deployer.deployAsync(ContractName.AccountLevels);
+ weth = await DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+ zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+ const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
+ artifacts.AccountLevels,
+ provider,
+ txDefaults,
+ );
const edAdminAddress = accounts[0];
- const edMakerFee = 0;
- const edTakerFee = 0;
- const edFeeRebate = 0;
- const etherDeltaInstance = await deployer.deployAsync(ContractName.EtherDelta, [
+ const edMakerFee = new BigNumber(0);
+ const edTakerFee = new BigNumber(0);
+ const edFeeRebate = new BigNumber(0);
+ etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
+ artifacts.EtherDelta,
+ provider,
+ txDefaults,
edAdminAddress,
feeRecipient,
accountLevels.address,
edMakerFee,
edTakerFee,
edFeeRebate,
- ]);
- etherDelta = new EtherDeltaContract(etherDeltaInstance.abi, etherDeltaInstance.address, provider);
- const tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy);
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ );
+ const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
+ artifacts.TokenTransferProxy,
+ provider,
+ txDefaults,
+ );
+ const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
zrx.address,
tokenTransferProxy.address,
- ]);
- await tokenTransferProxy.addAuthorizedAddress(exchangeInstance.address, { from: accounts[0] });
+ );
+ await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
zeroEx = new ZeroEx(provider, {
- exchangeContractAddress: exchangeInstance.address,
+ exchangeContractAddress: exchange.address,
networkId: constants.TESTRPC_NETWORK_ID,
});
- const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
exWrapper = new ExchangeWrapper(exchange, zeroEx);
makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
@@ -98,37 +130,39 @@ describe('Arbitrage', () => {
takerFee: new BigNumber(0),
};
orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
- const arbitrageInstance = await deployer.deployAsync(ContractName.Arbitrage, [
+ arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
+ artifacts.Arbitrage,
+ provider,
+ txDefaults,
exchange.address,
etherDelta.address,
tokenTransferProxy.address,
- ]);
- arbitrage = new ArbitrageContract(arbitrageInstance.abi, arbitrageInstance.address, provider);
+ );
// Enable arbitrage and withdrawals of tokens
await arbitrage.setAllowances.sendTransactionAsync(weth.address, { from: coinbase });
await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
// Give some tokens to arbitrage contract
- await weth.setBalance(arbitrage.address, takerTokenAmount, { from: coinbase });
+ await weth.setBalance.sendTransactionAsync(arbitrage.address, takerTokenAmount, { from: coinbase });
// Fund the maker on exchange side
- await zrx.setBalance(maker, makerTokenAmount, { from: coinbase });
+ await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase });
// Set the allowance for the maker on Exchange side
- await zrx.approve(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
+ await zrx.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
// Fund the maker on EtherDelta side
- await weth.setBalance(edMaker, amountGive, { from: coinbase });
+ await weth.setBalance.sendTransactionAsync(edMaker, amountGive, { from: coinbase });
// Set the allowance for the maker on EtherDelta side
- await weth.approve(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
+ await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
// Deposit maker funds into EtherDelta
await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
amountGet = makerTokenAmount;
// Fund the front runner on EtherDelta side
- await zrx.setBalance(edFrontRunner, amountGet, { from: coinbase });
+ await zrx.setBalance.sendTransactionAsync(edFrontRunner, amountGet, { from: coinbase });
// Set the allowance for the front-runner on EtherDelta side
- await zrx.approve(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
+ await zrx.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
// Deposit front runner funds into EtherDelta
await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
});
@@ -195,11 +229,11 @@ describe('Arbitrage', () => {
from: coinbase,
});
const res = await zeroEx.awaitTransactionMinedAsync(txHash);
- const postBalance = await weth.balanceOf(arbitrage.address);
+ const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
expect(postBalance).to.be.bignumber.equal(amountGive);
});
it('should fail and revert if front-runned', async () => {
- const preBalance = await weth.balanceOf(arbitrage.address);
+ const preBalance = await weth.balanceOf.callAsync(arbitrage.address);
// Front-running transaction
await etherDelta.trade.sendTransactionAsync(
tokenGet,
@@ -219,7 +253,7 @@ describe('Arbitrage', () => {
await expect(
arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
).to.be.rejectedWith(constants.REVERT);
- const postBalance = await weth.balanceOf(arbitrage.address);
+ const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
expect(preBalance).to.be.bignumber.equal(postBalance);
});
});
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index 618bda72d..da2e5fb5b 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -6,12 +6,12 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { DummyTokenContract } from '../src/contract_wrappers/generated/dummy_token';
+import { artifacts } from '../util/artifacts';
import { constants } from '../util/constants';
import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -33,8 +33,15 @@ describe('UnlimitedAllowanceToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- const tokenInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS);
- token = new DummyTokenContract(tokenInstance.abi, tokenInstance.address, provider);
+ token = await DummyTokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyToken,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});
diff --git a/packages/contracts/test/utils/deployer.ts b/packages/contracts/test/utils/deployer.ts
deleted file mode 100644
index 2f0951475..000000000
--- a/packages/contracts/test/utils/deployer.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Deployer } from '@0xproject/deployer';
-import { devConstants } from '@0xproject/dev-utils';
-import * as path from 'path';
-
-import { constants } from '../../util/constants';
-
-import { web3 } from './web3_wrapper';
-
-const deployerOpts = {
- provider: web3.currentProvider,
- artifactsDir: path.resolve('lib', 'src', 'artifacts'),
- networkId: constants.TESTRPC_NETWORK_ID,
- defaults: {
- gas: devConstants.GAS_ESTIMATE,
- },
-};
-
-export const deployer = new Deployer(deployerOpts);
diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts
index dd6f198c4..ed1c488a2 100644
--- a/packages/contracts/test/utils/web3_wrapper.ts
+++ b/packages/contracts/test/utils/web3_wrapper.ts
@@ -1,7 +1,11 @@
-import { web3Factory } from '@0xproject/dev-utils';
+import { devConstants, web3Factory } from '@0xproject/dev-utils';
import { Provider } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+export const txDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ gas: devConstants.GAS_ESTIMATE,
+};
const providerConfigs = { shouldUseInProcessGanache: true };
export const web3 = web3Factory.create(providerConfigs);
export const provider = web3.currentProvider;
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index b01615b39..0056ed4b5 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -6,12 +6,12 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { ZRXTokenContract } from '../src/contract_wrappers/generated/zrx_token';
+import { artifacts } from '../util/artifacts';
import { constants } from '../util/constants';
import { ContractName } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -34,8 +34,7 @@ describe('ZRXToken', () => {
zeroEx = new ZeroEx(provider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
- const zrxInstance = await deployer.deployAsync(ContractName.ZRXToken);
- zrx = new ZRXTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
zrxAddress = zrx.address;
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
diff --git a/packages/contracts/util/artifacts.ts b/packages/contracts/util/artifacts.ts
index d262b8058..8511b0082 100644
--- a/packages/contracts/util/artifacts.ts
+++ b/packages/contracts/util/artifacts.ts
@@ -1,6 +1,9 @@
-import { ContractArtifact } from '@0xproject/deployer';
+import { ContractArtifact } from '@0xproject/sol-compiler';
+import * as AccountLevels from '../src/artifacts/AccountLevels.json';
+import * as Arbitrage from '../src/artifacts/Arbitrage.json';
import * as DummyToken from '../src/artifacts/DummyToken.json';
+import * as EtherDelta from '../src/artifacts/EtherDelta.json';
import * as Exchange from '../src/artifacts/Exchange.json';
import * as MaliciousToken from '../src/artifacts/MaliciousToken.json';
import * as MultiSigWalletWithTimeLock from '../src/artifacts/MultiSigWalletWithTimeLock.json';
@@ -12,6 +15,9 @@ import * as EtherToken from '../src/artifacts/WETH9.json';
import * as ZRX from '../src/artifacts/ZRXToken.json';
export const artifacts = {
+ AccountLevels: (AccountLevels as any) as ContractArtifact,
+ Arbitrage: (Arbitrage as any) as ContractArtifact,
+ EtherDelta: (EtherDelta as any) as ContractArtifact,
ZRX: (ZRX as any) as ContractArtifact,
DummyToken: (DummyToken as any) as ContractArtifact,
Token: (Token as any) as ContractArtifact,
diff --git a/packages/contracts/util/constants.ts b/packages/contracts/util/constants.ts
index d1152e683..d287986b7 100644
--- a/packages/contracts/util/constants.ts
+++ b/packages/contracts/util/constants.ts
@@ -1,7 +1,4 @@
-const DUMMY_TOKEN_NAME = '';
-const DUMMY_TOKEN_SYMBOL = '';
-const DUMMY_TOKEN_DECIMALS = 18;
-const DUMMY_TOKEN_TOTAL_SUPPLY = 0;
+import { BigNumber } from '@0xproject/utils';
export const constants = {
INVALID_OPCODE: 'invalid opcode',
@@ -10,5 +7,8 @@ export const constants = {
MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,
MAX_TOKEN_TRANSFERFROM_GAS: 80000,
MAX_TOKEN_APPROVE_GAS: 60000,
- DUMMY_TOKEN_ARGS: [DUMMY_TOKEN_NAME, DUMMY_TOKEN_SYMBOL, DUMMY_TOKEN_DECIMALS, DUMMY_TOKEN_TOTAL_SUPPLY],
+ DUMMY_TOKEN_NAME: '',
+ DUMMY_TOKEN_SYMBOL: '',
+ DUMMY_TOKEN_DECIMALS: new BigNumber(18),
+ DUMMY_TOKEN_TOTAL_SUPPLY: new BigNumber(0),
};