aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-16 03:52:49 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-16 03:52:49 +0800
commit9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a (patch)
treef72aae5170b6f1f6d3d70ebf6c03ed171680ff50 /packages/contracts/test
parent9744b1906a111aa0c65c8fafb4db66aef32a5a23 (diff)
parent6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b (diff)
downloaddexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar.gz
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar.bz2
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar.lz
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar.xz
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.tar.zst
dexon-sol-tools-9e0471bfbb4bb2b3b490e10ce34b16c88e8bab9a.zip
Merge branch 'development' into v2-prototype
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/asset_proxy/authorizable.ts14
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts11
-rw-r--r--packages/contracts/test/ether_token.ts17
-rw-r--r--packages/contracts/test/exchange/core.ts26
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts26
-rw-r--r--packages/contracts/test/exchange/libs.ts11
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts17
-rw-r--r--packages/contracts/test/exchange/transactions.ts17
-rw-r--r--packages/contracts/test/exchange/wrapper.ts20
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts11
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts32
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts43
-rw-r--r--packages/contracts/test/token_registry.ts11
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts191
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts20
-rw-r--r--packages/contracts/test/utils/chai_setup.ts13
-rw-r--r--packages/contracts/test/utils/deployer.ts18
-rw-r--r--packages/contracts/test/utils/web3_wrapper.ts8
-rw-r--r--packages/contracts/test/zrx_token.ts11
19 files changed, 250 insertions, 267 deletions
diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts
index 9cea263e7..39672bea9 100644
--- a/packages/contracts/test/asset_proxy/authorizable.ts
+++ b/packages/contracts/test/asset_proxy/authorizable.ts
@@ -4,11 +4,10 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { MixinAuthorizableContract } from '../../src/contract_wrappers/generated/mixin_authorizable';
+import { artifacts } from '../../src/utils/artifacts';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
-import { ContractName } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -23,8 +22,11 @@ describe('Authorizable', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = address = accounts[0];
notOwner = accounts[1];
- const authorizableInstance = await deployer.deployAsync(ContractName.Authorizable);
- authorizable = new MixinAuthorizableContract(authorizableInstance.abi, authorizableInstance.address, provider);
+ authorizable = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
+ artifacts.MixinAuthorizable,
+ provider,
+ txDefaults,
+ );
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index a304da585..e7ef9a0d3 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -10,13 +10,12 @@ import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
-import { AssetProxyId, ContractName } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { AssetProxyId } from '../../src/utils/types';
+import { provider, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -44,8 +43,8 @@ describe('Asset Transfer Proxies', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, notAuthorized, exchangeAddress, makerAddress, takerAddress] = accounts);
- erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
[zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
erc20Proxy = await erc20Wrapper.deployProxyAsync();
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts
index e9aba07c5..213c7c8a6 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -1,15 +1,14 @@
-import { ZeroEx, ZeroExError } from '0x.js';
+import { ContractWrappersError, ZeroEx } from '0x.js';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
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 '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
-import { ContractName } from '../src/utils/types';
-
-import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -24,7 +23,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,
@@ -43,7 +42,7 @@ describe('EtherToken', () => {
const ethToDeposit = initEthBalance.plus(1);
return expect(zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account)).to.be.rejectedWith(
- ZeroExError.InsufficientEthBalanceForDeposit,
+ ContractWrappersError.InsufficientEthBalanceForDeposit,
);
});
@@ -72,7 +71,7 @@ describe('EtherToken', () => {
return expect(
zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account),
- ).to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal);
+ ).to.be.rejectedWith(ContractWrappersError.InsufficientWEthBalanceForWithdrawal);
});
it('should convert ether tokens to ether with sufficient balance', async () => {
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index b714fa899..6c190d4da 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -15,7 +15,9 @@ import {
ExchangeErrorContractEventArgs,
FillContractEventArgs,
} from '../../src/contract_wrappers/generated/exchange';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { crypto } from '../../src/utils/crypto';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
@@ -23,16 +25,8 @@ import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
import { OrderFactory } from '../../src/utils/order_factory';
import { orderUtils } from '../../src/utils/order_utils';
-import {
- AssetProxyId,
- ContractName,
- ERC20BalancesByOwner,
- ExchangeContractErrs,
- SignedOrder,
-} from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { AssetProxyId, ERC20BalancesByOwner, ExchangeContractErrs, SignedOrder } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -71,8 +65,8 @@ describe('Exchange core', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
- erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
erc20Proxy = await erc20Wrapper.deployProxyAsync();
@@ -85,10 +79,12 @@ describe('Exchange core', () => {
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
erc721TakerAssetIds = erc721Balances[takerAddress][erc721Token.address];
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
- ]);
- exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
+ );
zeroEx = new ZeroEx(provider, {
exchangeContractAddress: exchange.address,
networkId: constants.TESTRPC_NETWORK_ID,
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index 31f5f5dbb..db2f18ddc 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -8,14 +8,14 @@ import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/d
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
import { TestAssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/test_asset_proxy_dispatcher';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
-import { AssetProxyId, ContractName } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { AssetProxyId } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -42,8 +42,8 @@ describe('AssetProxyDispatcher', () => {
const usedAddresses = ([owner, notOwner, makerAddress, takerAddress] = accounts);
notAuthorized = notOwner;
- erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
[zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
erc20Proxy = await erc20Wrapper.deployProxyAsync();
@@ -51,11 +51,10 @@ describe('AssetProxyDispatcher', () => {
erc721Proxy = await erc721Wrapper.deployProxyAsync();
- const assetProxyDispatcherInstance = await deployer.deployAsync(ContractName.TestAssetProxyDispatcher);
- assetProxyDispatcher = new TestAssetProxyDispatcherContract(
- assetProxyDispatcherInstance.abi,
- assetProxyDispatcherInstance.address,
+ assetProxyDispatcher = await TestAssetProxyDispatcherContract.deployFrom0xArtifactAsync(
+ artifacts.TestAssetProxyDispatcher,
provider,
+ txDefaults,
);
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
from: owner,
@@ -118,11 +117,10 @@ describe('AssetProxyDispatcher', () => {
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// Deploy a new version of the ERC20 Transfer Proxy contract
- const newErc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy);
- const newErc20TransferProxy = new ERC20ProxyContract(
- newErc20TransferProxyInstance.abi,
- newErc20TransferProxyInstance.address,
+ const newErc20TransferProxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
+ artifacts.ERC20Proxy,
provider,
+ txDefaults,
);
// Register new ERC20 Transfer Proxy contract
const newAddress = newErc20TransferProxy.address;
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
index 0074cdff7..1036cb815 100644
--- a/packages/contracts/test/exchange/libs.ts
+++ b/packages/contracts/test/exchange/libs.ts
@@ -6,14 +6,14 @@ import ethUtil = require('ethereumjs-util');
import { TestLibsContract } from '../../src/contract_wrappers/generated/test_libs';
import { addressUtils } from '../../src/utils/address_utils';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { OrderFactory } from '../../src/utils/order_factory';
import { orderUtils } from '../../src/utils/order_utils';
-import { ContractName, SignedOrder } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { SignedOrder } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -28,8 +28,7 @@ describe('Exchange libs', () => {
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const makerAddress = accounts[0];
- const libsInstance = await deployer.deployAsync(ContractName.TestLibs);
- libs = new TestLibsContract(libsInstance.abi, libsInstance.address, provider);
+ libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
const defaultOrderParams = {
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index f47999bfa..489ed32c5 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -6,14 +6,14 @@ import ethUtil = require('ethereumjs-util');
import { TestSignatureValidatorContract } from '../../src/contract_wrappers/generated/test_signature_validator';
import { addressUtils } from '../../src/utils/address_utils';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { OrderFactory } from '../../src/utils/order_factory';
import { orderUtils } from '../../src/utils/order_utils';
-import { ContractName, SignedOrder } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { SignedOrder } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -28,17 +28,16 @@ describe('MixinSignatureValidator', () => {
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const makerAddress = accounts[0];
- const signatureValidatorInstance = await deployer.deployAsync(ContractName.TestSignatureValidator);
- signatureValidator = new TestSignatureValidatorContract(
- signatureValidatorInstance.abi,
- signatureValidatorInstance.address,
+ signatureValidator = await TestSignatureValidatorContract.deployFrom0xArtifactAsync(
+ artifacts.TestSignatureValidator,
provider,
+ txDefaults,
);
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
const defaultOrderParams = {
...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: signatureValidatorInstance.address,
+ exchangeAddress: signatureValidator.address,
makerAddress,
feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
makerAssetData: assetProxyUtils.encodeERC20ProxyData(addressUtils.generatePseudoRandomAddress()),
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 2bc078153..a71b50a61 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -9,7 +9,9 @@ import * as Web3 from 'web3';
import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
@@ -18,7 +20,6 @@ import { orderUtils } from '../../src/utils/order_utils';
import { TransactionFactory } from '../../src/utils/transaction_factory';
import {
AssetProxyId,
- ContractName,
ERC20BalancesByOwner,
ExchangeContractErrs,
OrderStruct,
@@ -26,9 +27,7 @@ import {
SignedOrder,
SignedTransaction,
} from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -66,16 +65,18 @@ describe('Exchange transactions', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, senderAddress, makerAddress, takerAddress, feeRecipientAddress] = accounts);
- erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
erc20Proxy = await erc20Wrapper.deployProxyAsync();
await erc20Wrapper.setBalancesAndAllowancesAsync();
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
- ]);
- exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
+ );
zeroEx = new ZeroEx(provider, {
exchangeContractAddress: exchange.address,
networkId: constants.TESTRPC_NETWORK_ID,
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 88e42fee6..44145b4f0 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -12,16 +12,16 @@ import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c2
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry';
+import { artifacts } from '../../src/utils/artifacts';
import { assetProxyUtils } from '../../src/utils/asset_proxy_utils';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
import { OrderFactory } from '../../src/utils/order_factory';
-import { AssetProxyId, ContractName, ERC20BalancesByOwner, SignedOrder } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { AssetProxyId, ERC20BalancesByOwner, SignedOrder } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -59,8 +59,8 @@ describe('Exchange wrappers', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
- erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
erc20Proxy = await erc20Wrapper.deployProxyAsync();
@@ -73,10 +73,12 @@ describe('Exchange wrappers', () => {
erc721MakerAssetId = erc721Balances[makerAddress][erc721Token.address][0];
erc721TakerAssetId = erc721Balances[takerAddress][erc721Token.address][0];
- const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
- ]);
- exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
+ );
zeroEx = new ZeroEx(provider, {
exchangeContractAddress: exchange.address,
networkId: constants.TESTRPC_NETWORK_ID,
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index 1270a617f..5ed5c356f 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -8,11 +8,11 @@ import ethUtil = require('ethereumjs-util');
import * as Web3 from 'web3';
import { TestLibBytesContract } from '../../src/contract_wrappers/generated/test_lib_bytes';
+import { artifacts } from '../../src/utils/artifacts';
+import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
-import { AssetProxyId, ContractName } from '../../src/utils/types';
-import { chaiSetup } from '../utils/chai_setup';
-import { deployer } from '../utils/deployer';
-import { provider, web3Wrapper } from '../utils/web3_wrapper';
+import { AssetProxyId } from '../../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -38,8 +38,7 @@ describe('LibBytes', () => {
owner = accounts[0];
testAddress = accounts[1];
// Deploy LibBytes
- const libBytesInstance = await deployer.deployAsync(ContractName.TestLibBytes);
- libBytes = new TestLibBytesContract(libBytesInstance.abi, libBytesInstance.address, provider);
+ libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(artifacts.TestLibBytes, provider, txDefaults);
// Verify lengths of test data
const byteArrayShorterThan32BytesLength = ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength;
expect(byteArrayShorterThan32BytesLength).to.be.lessThan(32);
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index 48600ae3d..d39fa6d09 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -9,15 +9,13 @@ import * as multiSigWalletJSON from '../../build/contracts/MultiSigWalletWithTim
import { MultiSigWalletContract } from '../src/contract_wrappers/generated/multi_sig_wallet';
import { MultiSigWalletWithTimeLockContract } from '../src/contract_wrappers/generated/multi_sig_wallet_with_time_lock';
import { artifacts } from '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
import { MultiSigWrapper } from '../src/utils/multi_sig_wrapper';
-import { ContractName, SubmissionContractEventArgs } from '../src/utils/types';
+import { SubmissionContractEventArgs } from '../src/utils/types';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
-import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
-
-const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLockArtifact.networks[constants.TESTRPC_NETWORK_ID].abi;
+const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.compilerOutput.abi;
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
@@ -47,15 +45,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 +140,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 74475c3db..65cd5c5a8 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
@@ -6,7 +6,7 @@
*
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';
@@ -21,12 +21,12 @@ import { MultiSigWrapper } from '../src/utils/multi_sig_wrapper';
import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from '../src/utils/types';
import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
-const PROXY_ABI = artifacts.TokenTransferProxyArtifact.networks[constants.TESTRPC_NETWORK_ID].abi;
+
+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.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact.networks[constants.TESTRPC_NETWORK_ID]
- .abi;
+ artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.compilerOutput.abi;
chaiSetup.configure();
const expect = chai.expect;
@@ -36,8 +36,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;
@@ -53,23 +53,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,
@@ -117,7 +116,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 c34478b65..1cae3da52 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -8,13 +8,11 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import { TokenRegistryContract } from '../src/contract_wrappers/generated/token_registry';
+import { artifacts } from '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
import { TokenRegWrapper } from '../src/utils/token_registry_wrapper';
-import { ContractName } from '../src/utils/types';
-
-import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -29,8 +27,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/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index 95bc421e1..c65e050ad 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -1,23 +1,28 @@
// import { ECSignature, SignedOrder, ZeroEx } from '0x.js';
// import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+// import { ExchangeContractErrs } from '@0xproject/types';
// import { BigNumber } from '@0xproject/utils';
// import { Web3Wrapper } from '@0xproject/web3-wrapper';
// 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 { Balances } from '../../src/utils/balances';
-// import { constants } from '../../src/utils/constants';
-// import { crypto } from '../../src/utils/crypto';
-// import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
-// import { OrderFactory } from '../../src/utils/order_factory';
-// import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../src/utils/types';
+// 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';
+// 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;
@@ -36,8 +41,8 @@
// 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;
@@ -47,87 +52,117 @@
// let zeroEx: ZeroEx;
-// From a bird's eye view - we create two orders.
-// 0x order of 1 ZRX (maker) for 1 WETH (taker)
-// ED order of 2 WETH (tokenGive) for 1 ZRX (tokenGet)
-// And then we do an atomic arbitrage between them which gives us 1 WETH.
-// before(async () => {
-// const accounts = await web3Wrapper.getAvailableAddressesAsync();
-// [coinbase, maker, edMaker, edFrontRunner] = accounts;
-// weth = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
-// zrx = await deployer.deployAsync(ContractName.DummyERC20Token, constants.DUMMY_TOKEN_ARGS);
-// const accountLevels = await deployer.deployAsync(ContractName.AccountLevels);
-// const edAdminAddress = accounts[0];
-// const edMakerFee = 0;
-// const edTakerFee = 0;
-// const edFeeRebate = 0;
-// const etherDeltaInstance = await deployer.deployAsync(ContractName.EtherDelta, [
-// 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, [
-// zrx.address,
-// tokenTransferProxy.address,
-// ]);
-// await tokenTransferProxy.addAuthorizedAddress(exchangeInstance.address, { from: accounts[0] });
-// zeroEx = new ZeroEx(provider, {
-// exchangeContractAddress: exchangeInstance.address,
-// networkId: constants.TESTRPC_NETWORK_ID,
-// });
-// const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
-// exWrapper = new ExchangeWrapper(exchange, zeroEx);
+// // From a bird's eye view - we create two orders.
+// // 0x order of 1 ZRX (maker) for 1 WETH (taker)
+// // ED order of 2 WETH (tokenGive) for 1 ZRX (tokenGet)
+// // And then we do an atomic arbitrage between them which gives us 1 WETH.
+// before(async () => {
+// const accounts = await web3Wrapper.getAvailableAddressesAsync();
+// [coinbase, maker, edMaker, edFrontRunner] = accounts;
+// 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 = 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,
+// );
+// 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.sendTransactionAsync(exchange.address, { from: accounts[0] });
+// zeroEx = new ZeroEx(provider, {
+// exchangeContractAddress: exchange.address,
+// networkId: constants.TESTRPC_NETWORK_ID,
+// });
+// exWrapper = new ExchangeWrapper(exchange, zeroEx);
-// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
-// takerTokenAmount = makerTokenAmount;
-// const defaultOrderParams = {
-// exchangeContractAddress: exchange.address,
-// maker,
-// feeRecipient,
-// makerTokenAddress: zrx.address,
-// takerTokenAddress: weth.address,
-// makerTokenAmount,
-// takerTokenAmount,
-// makerFee: new BigNumber(0),
-// takerFee: new BigNumber(0),
-// };
-// orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
-// const arbitrageInstance = await deployer.deployAsync(ContractName.Arbitrage, [
-// 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 });
+// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
+// takerTokenAmount = makerTokenAmount;
+// const defaultOrderParams = {
+// exchangeContractAddress: exchange.address,
+// maker,
+// feeRecipient,
+// makerTokenAddress: zrx.address,
+// takerTokenAddress: weth.address,
+// makerTokenAmount,
+// takerTokenAmount,
+// makerFee: new BigNumber(0),
+// takerFee: new BigNumber(0),
+// };
+// orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
+// arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
+// artifacts.Arbitrage,
+// provider,
+// txDefaults,
+// exchange.address,
+// etherDelta.address,
+// tokenTransferProxy.address,
+// );
+// // 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 });
// });
@@ -194,11 +229,11 @@
// 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,
@@ -218,7 +253,7 @@
// 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 f40708dbd..8721930be 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -6,12 +6,10 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { DummyERC20TokenContract } from '../src/contract_wrappers/generated/dummy_e_r_c20_token';
+import { artifacts } from '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
-import { ContractName } from '../src/utils/types';
-
-import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -32,11 +30,15 @@ describe('UnlimitedAllowanceToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- const tokenInstance = await deployer.deployAsync(
- ContractName.DummyERC20Token,
- constants.DUMMY_ERC20_TOKEN_ARGS,
+ token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC20Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
);
- token = new DummyERC20TokenContract(tokenInstance.abi, tokenInstance.address, provider);
await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});
diff --git a/packages/contracts/test/utils/chai_setup.ts b/packages/contracts/test/utils/chai_setup.ts
deleted file mode 100644
index 078edd309..000000000
--- a/packages/contracts/test/utils/chai_setup.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import * as chai from 'chai';
-import chaiAsPromised = require('chai-as-promised');
-import ChaiBigNumber = require('chai-bignumber');
-import * as dirtyChai from 'dirty-chai';
-
-export const chaiSetup = {
- configure() {
- chai.config.includeStack = true;
- chai.use(ChaiBigNumber());
- chai.use(dirtyChai);
- chai.use(chaiAsPromised);
- },
-};
diff --git a/packages/contracts/test/utils/deployer.ts b/packages/contracts/test/utils/deployer.ts
deleted file mode 100644
index 967cdd903..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 '../../src/utils/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
deleted file mode 100644
index dd6f198c4..000000000
--- a/packages/contracts/test/utils/web3_wrapper.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { web3Factory } from '@0xproject/dev-utils';
-import { Provider } from '@0xproject/types';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-
-const providerConfigs = { shouldUseInProcessGanache: true };
-export const web3 = web3Factory.create(providerConfigs);
-export const provider = web3.currentProvider;
-export const web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index a5de67f64..5de751780 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -6,12 +6,10 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import { ZRXTokenContract } from '../src/contract_wrappers/generated/zrx_token';
+import { artifacts } from '../src/utils/artifacts';
+import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
-import { ContractName } from '../src/utils/types';
-
-import { chaiSetup } from './utils/chai_setup';
-import { deployer } from './utils/deployer';
-import { provider, web3Wrapper } from './utils/web3_wrapper';
+import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -34,8 +32,7 @@ describe('ZRXToken', () => {
zeroEx = new ZeroEx(provider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
- const zrxInstance = await deployer.deployAsync(ContractName.ZRXToken);
- zrxToken = new ZRXTokenContract(zrxInstance.abi, zrxInstance.address, provider);
+ zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
zrxAddress = zrxToken.address;
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});