diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-04-14 09:27:00 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:18 +0800 |
commit | 6be5fe928e4820ed674c7a8f74fd24b63871b4c7 (patch) | |
tree | eb518ca1066477d1b509490999f0cc647707e5d4 /packages/contracts/test | |
parent | 167654c9a0403a11dcccde7e93d8baed52c17786 (diff) | |
download | dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar.gz dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar.bz2 dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar.lz dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar.xz dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.tar.zst dexon-0x-contracts-6be5fe928e4820ed674c7a8f74fd24b63871b4c7.zip |
Removed takerTokenAddress and makerTokenAddress from Order struct.
Diffstat (limited to 'packages/contracts/test')
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 152 | ||||
-rw-r--r-- | packages/contracts/test/exchange/helpers.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 181 |
3 files changed, 159 insertions, 176 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 9e201a8e7..d3cafe316 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -78,6 +78,9 @@ describe('Exchange', () => { new BigNumber('0x4040404040404040404040404040404040404040404040404040404040404040'), ]; + let defaultMakerTokenAddress: string; + let defaultTakerTokenAddress: string; + let zeroEx: ZeroEx; before(async () => { @@ -176,12 +179,13 @@ describe('Exchange', () => { }); exWrapper = new ExchangeWrapper(exchange, zeroEx); + defaultMakerTokenAddress = rep.address; + defaultTakerTokenAddress = dgd.address; + const defaultOrderParams = { exchangeAddress: exchange.address, makerAddress, feeRecipientAddress, - makerTokenAddress: rep.address, - takerTokenAddress: dgd.address, makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18), @@ -327,20 +331,20 @@ describe('Exchange', () => { const takerFeePaid = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFeePaid), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFeePaid), @@ -380,20 +384,20 @@ describe('Exchange', () => { const takerFeePaid = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFeePaid), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFeePaid), @@ -433,20 +437,20 @@ describe('Exchange', () => { const takerFeePaid = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFeePaid), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFeePaid), @@ -488,20 +492,20 @@ describe('Exchange', () => { const takerFeePaid = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFeePaid), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFeePaid), @@ -524,20 +528,20 @@ describe('Exchange', () => { ); const newBalances = await dmyBalances.getAsync(); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(signedOrder.makerTokenAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerTokenAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(signedOrder.takerTokenAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(signedOrder.takerTokenAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(signedOrder.makerFee), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(signedOrder.takerTokenAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(signedOrder.takerTokenAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(signedOrder.makerTokenAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerTokenAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(signedOrder.takerFee), @@ -564,8 +568,8 @@ describe('Exchange', () => { expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress); expect(takerAddress).to.be.equal(logArgs.takerAddress); expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress); - expect(signedOrder.makerTokenAddress).to.be.equal(logArgs.makerTokenAddress); - expect(signedOrder.takerTokenAddress).to.be.equal(logArgs.takerTokenAddress); + expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData); + expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData); expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerTokenFilledAmount); expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerTokenFilledAmount); expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid); @@ -593,8 +597,8 @@ describe('Exchange', () => { expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress); expect(takerAddress).to.be.equal(logArgs.takerAddress); expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress); - expect(signedOrder.makerTokenAddress).to.be.equal(logArgs.makerTokenAddress); - expect(signedOrder.takerTokenAddress).to.be.equal(logArgs.takerTokenAddress); + expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData); + expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData); expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerTokenFilledAmount); expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerTokenFilledAmount); expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid); @@ -767,8 +771,8 @@ describe('Exchange', () => { expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress); expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress); - expect(signedOrder.makerTokenAddress).to.be.equal(logArgs.makerTokenAddress); - expect(signedOrder.takerTokenAddress).to.be.equal(logArgs.takerTokenAddress); + expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData); + expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData); expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash); }); @@ -850,20 +854,20 @@ describe('Exchange', () => { const fillTakerTokenAmount = signedOrders[2].takerTokenAmount.add(signedOrders[3].takerTokenAmount); const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee); const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee); - expect(newBalances[makerAddress][signedOrders[3].makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[3].makerTokenAddress].minus(fillMakerTokenAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(fillMakerTokenAmount), ); - expect(newBalances[makerAddress][signedOrders[3].takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[3].takerTokenAddress].add(fillTakerTokenAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(fillTakerTokenAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrders[3].takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[3].takerTokenAddress].minus(fillTakerTokenAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(fillTakerTokenAmount), ); - expect(newBalances[takerAddress][signedOrders[3].makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[3].makerTokenAddress].add(fillMakerTokenAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(fillMakerTokenAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -880,8 +884,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenIds[0]; const takerTokenId = erc721TakerTokenIds[1]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(1), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -907,8 +909,6 @@ describe('Exchange', () => { const makerTokenId = erc721TakerTokenIds[0]; const takerTokenId = erc721TakerTokenIds[1]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(1), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -931,8 +931,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenIds[0]; const takerTokenId = erc721MakerTokenIds[1]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(1), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -955,8 +953,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenIds[0]; const takerTokenId = erc721TakerTokenIds[0]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(2), takerTokenAmount: new BigNumber(1), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -979,8 +975,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenIds[0]; const takerTokenId = erc721TakerTokenIds[0]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(500), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -1003,8 +997,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenIds[0]; const takerTokenId = erc721TakerTokenIds[0]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(0), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -1026,12 +1018,10 @@ describe('Exchange', () => { // Construct Exchange parameters const makerTokenId = erc721MakerTokenIds[0]; signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: dgd.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), - takerAssetData: encodeERC20ProxyData(dgd.address), + takerAssetData: encodeERC20ProxyData(defaultTakerTokenAddress), }); // Verify pre-conditions const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId); @@ -1045,11 +1035,11 @@ describe('Exchange', () => { expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress); // Verify ERC20 tokens were transferred from Taker to Maker & fees were paid correctly const newBalances = await dmyBalances.getAsync(); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(signedOrder.makerFee), @@ -1066,12 +1056,10 @@ describe('Exchange', () => { // Construct Exchange parameters const takerTokenId = erc721TakerTokenIds[0]; signedOrder = orderFactory.newSignedOrder({ - takerTokenAddress: erc721Token.address, - makerTokenAddress: dgd.address, takerTokenAmount: new BigNumber(1), makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), takerAssetData: encodeERC721ProxyData(erc721Token.address, takerTokenId), - makerAssetData: encodeERC20ProxyData(dgd.address), + makerAssetData: encodeERC20ProxyData(defaultMakerTokenAddress), }); // Verify pre-conditions const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerTokenId); @@ -1085,11 +1073,11 @@ describe('Exchange', () => { expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress); // Verify ERC20 tokens were transferred from Maker to Taker & fees were paid correctly const newBalances = await dmyBalances.getAsync(); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(signedOrder.makerTokenAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerTokenAmount), ); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(signedOrder.makerTokenAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerTokenAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(signedOrder.makerFee), diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index c447c0e01..92fce8e47 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -56,8 +56,6 @@ describe('Exchange', () => { exchangeAddress: exchange.address, makerAddress, feeRecipientAddress, - makerTokenAddress: rep.address, - takerTokenAddress: dgd.address, makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18), diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 83915d07d..caff990d6 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -55,6 +55,9 @@ describe('Exchange', () => { const erc721MakerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010'); const erc721TakerTokenId = new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030'); + let defaultMakerTokenAddress: string; + let defaultTakerTokenAddress: string; + before(async () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); tokenOwner = accounts[0]; @@ -123,12 +126,12 @@ describe('Exchange', () => { const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID }); exWrapper = new ExchangeWrapper(exchange, zeroEx); + defaultMakerTokenAddress = rep.address; + defaultTakerTokenAddress = dgd.address; const defaultOrderParams = { exchangeAddress: exchange.address, makerAddress, feeRecipientAddress, - makerTokenAddress: rep.address, - takerTokenAddress: dgd.address, makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18), @@ -192,20 +195,20 @@ describe('Exchange', () => { const takerFee = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -260,20 +263,20 @@ describe('Exchange', () => { const takerFee = signedOrder.takerFee .times(makerTokenFilledAmount) .dividedToIntegerBy(signedOrder.makerTokenAmount); - expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrder.takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrder.takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrder.makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -334,7 +337,6 @@ describe('Exchange', () => { it('should not change balances if makerTokenAddress is ZRX, makerTokenAmount + makerFee > maker balance', async () => { const makerZRXBalance = new BigNumber(balances[makerAddress][zrx.address]); const signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: zrx.address, makerTokenAmount: makerZRXBalance, makerFee: new BigNumber(1), makerAssetData: encodeERC20ProxyData(zrx.address), @@ -347,7 +349,6 @@ 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 signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: zrx.address, makerTokenAmount: new BigNumber(makerZRXAllowance), makerFee: new BigNumber(1), makerAssetData: encodeERC20ProxyData(zrx.address), @@ -360,7 +361,6 @@ describe('Exchange', () => { it('should not change balances if takerTokenAddress is ZRX, takerTokenAmount + takerFee > taker balance', async () => { const takerZRXBalance = new BigNumber(balances[takerAddress][zrx.address]); const signedOrder = orderFactory.newSignedOrder({ - takerTokenAddress: zrx.address, takerTokenAmount: takerZRXBalance, takerFee: new BigNumber(1), takerAssetData: encodeERC20ProxyData(zrx.address), @@ -373,7 +373,6 @@ 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 signedOrder = orderFactory.newSignedOrder({ - takerTokenAddress: zrx.address, takerTokenAmount: new BigNumber(takerZRXAllowance), takerFee: new BigNumber(1), takerAssetData: encodeERC20ProxyData(zrx.address), @@ -388,8 +387,6 @@ describe('Exchange', () => { const makerTokenId = erc721MakerTokenId; const takerTokenId = erc721TakerTokenId; const signedOrder = orderFactory.newSignedOrder({ - makerTokenAddress: erc721Token.address, - takerTokenAddress: erc721Token.address, makerTokenAmount: new BigNumber(1), takerTokenAmount: new BigNumber(1), makerAssetData: encodeERC721ProxyData(erc721Token.address, makerTokenId), @@ -640,20 +637,20 @@ describe('Exchange', () => { ); const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2)); const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2)); - expect(newBalances[makerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -666,20 +663,20 @@ describe('Exchange', () => { it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => { const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18); _.forEach(signedOrders, signedOrder => { - balances[makerAddress][signedOrder.makerTokenAddress] = balances[makerAddress][ - signedOrder.makerTokenAddress + balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][ + defaultMakerTokenAddress ].minus(signedOrder.makerTokenAmount); - balances[makerAddress][signedOrder.takerTokenAddress] = balances[makerAddress][ - signedOrder.takerTokenAddress + balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][ + defaultTakerTokenAddress ].add(signedOrder.takerTokenAmount); balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus( signedOrder.makerFee, ); - balances[takerAddress][signedOrder.makerTokenAddress] = balances[takerAddress][ - signedOrder.makerTokenAddress + balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][ + defaultMakerTokenAddress ].add(signedOrder.makerTokenAmount); - balances[takerAddress][signedOrder.takerTokenAddress] = balances[takerAddress][ - signedOrder.takerTokenAddress + balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][ + defaultTakerTokenAddress ].minus(signedOrder.takerTokenAmount); balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus( signedOrder.takerFee, @@ -699,7 +696,7 @@ describe('Exchange', () => { it('should throw when an signedOrder does not use the same takerTokenAddress', async () => { signedOrders = [ orderFactory.newSignedOrder(), - orderFactory.newSignedOrder({ takerTokenAddress: zrx.address }), + orderFactory.newSignedOrder({ takerAssetData: encodeERC20ProxyData(zrx.address) }), orderFactory.newSignedOrder(), ]; @@ -727,20 +724,20 @@ describe('Exchange', () => { ); const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2)); const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2)); - expect(newBalances[makerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].makerTokenAddress].minus(makerTokenFilledAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFilledAmount), ); - expect(newBalances[makerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].takerTokenAddress].add(takerTokenFillAmount), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(takerTokenFillAmount), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].takerTokenAddress].minus(takerTokenFillAmount), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(takerTokenFillAmount), ); - expect(newBalances[takerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].makerTokenAddress].add(makerTokenFilledAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFilledAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -753,20 +750,20 @@ describe('Exchange', () => { it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => { const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18); _.forEach(signedOrders, signedOrder => { - balances[makerAddress][signedOrder.makerTokenAddress] = balances[makerAddress][ - signedOrder.makerTokenAddress + balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][ + defaultMakerTokenAddress ].minus(signedOrder.makerTokenAmount); - balances[makerAddress][signedOrder.takerTokenAddress] = balances[makerAddress][ - signedOrder.takerTokenAddress + balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][ + defaultTakerTokenAddress ].add(signedOrder.takerTokenAmount); balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus( signedOrder.makerFee, ); - balances[takerAddress][signedOrder.makerTokenAddress] = balances[takerAddress][ - signedOrder.makerTokenAddress + balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][ + defaultMakerTokenAddress ].add(signedOrder.makerTokenAmount); - balances[takerAddress][signedOrder.takerTokenAddress] = balances[takerAddress][ - signedOrder.takerTokenAddress + balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][ + defaultTakerTokenAddress ].minus(signedOrder.takerTokenAmount); balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus( signedOrder.takerFee, @@ -786,7 +783,7 @@ describe('Exchange', () => { it('should throw when a signedOrder does not use the same takerTokenAddress', async () => { signedOrders = [ orderFactory.newSignedOrder(), - orderFactory.newSignedOrder({ takerTokenAddress: zrx.address }), + orderFactory.newSignedOrder({ takerAssetData: encodeERC20ProxyData(zrx.address) }), orderFactory.newSignedOrder(), ]; @@ -814,20 +811,20 @@ describe('Exchange', () => { ); const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2)); const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2)); - expect(newBalances[makerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].makerTokenAddress].minus(makerTokenFillAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFillAmount), ); - expect(newBalances[makerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].takerTokenAddress].add(makerAmountBought), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].takerTokenAddress].minus(makerAmountBought), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought), ); - expect(newBalances[takerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].makerTokenAddress].add(makerTokenFillAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFillAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -840,20 +837,20 @@ describe('Exchange', () => { it('should fill all signedOrders if cannot fill entire makerTokenFillAmount', async () => { const makerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18); _.forEach(signedOrders, signedOrder => { - balances[makerAddress][signedOrder.makerTokenAddress] = balances[makerAddress][ - signedOrder.makerTokenAddress + balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][ + defaultMakerTokenAddress ].minus(signedOrder.makerTokenAmount); - balances[makerAddress][signedOrder.takerTokenAddress] = balances[makerAddress][ - signedOrder.takerTokenAddress + balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][ + defaultTakerTokenAddress ].add(signedOrder.takerTokenAmount); balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus( signedOrder.makerFee, ); - balances[takerAddress][signedOrder.makerTokenAddress] = balances[takerAddress][ - signedOrder.makerTokenAddress + balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][ + defaultMakerTokenAddress ].add(signedOrder.makerTokenAmount); - balances[takerAddress][signedOrder.takerTokenAddress] = balances[takerAddress][ - signedOrder.takerTokenAddress + balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][ + defaultTakerTokenAddress ].minus(signedOrder.takerTokenAmount); balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus( signedOrder.takerFee, @@ -873,7 +870,7 @@ describe('Exchange', () => { it('should throw when an signedOrder does not use the same makerTokenAddress', async () => { signedOrders = [ orderFactory.newSignedOrder(), - orderFactory.newSignedOrder({ makerTokenAddress: zrx.address }), + orderFactory.newSignedOrder({ makerAssetData: encodeERC20ProxyData(zrx.address) }), orderFactory.newSignedOrder(), ]; @@ -901,20 +898,20 @@ describe('Exchange', () => { ); const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2)); const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2)); - expect(newBalances[makerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].makerTokenAddress].minus(makerTokenFillAmount), + expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultMakerTokenAddress].minus(makerTokenFillAmount), ); - expect(newBalances[makerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[makerAddress][signedOrders[0].takerTokenAddress].add(makerAmountBought), + expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought), ); expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( balances[makerAddress][zrx.address].minus(makerFee), ); - expect(newBalances[takerAddress][signedOrders[0].takerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].takerTokenAddress].minus(makerAmountBought), + expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought), ); - expect(newBalances[takerAddress][signedOrders[0].makerTokenAddress]).to.be.bignumber.equal( - balances[takerAddress][signedOrders[0].makerTokenAddress].add(makerTokenFillAmount), + expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal( + balances[takerAddress][defaultMakerTokenAddress].add(makerTokenFillAmount), ); expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( balances[takerAddress][zrx.address].minus(takerFee), @@ -927,20 +924,20 @@ describe('Exchange', () => { it('should fill all signedOrders if cannot fill entire takerTokenFillAmount', async () => { const takerTokenFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18); _.forEach(signedOrders, signedOrder => { - balances[makerAddress][signedOrder.makerTokenAddress] = balances[makerAddress][ - signedOrder.makerTokenAddress + balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][ + defaultMakerTokenAddress ].minus(signedOrder.makerTokenAmount); - balances[makerAddress][signedOrder.takerTokenAddress] = balances[makerAddress][ - signedOrder.takerTokenAddress + balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][ + defaultTakerTokenAddress ].add(signedOrder.takerTokenAmount); balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus( signedOrder.makerFee, ); - balances[takerAddress][signedOrder.makerTokenAddress] = balances[takerAddress][ - signedOrder.makerTokenAddress + balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][ + defaultMakerTokenAddress ].add(signedOrder.makerTokenAmount); - balances[takerAddress][signedOrder.takerTokenAddress] = balances[takerAddress][ - signedOrder.takerTokenAddress + balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][ + defaultTakerTokenAddress ].minus(signedOrder.takerTokenAmount); balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus( signedOrder.takerFee, @@ -960,7 +957,7 @@ describe('Exchange', () => { it('should throw when a signedOrder does not use the same makerTokenAddress', async () => { signedOrders = [ orderFactory.newSignedOrder(), - orderFactory.newSignedOrder({ makerTokenAddress: zrx.address }), + orderFactory.newSignedOrder({ makerAssetData: encodeERC20ProxyData(zrx.address) }), orderFactory.newSignedOrder(), ]; |