From 3b7068e8d0cb5c77af41f175571ea968d104187e Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 16 Apr 2018 18:12:13 -0700 Subject: renaming after tokenTransferProxy was removed --- .../test/asset_proxy_dispatcher/dispatcher.ts | 68 +++++++++---------- .../test/asset_proxy_dispatcher/proxies.ts | 78 +++++++++++----------- packages/contracts/test/exchange/core.ts | 52 +++++++-------- packages/contracts/test/exchange/wrapper.ts | 56 ++++++++-------- 4 files changed, 127 insertions(+), 127 deletions(-) diff --git a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts index 103bce10d..8445483d8 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/dispatcher.ts @@ -33,8 +33,8 @@ describe('AssetProxyDispatcher', () => { let zrx: DummyTokenContract; let dmyBalances: Balances; let assetProxyDispatcher: AssetProxyDispatcherContract; - let erc20TransferProxy: ERC20ProxyContract; - let erc721TransferProxy: ERC721ProxyContract; + let erc20Proxy: ERC20ProxyContract; + let erc721Proxy: ERC721ProxyContract; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { @@ -56,23 +56,23 @@ describe('AssetProxyDispatcher', () => { from: owner, }); // Deploy ERC20 Proxy - const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); - erc20TransferProxy = new ERC20ProxyContract( - erc20TransferProxyInstance.abi, - erc20TransferProxyInstance.address, + const erc20ProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); + erc20Proxy = new ERC20ProxyContract( + erc20ProxyInstance.abi, + erc20ProxyInstance.address, provider, ); - await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); // Deploy ERC721 Proxy - const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); - erc721TransferProxy = new ERC721ProxyContract( - erc721TransferProxyInstance.abi, - erc721TransferProxyInstance.address, + const erc721ProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); + erc721Proxy = new ERC721ProxyContract( + erc721ProxyInstance.abi, + erc721ProxyInstance.address, provider, ); - await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); // Deploy zrx and set initial balances @@ -81,10 +81,10 @@ describe('AssetProxyDispatcher', () => { await zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }); await zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }); dmyBalances = new Balances([zrx], [makerAddress, takerAddress]); - await zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_BALANCE, { + await zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_BALANCE, { from: takerAddress, }); - await zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_BALANCE, { + await zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_BALANCE, { from: makerAddress, }); }); @@ -98,45 +98,45 @@ describe('AssetProxyDispatcher', () => { it('should record proxy upon registration', async () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + expect(proxyAddress).to.be.equal(erc20Proxy.address); }); it('should be able to record multiple proxies', async () => { // Record first proxy await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + expect(proxyAddress).to.be.equal(erc20Proxy.address); // Record another proxy await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, - erc721TransferProxy.address, + erc721Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721); - expect(proxyAddress).to.be.equal(erc721TransferProxy.address); + expect(proxyAddress).to.be.equal(erc721Proxy.address); }); it('should replace proxy address upon re-registration', async () => { // Initial registration await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + 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( @@ -146,7 +146,7 @@ describe('AssetProxyDispatcher', () => { ); // Register new ERC20 Transfer Proxy contract const newAddress = newErc20TransferProxy.address; - const currentAddress = erc20TransferProxy.address; + const currentAddress = erc20Proxy.address; await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, newAddress, @@ -162,17 +162,17 @@ describe('AssetProxyDispatcher', () => { // Initial registration await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + expect(proxyAddress).to.be.equal(erc20Proxy.address); // The following transaction will throw because the currentAddress is no longer ZeroEx.NULL_ADDRESS return expect( assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ), @@ -183,17 +183,17 @@ describe('AssetProxyDispatcher', () => { // Initial registration await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + expect(proxyAddress).to.be.equal(erc20Proxy.address); // The following transaction will reset the proxy address await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, ZeroEx.NULL_ADDRESS, - erc20TransferProxy.address, + erc20Proxy.address, { from: owner }, ); const newProxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); @@ -204,7 +204,7 @@ describe('AssetProxyDispatcher', () => { return expect( assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: notOwner }, ), @@ -216,12 +216,12 @@ describe('AssetProxyDispatcher', () => { it('should return correct address of registered proxy', async () => { await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); - expect(proxyAddress).to.be.equal(erc20TransferProxy.address); + expect(proxyAddress).to.be.equal(erc20Proxy.address); }); it('should return NULL address if requesting non-existent proxy', async () => { @@ -235,7 +235,7 @@ describe('AssetProxyDispatcher', () => { // Register ERC20 proxy await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); @@ -282,7 +282,7 @@ describe('AssetProxyDispatcher', () => { // Register ERC20 proxy await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, 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 b7adf5a7e..b405cc37d 100644 --- a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts +++ b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts @@ -32,8 +32,8 @@ describe('Asset Transfer Proxies', () => { let zrx: DummyTokenContract; let erc721Token: DummyERC721TokenContract; let dmyBalances: Balances; - let erc20TransferProxy: ERC20ProxyContract; - let erc721TransferProxy: ERC721ProxyContract; + let erc20Proxy: ERC20ProxyContract; + let erc721Proxy: ERC721ProxyContract; const makerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010'); const testAddressPaddedWithZeros = '0x0000000000000000056000000000000000000010'; const INITIAL_BALANCE = new BigNumber(10000); @@ -47,23 +47,23 @@ describe('Asset Transfer Proxies', () => { makerAddress = accounts[3]; takerAddress = accounts[4]; // Deploy ERC20 Proxy - const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); - erc20TransferProxy = new ERC20ProxyContract( - erc20TransferProxyInstance.abi, - erc20TransferProxyInstance.address, + const erc20ProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); + erc20Proxy = new ERC20ProxyContract( + erc20ProxyInstance.abi, + erc20ProxyInstance.address, provider, ); - await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { from: owner, }); // Deploy ERC721 Proxy - const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); - erc721TransferProxy = new ERC721ProxyContract( - erc721TransferProxyInstance.abi, - erc721TransferProxyInstance.address, + const erc721ProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); + erc721Proxy = new ERC721ProxyContract( + erc721ProxyInstance.abi, + erc721ProxyInstance.address, provider, ); - await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcherAddress, { from: owner, }); // Deploy zrx and set initial balances @@ -72,10 +72,10 @@ describe('Asset Transfer Proxies', () => { await zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }); await zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }); dmyBalances = new Balances([zrx], [makerAddress, takerAddress]); - await zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_BALANCE, { + await zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_BALANCE, { from: takerAddress, }); - await zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_BALANCE, { + await zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_BALANCE, { from: makerAddress, }); // Deploy erc721Token and set initial balances @@ -84,10 +84,10 @@ describe('Asset Transfer Proxies', () => { constants.DUMMY_ERC721TOKEN_ARGS, ); erc721Token = new DummyERC721TokenContract(erc721TokenInstance.abi, erc721TokenInstance.address, provider); - await erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: makerAddress, }); - await erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: takerAddress, }); await erc721Token.mint.sendTransactionAsync(makerAddress, makerTokenId, { from: tokenOwner }); @@ -100,29 +100,29 @@ describe('Asset Transfer Proxies', () => { }); describe('Transfer Proxy - ERC20', () => { it('should successfully encode/decode metadata', async () => { - const metadata = await erc20TransferProxy.encodeMetadata.callAsync(AssetProxyId.ERC20, zrx.address); - const address = await erc20TransferProxy.decodeMetadata.callAsync(metadata); + const metadata = await erc20Proxy.encodeMetadata.callAsync(AssetProxyId.ERC20, zrx.address); + const address = await erc20Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(zrx.address); }); it('should successfully decode metadata encoded by typescript helpers', async () => { const metadata = encodeERC20ProxyData(zrx.address); - const address = await erc20TransferProxy.decodeMetadata.callAsync(metadata); + const address = await erc20Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(zrx.address); }); it('should successfully encode/decode metadata padded with zeros', async () => { - const metadata = await erc20TransferProxy.encodeMetadata.callAsync( + const metadata = await erc20Proxy.encodeMetadata.callAsync( AssetProxyId.ERC20, testAddressPaddedWithZeros, ); - const address = await erc20TransferProxy.decodeMetadata.callAsync(metadata); + const address = await erc20Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(testAddressPaddedWithZeros); }); it('should successfully decode metadata encoded padded with zeros by typescript helpers', async () => { const metadata = encodeERC20ProxyData(testAddressPaddedWithZeros); - const address = await erc20TransferProxy.decodeMetadata.callAsync(metadata); + const address = await erc20Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(testAddressPaddedWithZeros); }); @@ -132,7 +132,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const balances = await dmyBalances.getAsync(); const amount = new BigNumber(10); - await erc20TransferProxy.transferFrom.sendTransactionAsync( + await erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -155,7 +155,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const balances = await dmyBalances.getAsync(); const amount = new BigNumber(0); - await erc20TransferProxy.transferFrom.sendTransactionAsync( + await erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -174,12 +174,12 @@ describe('Asset Transfer Proxies', () => { // Create allowance less than transfer amount. Set allowance on proxy. const allowance = new BigNumber(0); const transferAmount = new BigNumber(10); - await zrx.approve.sendTransactionAsync(erc20TransferProxy.address, allowance, { + await zrx.approve.sendTransactionAsync(erc20Proxy.address, allowance, { from: makerAddress, }); // Perform a transfer; expect this to fail. return expect( - erc20TransferProxy.transferFrom.sendTransactionAsync( + erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -195,7 +195,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(10); return expect( - erc20TransferProxy.transferFrom.sendTransactionAsync( + erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -208,37 +208,37 @@ describe('Asset Transfer Proxies', () => { describe('Transfer Proxy - ERC721', () => { it('should successfully encode/decode metadata', async () => { - const metadata = await erc721TransferProxy.encodeMetadata.callAsync( + const metadata = await erc721Proxy.encodeMetadata.callAsync( AssetProxyId.ERC721, erc721Token.address, makerTokenId, ); - const [address, tokenId] = await erc721TransferProxy.decodeMetadata.callAsync(metadata); + const [address, tokenId] = await erc721Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(erc721Token.address); expect(tokenId).to.be.bignumber.equal(makerTokenId); }); it('should successfully decode metadata encoded by typescript helpers', async () => { const metadata = encodeERC721ProxyData(erc721Token.address, makerTokenId); - const [address, tokenId] = await erc721TransferProxy.decodeMetadata.callAsync(metadata); + const [address, tokenId] = await erc721Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(erc721Token.address); expect(tokenId).to.be.bignumber.equal(makerTokenId); }); it('should successfully encode/decode metadata padded with zeros', async () => { - const metadata = await erc721TransferProxy.encodeMetadata.callAsync( + const metadata = await erc721Proxy.encodeMetadata.callAsync( AssetProxyId.ERC721, testAddressPaddedWithZeros, makerTokenId, ); - const [address, tokenId] = await erc721TransferProxy.decodeMetadata.callAsync(metadata); + const [address, tokenId] = await erc721Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(testAddressPaddedWithZeros); expect(tokenId).to.be.bignumber.equal(makerTokenId); }); it('should successfully decode metadata encoded padded with zeros by typescript helpers', async () => { const metadata = encodeERC721ProxyData(testAddressPaddedWithZeros, makerTokenId); - const [address, tokenId] = await erc721TransferProxy.decodeMetadata.callAsync(metadata); + const [address, tokenId] = await erc721Proxy.decodeMetadata.callAsync(metadata); expect(address).to.be.equal(testAddressPaddedWithZeros); expect(tokenId).to.be.bignumber.equal(makerTokenId); }); @@ -252,7 +252,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const balances = await dmyBalances.getAsync(); const amount = new BigNumber(1); - await erc721TransferProxy.transferFrom.sendTransactionAsync( + await erc721Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -274,7 +274,7 @@ describe('Asset Transfer Proxies', () => { const balances = await dmyBalances.getAsync(); const amount = new BigNumber(0); return expect( - erc721TransferProxy.transferFrom.sendTransactionAsync( + erc721Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -294,7 +294,7 @@ describe('Asset Transfer Proxies', () => { const balances = await dmyBalances.getAsync(); const amount = new BigNumber(500); return expect( - erc721TransferProxy.transferFrom.sendTransactionAsync( + erc721Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -308,13 +308,13 @@ describe('Asset Transfer Proxies', () => { // Construct metadata for ERC721 proxy const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId); // Remove transfer approval for makerAddress. - await erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, false, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, false, { from: makerAddress, }); // Perform a transfer; expect this to fail. const amount = new BigNumber(1); return expect( - erc20TransferProxy.transferFrom.sendTransactionAsync( + erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, @@ -330,7 +330,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(1); return expect( - erc721TransferProxy.transferFrom.sendTransactionAsync( + erc721Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, takerAddress, diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 087270db7..63fdf81c2 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -55,8 +55,8 @@ describe('Exchange', () => { let erc721Token: DummyERC721TokenContract; let exchange: ExchangeContract; let assetProxyDispatcher: AssetProxyDispatcherContract; - let erc20TransferProxy: ERC20ProxyContract; - let erc721TransferProxy: ERC721ProxyContract; + let erc20Proxy: ERC20ProxyContract; + let erc721Proxy: ERC721ProxyContract; let signedOrder: SignedOrder; let balances: BalancesByOwner; @@ -102,34 +102,34 @@ describe('Exchange', () => { provider, ); // Deploy ERC20 Proxy - const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); - erc20TransferProxy = new ERC20ProxyContract( - erc20TransferProxyInstance.abi, - erc20TransferProxyInstance.address, + const erc20ProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); + erc20Proxy = new ERC20ProxyContract( + erc20ProxyInstance.abi, + erc20ProxyInstance.address, provider, ); - await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); // Deploy ERC721 Proxy - const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); - erc721TransferProxy = new ERC721ProxyContract( - erc721TransferProxyInstance.abi, - erc721TransferProxyInstance.address, + const erc721ProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); + erc721Proxy = new ERC721ProxyContract( + erc721ProxyInstance.abi, + erc721ProxyInstance.address, provider, ); - await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, - erc721TransferProxy.address, + erc721Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); @@ -165,34 +165,34 @@ describe('Exchange', () => { orderFactory = new OrderFactory(privateKey, defaultOrderParams); dmyBalances = new Balances([rep, dgd, zrx], [makerAddress, takerAddress, feeRecipientAddress]); await Promise.all([ - rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress, }), - rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress, }), rep.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), rep.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress, }), - dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress, }), dgd.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), dgd.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress, }), - zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress, }), zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: makerAddress, }), - erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: takerAddress, }), erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenIds[0], { from: tokenOwner }), @@ -622,21 +622,21 @@ describe('Exchange', () => { }); it('should throw if maker allowances are too low to fill order', async () => { - await rep.approve.sendTransactionAsync(erc20TransferProxy.address, new BigNumber(0), { + await rep.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: makerAddress, }); expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); - await rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + await rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress, }); }); it('should throw if taker allowances are too low to fill order', async () => { - await dgd.approve.sendTransactionAsync(erc20TransferProxy.address, new BigNumber(0), { + await dgd.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: takerAddress, }); expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); - await dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + await dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress, }); }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 7faa3520e..3ea4d9b92 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -43,8 +43,8 @@ describe('Exchange', () => { let exchange: ExchangeContract; let tokenRegistry: TokenRegistryContract; let assetProxyDispatcher: AssetProxyDispatcherContract; - let erc20TransferProxy: ERC20ProxyContract; - let erc721TransferProxy: ERC721ProxyContract; + let erc20Proxy: ERC20ProxyContract; + let erc721Proxy: ERC721ProxyContract; let balances: BalancesByOwner; @@ -83,34 +83,34 @@ describe('Exchange', () => { provider, ); // Deploy ERC20 Proxy - const erc20TransferProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); - erc20TransferProxy = new ERC20ProxyContract( - erc20TransferProxyInstance.abi, - erc20TransferProxyInstance.address, + const erc20ProxyInstance = await deployer.deployAsync(ContractName.ERC20Proxy); + erc20Proxy = new ERC20ProxyContract( + erc20ProxyInstance.abi, + erc20ProxyInstance.address, provider, ); - await erc20TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, - erc20TransferProxy.address, + erc20Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); // Deploy ERC721 Proxy - const erc721TransferProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); - erc721TransferProxy = new ERC721ProxyContract( - erc721TransferProxyInstance.abi, - erc721TransferProxyInstance.address, + const erc721ProxyInstance = await deployer.deployAsync(ContractName.ERC721Proxy); + erc721Proxy = new ERC721ProxyContract( + erc721ProxyInstance.abi, + erc721ProxyInstance.address, provider, ); - await erc721TransferProxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }); await assetProxyDispatcher.addAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, - erc721TransferProxy.address, + erc721Proxy.address, ZeroEx.NULL_ADDRESS, { from: owner }, ); @@ -144,22 +144,22 @@ describe('Exchange', () => { orderFactory = new OrderFactory(privateKey, defaultOrderParams); dmyBalances = new Balances([rep, dgd, zrx], [makerAddress, takerAddress, feeRecipientAddress]); await Promise.all([ - rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), - rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), + rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), + rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), rep.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), rep.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), - dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), + dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), + dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), dgd.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), dgd.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), - zrx.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), + zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress }), + zrx.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress }), zrx.setBalance.sendTransactionAsync(makerAddress, INITIAL_BALANCE, { from: tokenOwner }), zrx.setBalance.sendTransactionAsync(takerAddress, INITIAL_BALANCE, { from: tokenOwner }), - erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: makerAddress, }), - erc721Token.setApprovalForAll.sendTransactionAsync(erc721TransferProxy.address, true, { + erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, { from: takerAddress, }), erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenId, { from: tokenOwner }), @@ -308,11 +308,11 @@ describe('Exchange', () => { it('should not change balances if maker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await rep.approve.sendTransactionAsync(erc20TransferProxy.address, new BigNumber(0), { + await rep.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: makerAddress, }); await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await rep.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + await rep.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: makerAddress, }); @@ -322,11 +322,11 @@ describe('Exchange', () => { it('should not change balances if taker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await dgd.approve.sendTransactionAsync(erc20TransferProxy.address, new BigNumber(0), { + await dgd.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: takerAddress, }); await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await dgd.approve.sendTransactionAsync(erc20TransferProxy.address, INITIAL_ALLOWANCE, { + await dgd.approve.sendTransactionAsync(erc20Proxy.address, INITIAL_ALLOWANCE, { from: takerAddress, }); @@ -347,7 +347,7 @@ describe('Exchange', () => { }); it('should not change balances if makerTokenAddress is ZRX, makerTokenAmount + makerFee > maker allowance', async () => { - const makerZRXAllowance = await zrx.allowance.callAsync(makerAddress, erc20TransferProxy.address); + const makerZRXAllowance = await zrx.allowance.callAsync(makerAddress, erc20Proxy.address); const signedOrder = orderFactory.newSignedOrder({ makerTokenAmount: new BigNumber(makerZRXAllowance), makerFee: new BigNumber(1), @@ -371,7 +371,7 @@ describe('Exchange', () => { }); it('should not change balances if takerTokenAddress is ZRX, takerTokenAmount + takerFee > taker allowance', async () => { - const takerZRXAllowance = await zrx.allowance.callAsync(takerAddress, erc20TransferProxy.address); + const takerZRXAllowance = await zrx.allowance.callAsync(takerAddress, erc20Proxy.address); const signedOrder = orderFactory.newSignedOrder({ takerTokenAmount: new BigNumber(takerZRXAllowance), takerFee: new BigNumber(1), -- cgit