diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-04-12 05:20:21 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | b13a2e71ad94ed4855b2707f9c706582a8b86472 (patch) | |
tree | 43580b322144e91149df3954ef5d49b95a2edeec /packages/contracts/test/exchange/wrapper.ts | |
parent | 28678214d2ca9c06ab362c4f2900be923dab60cf (diff) | |
download | dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar.gz dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar.bz2 dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar.lz dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar.xz dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.tar.zst dexon-sol-tools-b13a2e71ad94ed4855b2707f9c706582a8b86472.zip |
Added comments around deploying contracts to helper/wrapper tests
Diffstat (limited to 'packages/contracts/test/exchange/wrapper.ts')
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index aef21429f..12f01cd00 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -15,11 +15,7 @@ import { ERC20Proxy_v1Contract } from '../../src/contract_wrappers/generated/erc import { ExchangeContract } 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 { - encodeERC20ProxyData, - encodeERC20V1ProxyData, - encodeERC721ProxyData, -} from '../../src/utils/asset_proxy_utils'; +import { encodeERC20ProxyData, encodeERC20V1ProxyData, encodeERC721ProxyData } from '../../src/utils/asset_proxy_utils'; import { Balances } from '../../src/utils/balances'; import { constants } from '../../src/utils/constants'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; @@ -78,54 +74,38 @@ describe('Exchange', () => { tokenTransferProxyInstance.address, provider, ); - const erc20TransferProxyV1Instance = await deployer.deployAsync(ContractName.ERC20Proxy_V1, [ - tokenTransferProxy.address, - ]); - erc20TransferProxyV1 = new ERC20Proxy_v1Contract( - erc20TransferProxyV1Instance.abi, - erc20TransferProxyV1Instance.address, + // Deploy Asset Proxy Dispatcher + const assetProxyDispatcherInstance = await deployer.deployAsync(ContractName.AssetProxyDispatcher); + assetProxyDispatcher = new AssetProxyDispatcherContract( + assetProxyDispatcherInstance.abi, + assetProxyDispatcherInstance.address, provider, ); + // Deploy ERC20 Proxy const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); erc20TransferProxy = new ERC20ProxyContract( erc20TransferProxyInstance.abi, erc20TransferProxyInstance.address, provider, ); - const assetProxyDispatcherInstance = await deployer.deployAsync(ContractName.AssetProxyDispatcher); - assetProxyDispatcher = new AssetProxyDispatcherContract( - assetProxyDispatcherInstance.abi, - assetProxyDispatcherInstance.address, - provider, - ); - const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ - zrx.address, - encodeERC20ProxyData(zrx.address), - assetProxyDispatcher.address, - ]); - exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); - await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); - await erc20TransferProxyV1.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], - }); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: accounts[0], }); - await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { - from: accounts[0], - }); - await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( - AssetProxyId.ERC20_V1, - erc20TransferProxyV1.address, - ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, - ); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); + // Deploy and configure Exchange + const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ + zrx.address, + encodeERC20ProxyData(zrx.address), + assetProxyDispatcher.address, + ]); + exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); + await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); + const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); exWrapper = new ExchangeWrapper(exchange, zeroEx); |