diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-03 21:19:38 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-04 16:56:32 +0800 |
commit | 249bf0163d8ee71b7329fd58b72e554c0324279c (patch) | |
tree | 5bfb30b082236bd089e35186220bdb02913ba128 /packages/contracts/test | |
parent | 674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf (diff) | |
download | dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.gz dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.bz2 dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.lz dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.xz dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.tar.zst dexon-sol-tools-249bf0163d8ee71b7329fd58b72e554c0324279c.zip |
Move our contract templates to accept Provider instead of Web3Wrapper
Diffstat (limited to 'packages/contracts/test')
-rw-r--r-- | packages/contracts/test/ether_token.ts | 8 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 14 | ||||
-rw-r--r-- | packages/contracts/test/exchange/helpers.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 21 | ||||
-rw-r--r-- | packages/contracts/test/multi_sig_with_time_lock.ts | 8 | ||||
-rw-r--r-- | packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts | 8 | ||||
-rw-r--r-- | packages/contracts/test/token_registry.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/token_transfer_proxy/auth.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/token_transfer_proxy/transfer_from.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/tutorials/arbitrage.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/web3_wrapper.ts | 3 | ||||
-rw-r--r-- | packages/contracts/test/zrx_token.ts | 6 |
13 files changed, 51 insertions, 53 deletions
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 6c7354c2b..4023abad0 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -9,7 +9,7 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -26,7 +26,7 @@ describe('EtherToken', () => { const etherToken = await deployer.deployAsync(ContractName.EtherToken); etherTokenAddress = etherToken.address; - zeroEx = new ZeroEx(web3.currentProvider, { + zeroEx = new ZeroEx(provider, { gasPrice, networkId: constants.TESTRPC_NETWORK_ID, }); @@ -51,7 +51,7 @@ describe('EtherToken', () => { const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account); - const ethToDeposit = new BigNumber(web3.toWei(1, 'ether')); + const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1))); const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account); const receipt = await zeroEx.awaitTransactionMinedAsync(txHash); @@ -76,7 +76,7 @@ describe('EtherToken', () => { }); it('should convert ether tokens to ether with sufficient balance', async () => { - const ethToDeposit = new BigNumber(web3.toWei(1, 'ether')); + const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1))); await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account); const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account); const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index e276d11b3..689b11062 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -22,7 +22,7 @@ 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 { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -59,22 +59,22 @@ describe('Exchange', () => { deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), ]); - rep = new DummyTokenContract(web3Wrapper, repInstance.abi, repInstance.address); - dgd = new DummyTokenContract(web3Wrapper, dgdInstance.abi, dgdInstance.address); - zrx = new DummyTokenContract(web3Wrapper, zrxInstance.abi, zrxInstance.address); + 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( - web3Wrapper, tokenTransferProxyInstance.abi, tokenTransferProxyInstance.address, + provider, ); const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ zrx.address, tokenTransferProxy.address, ]); - exchange = new ExchangeContract(web3Wrapper, exchangeInstance.abi, exchangeInstance.address); + exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); - zeroEx = new ZeroEx(web3.currentProvider, { + zeroEx = new ZeroEx(provider, { exchangeContractAddress: exchange.address, networkId: constants.TESTRPC_NETWORK_ID, }); diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 080cbe5fd..8fc30c0b5 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -17,7 +17,7 @@ import { OrderFactory } from '../../util/order_factory'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; -import { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -46,9 +46,9 @@ describe('Exchange', () => { zrx.address, tokenTransferProxy.address, ]); - const exchange = new ExchangeContract(web3Wrapper, exchangeInstance.abi, exchangeInstance.address); + const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await tokenTransferProxy.addAuthorizedAddress(exchange.address, { from: accounts[0] }); - const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); + const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); exchangeWrapper = new ExchangeWrapper(exchange, zeroEx); const defaultOrderParams = { exchangeContractAddress: exchange.address, diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 0d3e18711..d4029c8cd 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -22,7 +22,7 @@ import { OrderFactory } from '../../util/order_factory'; import { BalancesByOwner, ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; -import { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -59,28 +59,25 @@ describe('Exchange', () => { deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), ]); - rep = new DummyTokenContract(web3Wrapper, repInstance.abi, repInstance.address); - dgd = new DummyTokenContract(web3Wrapper, dgdInstance.abi, dgdInstance.address); - zrx = new DummyTokenContract(web3Wrapper, zrxInstance.abi, zrxInstance.address); + 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( - web3Wrapper, - tokenRegistryInstance.abi, - tokenRegistryInstance.address, - ); + tokenRegistry = new TokenRegistryContract(tokenRegistryInstance.abi, tokenRegistryInstance.address, provider); const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy); tokenTransferProxy = new TokenTransferProxyContract( - web3Wrapper, tokenTransferProxyInstance.abi, tokenTransferProxyInstance.address, + provider, ); const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ zrx.address, tokenTransferProxy.address, + provider, ]); - exchange = new ExchangeContract(web3Wrapper, exchangeInstance.abi, exchangeInstance.address); + exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); - const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); + const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); exWrapper = new ExchangeWrapper(exchange, zeroEx); const defaultOrderParams = { diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index d35efe9da..ea74d4c7f 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -15,13 +15,13 @@ import { ContractName, SubmissionContractEventArgs } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLockArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); +const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); const abiDecoder = new AbiDecoder([MULTI_SIG_ABI]); describe('MultiSigWalletWithTimeLock', () => { @@ -53,9 +53,9 @@ describe('MultiSigWalletWithTimeLock', () => { 0, ]); multiSig = new MultiSigWalletWithTimeLockContract( - web3Wrapper, multiSigInstance.abi, multiSigInstance.address, + provider, ); multiSigWrapper = new MultiSigWrapper((multiSig as any) as MultiSigWalletContract); @@ -150,9 +150,9 @@ describe('MultiSigWalletWithTimeLock', () => { SECONDS_TIME_LOCKED, ]); multiSig = new MultiSigWalletWithTimeLockContract( - web3Wrapper, 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 6d20a67f3..2f928ede2 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 @@ -16,7 +16,7 @@ import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; const PROXY_ABI = artifacts.TokenTransferProxyArtifact.networks[constants.TESTRPC_NETWORK_ID].abi; const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI = artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact.networks[constants.TESTRPC_NETWORK_ID] @@ -28,7 +28,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); const abiDecoder = new AbiDecoder([MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI]); describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => { - const zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID }); + const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); let owners: string[]; const requiredApprovals = 2; const SECONDS_TIME_LOCKED = 1000000; @@ -49,9 +49,9 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => { const initialOwner = accounts[0]; const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy); tokenTransferProxy = new TokenTransferProxyContract( - web3Wrapper, tokenTransferProxyInstance.abi, tokenTransferProxyInstance.address, + provider, ); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, { from: initialOwner, @@ -61,9 +61,9 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => { [owners, requiredApprovals, SECONDS_TIME_LOCKED, tokenTransferProxy.address], ); multiSig = new MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract( - web3Wrapper, multiSigInstance.abi, multiSigInstance.address, + provider, ); await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner, diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 9dcc77b82..12fc52dbc 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -14,7 +14,7 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -30,7 +30,7 @@ describe('TokenRegistry', () => { owner = accounts[0]; notOwner = accounts[1]; const tokenRegInstance = await deployer.deployAsync(ContractName.TokenRegistry); - tokenReg = new TokenRegistryContract(web3Wrapper, tokenRegInstance.abi, tokenRegInstance.address); + tokenReg = new TokenRegistryContract(tokenRegInstance.abi, tokenRegInstance.address, provider); 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 a1ccc6ff7..885ff3bc1 100644 --- a/packages/contracts/test/token_transfer_proxy/auth.ts +++ b/packages/contracts/test/token_transfer_proxy/auth.ts @@ -8,7 +8,7 @@ import { constants } from '../../util/constants'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; -import { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -25,9 +25,9 @@ describe('TokenTransferProxy', () => { notOwner = accounts[1]; const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy); tokenTransferProxy = new TokenTransferProxyContract( - web3Wrapper, tokenTransferProxyInstance.abi, tokenTransferProxyInstance.address, + provider, ); }); 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 415d068be..dff1a0cfb 100644 --- a/packages/contracts/test/token_transfer_proxy/transfer_from.ts +++ b/packages/contracts/test/token_transfer_proxy/transfer_from.ts @@ -11,7 +11,7 @@ import { constants } from '../../util/constants'; import { ContractName } from '../../util/types'; import { chaiSetup } from '../utils/chai_setup'; import { deployer } from '../utils/deployer'; -import { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -33,12 +33,12 @@ describe('TokenTransferProxy', () => { owner = notAuthorized = accounts[0]; const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy); tokenTransferProxy = new TokenTransferProxyContract( - web3Wrapper, tokenTransferProxyInstance.abi, tokenTransferProxyInstance.address, + provider, ); const repInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS); - rep = new DummyTokenContract(web3Wrapper, repInstance.abi, repInstance.address); + rep = new DummyTokenContract(repInstance.abi, repInstance.address, provider); dmyBalances = new Balances([rep], [accounts[0], accounts[1]]); await Promise.all([ diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index b2bbaf420..ad83bbca3 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -17,7 +17,7 @@ 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 { web3, web3Wrapper } from '../utils/web3_wrapper'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -69,18 +69,18 @@ describe('Arbitrage', () => { edTakerFee, edFeeRebate, ]); - etherDelta = new EtherDeltaContract(web3Wrapper, etherDeltaInstance.abi, etherDeltaInstance.address); + 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(web3.currentProvider, { + zeroEx = new ZeroEx(provider, { exchangeContractAddress: exchangeInstance.address, networkId: constants.TESTRPC_NETWORK_ID, }); - const exchange = new ExchangeContract(web3Wrapper, exchangeInstance.abi, exchangeInstance.address); + const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); exWrapper = new ExchangeWrapper(exchange, zeroEx); makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18); @@ -102,7 +102,7 @@ describe('Arbitrage', () => { etherDelta.address, tokenTransferProxy.address, ]); - arbitrage = new ArbitrageContract(web3Wrapper, arbitrageInstance.abi, arbitrageInstance.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 }); diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index c1c518adc..618bda72d 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -11,7 +11,7 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -23,7 +23,7 @@ describe('UnlimitedAllowanceToken', () => { const config = { networkId: constants.TESTRPC_NETWORK_ID, }; - const zeroEx = new ZeroEx(web3.currentProvider, config); + const zeroEx = new ZeroEx(provider, config); const MAX_MINT_VALUE = new BigNumber(100000000000000000000); let tokenAddress: string; @@ -34,7 +34,7 @@ describe('UnlimitedAllowanceToken', () => { owner = accounts[0]; spender = accounts[1]; const tokenInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS); - token = new DummyTokenContract(web3Wrapper, tokenInstance.abi, tokenInstance.address); + token = new DummyTokenContract(tokenInstance.abi, tokenInstance.address, provider); await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner }); tokenAddress = token.address; }); diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index 35a8095a6..1a711dad2 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -3,4 +3,5 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; const web3ProviderConfig = { shouldUseInProcessGanache: true }; export const web3 = web3Factory.create(web3ProviderConfig); -export const web3Wrapper = new Web3Wrapper(web3.currentProvider); +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 a4cc3c2fc..b01615b39 100644 --- a/packages/contracts/test/zrx_token.ts +++ b/packages/contracts/test/zrx_token.ts @@ -11,7 +11,7 @@ import { ContractName } from '../util/types'; import { chaiSetup } from './utils/chai_setup'; import { deployer } from './utils/deployer'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -31,11 +31,11 @@ describe('ZRXToken', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); owner = accounts[0]; spender = accounts[1]; - zeroEx = new ZeroEx(web3.currentProvider, { + zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID, }); const zrxInstance = await deployer.deployAsync(ContractName.ZRXToken); - zrx = new ZRXTokenContract(web3Wrapper, zrxInstance.abi, zrxInstance.address); + zrx = new ZRXTokenContract(zrxInstance.abi, zrxInstance.address, provider); zrxAddress = zrx.address; MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; }); |