aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/wrapper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/exchange/wrapper.ts')
-rw-r--r--packages/contracts/test/exchange/wrapper.ts204
1 files changed, 111 insertions, 93 deletions
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 60f47373e..d2d82f977 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -19,13 +19,7 @@ import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
import { OrderFactory } from '../../src/utils/order_factory';
-import {
- AssetProxyId,
- ContractName,
- ERC20BalancesByOwner,
- ERC721BalancesByOwner,
- SignedOrder,
-} from '../../src/utils/types';
+import { AssetProxyId, ContractName, ERC20BalancesByOwner, SignedOrder } from '../../src/utils/types';
import { chaiSetup } from '../utils/chai_setup';
import { deployer } from '../utils/deployer';
import { provider, web3Wrapper } from '../utils/web3_wrapper';
@@ -42,7 +36,7 @@ describe('Exchange wrappers', () => {
let erc20TokenA: DummyERC20TokenContract;
let erc20TokenB: DummyERC20TokenContract;
- let zrx: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
let erc721Token: DummyERC721TokenContract;
let exchange: ExchangeContract;
let assetProxyDispatcher: AssetProxyDispatcherContract;
@@ -70,12 +64,12 @@ describe('Exchange wrappers', () => {
erc20Wrapper = new ERC20Wrapper(deployer, provider, usedAddresses, owner);
erc721Wrapper = new ERC721Wrapper(deployer, provider, usedAddresses, owner);
- [erc20TokenA, erc20TokenB, zrx] = await erc20Wrapper.deployDummyERC20TokensAsync();
- erc20Proxy = await erc20Wrapper.deployERC20ProxyAsync();
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
await erc20Wrapper.setBalancesAndAllowancesAsync();
- [erc721Token] = await erc721Wrapper.deployDummyERC721TokensAsync();
- erc721Proxy = await erc721Wrapper.deployERC721ProxyAsync();
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
await erc721Wrapper.setBalancesAndAllowancesAsync();
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetId = erc721Balances[makerAddress][erc721Token.address][0];
@@ -110,7 +104,7 @@ describe('Exchange wrappers', () => {
const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [
assetProxyDispatcher.address,
- assetProxyUtils.encodeERC20ProxyData(zrx.address),
+ assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
]);
exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider);
await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
@@ -169,8 +163,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
@@ -178,11 +172,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -237,8 +231,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
@@ -246,11 +240,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -303,11 +297,11 @@ describe('Exchange wrappers', () => {
});
it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker balance', async () => {
- const makerZRXBalance = new BigNumber(erc20Balances[makerAddress][zrx.address]);
+ const makerZRXBalance = new BigNumber(erc20Balances[makerAddress][zrxToken.address]);
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: makerZRXBalance,
makerFee: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -315,11 +309,11 @@ describe('Exchange wrappers', () => {
});
it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker allowance', async () => {
- const makerZRXAllowance = await zrx.allowance.callAsync(makerAddress, erc20Proxy.address);
+ const makerZRXAllowance = await zrxToken.allowance.callAsync(makerAddress, erc20Proxy.address);
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(makerZRXAllowance),
makerFee: new BigNumber(1),
- makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -327,11 +321,11 @@ describe('Exchange wrappers', () => {
});
it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker balance', async () => {
- const takerZRXBalance = new BigNumber(erc20Balances[takerAddress][zrx.address]);
+ const takerZRXBalance = new BigNumber(erc20Balances[takerAddress][zrxToken.address]);
const signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: takerZRXBalance,
takerFee: new BigNumber(1),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -339,11 +333,11 @@ describe('Exchange wrappers', () => {
});
it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker allowance', async () => {
- const takerZRXAllowance = await zrx.allowance.callAsync(takerAddress, erc20Proxy.address);
+ const takerZRXAllowance = await zrxToken.allowance.callAsync(takerAddress, erc20Proxy.address);
const signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: new BigNumber(takerZRXAllowance),
takerFee: new BigNumber(1),
- takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address),
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
@@ -409,16 +403,20 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
takerAssetFillAmount,
);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(makerFee);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
makerAssetFilledAmount,
);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(takerFee);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(makerFee.add(takerFee));
});
@@ -454,16 +452,20 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
takerAssetFillAmount,
);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(makerFee);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
makerAssetFilledAmount,
);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(takerFee);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(makerFee.add(takerFee));
});
@@ -515,16 +517,20 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
takerAssetFillAmount,
);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(makerFee);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
makerAssetFilledAmount,
);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(takerFee);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(makerFee.add(takerFee));
});
@@ -566,16 +572,20 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
takerAssetFillAmount,
);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(makerFee);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
makerAssetFilledAmount,
);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(takerFee);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(makerFee.add(takerFee));
});
@@ -611,8 +621,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
@@ -620,11 +630,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -637,7 +647,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
@@ -646,11 +656,11 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
signedOrder.takerFee,
);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(signedOrder.makerFee.add(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
@@ -664,7 +674,9 @@ describe('Exchange wrappers', () => {
it('should throw when an signedOrder does not use the same takerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ }),
orderFactory.newSignedOrder(),
];
@@ -698,8 +710,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
@@ -707,11 +719,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -724,7 +736,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
@@ -733,11 +745,11 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
signedOrder.takerFee,
);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(signedOrder.makerFee.add(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
@@ -751,7 +763,9 @@ describe('Exchange wrappers', () => {
it('should throw when a signedOrder does not use the same takerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({
+ takerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ }),
orderFactory.newSignedOrder(),
];
@@ -785,8 +799,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
@@ -794,11 +808,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -811,7 +825,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
@@ -820,11 +834,11 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
signedOrder.takerFee,
);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(signedOrder.makerFee.add(signedOrder.takerFee));
});
await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
@@ -838,7 +852,9 @@ describe('Exchange wrappers', () => {
it('should throw when an signedOrder does not use the same makerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ }),
orderFactory.newSignedOrder(),
];
@@ -872,8 +888,8 @@ describe('Exchange wrappers', () => {
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrx.address].minus(makerFee),
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
);
expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
@@ -881,11 +897,11 @@ describe('Exchange wrappers', () => {
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrx.address].minus(takerFee),
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrx.address].add(makerFee.add(takerFee)),
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
);
});
@@ -898,7 +914,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrx.address] = erc20Balances[makerAddress][zrx.address].minus(
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
@@ -907,11 +923,11 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrx.address] = erc20Balances[takerAddress][zrx.address].minus(
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
signedOrder.takerFee,
);
- erc20Balances[feeRecipientAddress][zrx.address] = erc20Balances[feeRecipientAddress][
- zrx.address
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
].add(signedOrder.makerFee.add(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
@@ -925,7 +941,9 @@ describe('Exchange wrappers', () => {
it('should throw when a signedOrder does not use the same makerAssetAddress', async () => {
signedOrders = [
orderFactory.newSignedOrder(),
- orderFactory.newSignedOrder({ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrx.address) }),
+ orderFactory.newSignedOrder({
+ makerAssetData: assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
+ }),
orderFactory.newSignedOrder(),
];