From cc77f8489e5a176406d4871772fcbae58703bafc Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 11 Apr 2018 10:18:02 -0700 Subject: nilAddress to ZeroEx.NULL_ADDRESS --- .../test/asset_proxy_dispatcher/dispatcher.ts | 31 +++++++++++----------- .../test/asset_proxy_dispatcher/proxies.ts | 1 - packages/contracts/test/exchange/core.ts | 7 +++-- packages/contracts/test/exchange/helpers.ts | 5 ++-- packages/contracts/test/exchange/wrapper.ts | 5 ++-- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts index ea1f39fc8..7ee2f98f0 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts @@ -42,7 +42,6 @@ describe('AssetProxyDispatcher', () => { let erc20TransferProxyV1: ERC20Proxy_v1Contract; let erc20TransferProxy: ERC20ProxyContract; let erc721TransferProxy: ERC721ProxyContract; - const nilAddress = '0x0000000000000000000000000000000000000000'; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { @@ -129,7 +128,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -140,7 +139,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -149,7 +148,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, erc721TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721); @@ -160,7 +159,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -190,18 +189,18 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); expect(proxyAddress).to.be.equal(erc20TransferProxy.address); - // The following transaction will throw because the currentAddress is no longer nilAddress + // The following transaction will throw because the currentAddress is no longer ZeroEx.NULL_ADDRESS return expect( assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ), ).to.be.rejectedWith(constants.REVERT); @@ -211,7 +210,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -220,12 +219,12 @@ describe('AssetProxyDispatcher', () => { // The following transaction will reset the proxy address await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - nilAddress, + ZeroEx.NULL_ADDRESS, erc20TransferProxy.address, { from: owner }, ); const newProxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(newProxyAddress).to.be.equal(nilAddress); + expect(newProxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS); }); it('should throw if requesting address is not authorized', async () => { @@ -233,7 +232,7 @@ describe('AssetProxyDispatcher', () => { assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: notOwner }, ), ).to.be.rejectedWith(constants.REVERT); @@ -245,7 +244,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -254,7 +253,7 @@ describe('AssetProxyDispatcher', () => { it('should return NULL address if requesting non-existent proxy', async () => { const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(nilAddress); + expect(proxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS); }); }); @@ -264,7 +263,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); @@ -315,7 +314,7 @@ describe('AssetProxyDispatcher', () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: owner }, ); diff --git a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts index 2d7a3821f..a8c5a2abc 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts @@ -43,7 +43,6 @@ describe('Asset Transfer Proxies', () => { let erc20TransferProxyV1: ERC20Proxy_v1Contract; let erc20TransferProxy: ERC20ProxyContract; let erc721TransferProxy: ERC721ProxyContract; - const nilAddress = '0x0000000000000000000000000000000000000000'; const makerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010'); const INITIAL_BALANCE = new BigNumber(10000); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 58b528062..d95dbea35 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -149,23 +149,22 @@ describe('Exchange', () => { await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { from: accounts[0], }); - const nilAddress = '0x0000000000000000000000000000000000000000'; await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20_V1, erc20TransferProxyV1.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, erc721TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); zeroEx = new ZeroEx(provider, { diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 7a267a3e9..ab5419e4f 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -64,17 +64,16 @@ describe('Exchange', () => { await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { from: accounts[0], }); - const nilAddress = '0x0000000000000000000000000000000000000000'; await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20_V1, erc20TransferProxyV1.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 708ac5562..5b0564fd2 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -114,17 +114,16 @@ describe('Exchange', () => { await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, { from: accounts[0], }); - const nilAddress = '0x0000000000000000000000000000000000000000'; await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20_V1, erc20TransferProxyV1.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20TransferProxy.address, - nilAddress, + ZeroEx.NULL_ADDRESS, { from: accounts[0] }, ); const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); -- cgit