From 8374a51e6aed171c64600205b1219c6f38550a06 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 12 Apr 2018 18:06:45 -0700 Subject: Replaced instances of `accounts[0]` with `owner` in contracts test cases --- .../contracts/test/asset_proxy_dispatcher/dispatcher.ts | 10 +++++----- .../contracts/test/asset_proxy_dispatcher/proxies.ts | 8 ++++---- packages/contracts/test/exchange/core.ts | 17 +++++++++-------- packages/contracts/test/exchange/helpers.ts | 7 ++++--- packages/contracts/test/exchange/wrapper.ts | 7 ++++--- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts index 8f430ee94..04de86865 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts @@ -56,7 +56,7 @@ describe('AssetProxyDispatcher', () => { provider, ); await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, { - from: accounts[0], + from: owner, }); // Deploy TokenTransferProxy const tokenTransferProxyInstance = await deployer.deployAsync(ContractName.TokenTransferProxy); @@ -75,10 +75,10 @@ describe('AssetProxyDispatcher', () => { provider, ); await erc20TransferProxyV1.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { - from: accounts[0], + from: owner, }); // Deploy ERC20 Proxy const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); @@ -88,7 +88,7 @@ describe('AssetProxyDispatcher', () => { provider, ); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); // Deploy ERC721 Proxy const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); @@ -98,7 +98,7 @@ describe('AssetProxyDispatcher', () => { provider, ); await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); // Deploy zrx and set initial balances const zrxInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS); diff --git a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts index 72516fd2e..2b21b8cc9 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts @@ -66,10 +66,10 @@ describe('Asset Transfer Proxies', () => { provider, ); await erc20TransferProxyV1.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { - from: accounts[0], + from: owner, }); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { - from: accounts[0], + from: owner, }); // Deploy ERC20 Proxy const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); @@ -79,7 +79,7 @@ describe('Asset Transfer Proxies', () => { provider, ); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { - from: accounts[0], + from: owner, }); // Deploy ERC721 Proxy const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); @@ -89,7 +89,7 @@ describe('Asset Transfer Proxies', () => { provider, ); await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { - from: accounts[0], + from: owner, }); // Deploy zrx and set initial balances const zrxInstance = await deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 2c12f35b7..9f8fc5189 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -74,6 +74,7 @@ describe('Exchange', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); makerAddress = accounts[0]; [tokenOwner, takerAddress, feeRecipientAddress] = accounts; + const owner = tokenOwner; const [repInstance, dgdInstance, zrxInstance, ckInstance] = await Promise.all([ deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), @@ -109,16 +110,16 @@ describe('Exchange', () => { provider, ); await erc20TransferProxyV1.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { - from: accounts[0], + from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20V1, erc20TransferProxyV1.address, ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, + { from: owner }, ); // Deploy ERC20 Proxy const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); @@ -128,13 +129,13 @@ describe('Exchange', () => { provider, ); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, + { from: owner }, ); // Deploy ERC721 Proxy const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); @@ -144,13 +145,13 @@ describe('Exchange', () => { provider, ); await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, erc721TransferProxy.address, ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, + { from: owner }, ); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ @@ -159,7 +160,7 @@ describe('Exchange', () => { assetProxyDispatcher.address, ]); exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); - await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); + await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); 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 cac6e7872..ed140c733 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -33,6 +33,7 @@ describe('Exchange', () => { before(async () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); [makerAddress, feeRecipientAddress] = accounts; + const owner = accounts[0]; const tokenRegistry = await deployer.deployAsync(ContractName.TokenRegistry); const tokenTransferProxy = await deployer.deployAsync(ContractName.TokenTransferProxy); const [rep, dgd, zrx] = await Promise.all([ @@ -49,13 +50,13 @@ describe('Exchange', () => { provider, ); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, + { from: owner }, ); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ @@ -64,7 +65,7 @@ describe('Exchange', () => { assetProxyDispatcher.address, ]); const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); - await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); + await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); 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 daaa4119b..114dbdce2 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -57,6 +57,7 @@ describe('Exchange', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); tokenOwner = accounts[0]; [makerAddress, takerAddress, feeRecipientAddress] = accounts; + const owner = tokenOwner; const [repInstance, dgdInstance, zrxInstance] = await Promise.all([ deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), deployer.deployAsync(ContractName.DummyToken, constants.DUMMY_TOKEN_ARGS), @@ -88,13 +89,13 @@ describe('Exchange', () => { provider, ); await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { - from: accounts[0], + from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, ZeroEx.NULL_ADDRESS, - { from: accounts[0] }, + { from: owner }, ); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ @@ -103,7 +104,7 @@ describe('Exchange', () => { assetProxyDispatcher.address, ]); exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); - await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); + await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); exWrapper = new ExchangeWrapper(exchange, zeroEx); -- cgit