aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol8
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol6
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol24
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts2
-rw-r--r--packages/contracts/test/asset_proxy_dispatcher/proxies.ts16
-rw-r--r--packages/contracts/test/exchange/core.ts292
-rw-r--r--packages/contracts/test/exchange/wrapper.ts200
7 files changed, 274 insertions, 274 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
index 0550d6c4b..ef2fb2a96 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
@@ -77,9 +77,9 @@ contract IExchange {
/// @dev Calculates the sum of values already filled and cancelled for a given order.
/// @param orderHash The Keccak-256 hash of the given order.
/// @return Sum of values already filled and cancelled.
- function getUnavailableTakerTokenAmount(bytes32 orderHash)
+ function getUnavailableTakerAssetAmount(bytes32 orderHash)
public view
- returns (uint256 unavailableTakerTokenAmount);
+ returns (uint256 unavailableTakerAssetAmount);
/// @dev Calculates partial value given a numerator and denominator.
/// @param numerator Numerator.
@@ -257,7 +257,7 @@ contract IExchange {
bytes32[] r,
bytes32[] s)
external
- returns (uint256 totalTakerTokenFilledAmount);
+ returns (uint256 totalTakerAssetFilledAmount);
/// @dev Synchronously executes multiple calls of fillOrderNoThrow in a single transaction until total takerAssetFillAmount filled.
/// @param orderAddresses Array of address arrays containing individual order addresses.
@@ -275,7 +275,7 @@ contract IExchange {
bytes32[] r,
bytes32[] s)
external
- returns (uint256 totalTakerTokenFilledAmount);
+ returns (uint256 totalTakerAssetFilledAmount);
/// @dev Synchronously cancels multiple orders in a single transaction.
/// @param orderAddresses Array of address arrays containing individual order addresses.
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
index d4801a8fd..710315515 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
@@ -127,14 +127,14 @@ contract MixinExchangeCore is
}
// Validate order availability
- uint256 remainingTakerTokenFillAmount = safeSub(order.takerAssetAmount, filled[orderHash]);
- if (remainingTakerTokenFillAmount == 0) {
+ uint256 remainingTakerAssetFillAmount = safeSub(order.takerAssetAmount, filled[orderHash]);
+ if (remainingTakerAssetFillAmount == 0) {
emit ExchangeError(uint8(Errors.ORDER_FULLY_FILLED), orderHash);
return fillResults;
}
// Validate fill order rounding
- fillResults.takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerTokenFillAmount);
+ fillResults.takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetFillAmount);
if (isRoundingError(fillResults.takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount)) {
emit ExchangeError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), orderHash);
fillResults.takerAssetFilledAmount = 0;
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
index caa391aed..2c0fd0751 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
@@ -326,12 +326,12 @@ contract MixinWrapperFunctions is
require(areBytesEqual(orders[i].takerAssetData, orders[0].takerAssetData));
// Calculate the remaining amount of takerAsset to sell
- uint256 remainingTakerTokenFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
// Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrder(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
@@ -365,12 +365,12 @@ contract MixinWrapperFunctions is
require(areBytesEqual(orders[i].takerAssetData, orders[0].takerAssetData));
// Calculate the remaining amount of takerAsset to sell
- uint256 remainingTakerTokenFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
// Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrderNoThrow(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
@@ -403,20 +403,20 @@ contract MixinWrapperFunctions is
require(areBytesEqual(orders[i].makerAssetData, orders[0].makerAssetData));
// Calculate the remaining amount of makerAsset to buy
- uint256 remainingMakerTokenFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
// Convert the remaining amount of makerAsset to buy into remaining amount
// of takerAsset to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerTokenFillAmount = getPartialAmount(
+ uint256 remainingTakerAssetFillAmount = getPartialAmount(
orders[i].takerAssetAmount,
orders[i].makerAssetAmount,
- remainingMakerTokenFillAmount
+ remainingMakerAssetFillAmount
);
// Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrder(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
@@ -450,20 +450,20 @@ contract MixinWrapperFunctions is
require(areBytesEqual(orders[i].makerAssetData, orders[0].makerAssetData));
// Calculate the remaining amount of makerAsset to buy
- uint256 remainingMakerTokenFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
// Convert the remaining amount of makerAsset to buy into remaining amount
// of takerAsset to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerTokenFillAmount = getPartialAmount(
+ uint256 remainingTakerAssetFillAmount = getPartialAmount(
orders[i].takerAssetAmount,
orders[i].makerAssetAmount,
- remainingMakerTokenFillAmount
+ remainingMakerAssetFillAmount
);
// Attempt to sell the remaining amount of takerAsset
FillResults memory singleFillResults = fillOrderNoThrow(
orders[i],
- remainingTakerTokenFillAmount,
+ remainingTakerAssetFillAmount,
signatures[i]
);
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index c4cfdc46c..26ce8b04e 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -221,7 +221,7 @@ export class ExchangeWrapper {
);
return partialAmount;
}
- public async getTakerTokenFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
+ public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
return filledAmount;
}
diff --git a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
index 2b0d80338..5148929aa 100644
--- a/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
+++ b/packages/contracts/test/asset_proxy_dispatcher/proxies.ts
@@ -172,8 +172,8 @@ describe('Asset Transfer Proxies', () => {
// Construct metadata for ERC721 proxy
const encodedProxyMetadata = proxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(1);
@@ -185,16 +185,16 @@ describe('Asset Transfer Proxies', () => {
{ from: assetProxyDispatcherAddress },
);
// Verify transfer was successful
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
});
it('should throw if transferring 0 amount of a token', async () => {
// Construct metadata for ERC721 proxy
const encodedProxyMetadata = proxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(0);
@@ -213,8 +213,8 @@ describe('Asset Transfer Proxies', () => {
// Construct metadata for ERC721 proxy
const encodedProxyMetadata = proxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId);
// Verify pre-condition
- const ownerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(ownerMakerToken).to.be.bignumber.equal(makerAddress);
+ const ownerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const balances = await dmyBalances.getAsync();
const amount = new BigNumber(500);
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 3da8dd21f..13d0d6918 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -64,18 +64,18 @@ describe('Exchange', () => {
let dmyBalances: Balances;
let orderFactory: OrderFactory;
- const erc721MakerTokenIds = [
+ const erc721MakerAssetIds = [
new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010'),
new BigNumber('0x2020202020202020202020202020202020202020202020202020202020202020'),
];
- const erc721TakerTokenIds = [
+ const erc721TakerAssetIds = [
new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030'),
new BigNumber('0x4040404040404040404040404040404040404040404040404040404040404040'),
];
- let defaultMakerTokenAddress: string;
- let defaultTakerTokenAddress: string;
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
let zeroEx: ZeroEx;
@@ -140,8 +140,8 @@ describe('Exchange', () => {
});
exWrapper = new ExchangeWrapper(exchange, zeroEx);
- defaultMakerTokenAddress = rep.address;
- defaultTakerTokenAddress = dgd.address;
+ defaultMakerAssetAddress = rep.address;
+ defaultTakerAssetAddress = dgd.address;
const defaultOrderParams = {
exchangeAddress: exchange.address,
@@ -151,8 +151,8 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerTokenAddress),
- takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
+ takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
@@ -188,10 +188,10 @@ describe('Exchange', () => {
erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, {
from: takerAddress,
}),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenIds[0], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenIds[1], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenIds[0], { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenIds[1], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetIds[0], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetIds[1], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetIds[0], { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetIds[1], { from: tokenOwner }),
]);
});
beforeEach(async () => {
@@ -218,27 +218,27 @@ describe('Exchange', () => {
takerAssetAmount: new BigNumber(3),
});
- const takerAssetFilledAmountBefore = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
- const fillTakerTokenAmount1 = new BigNumber(2);
+ const fillTakerAssetAmount1 = new BigNumber(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: fillTakerTokenAmount1,
+ takerAssetFillAmount: fillTakerAssetAmount1,
});
- const takerAssetFilledAmountAfter1 = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountAfter1 = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
- expect(takerAssetFilledAmountAfter1).to.be.bignumber.equal(fillTakerTokenAmount1);
+ expect(takerAssetFilledAmountAfter1).to.be.bignumber.equal(fillTakerAssetAmount1);
- const fillTakerTokenAmount2 = new BigNumber(1);
+ const fillTakerAssetAmount2 = new BigNumber(1);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: fillTakerTokenAmount2,
+ takerAssetFillAmount: fillTakerAssetAmount2,
});
- const takerAssetFilledAmountAfter2 = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountAfter2 = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountAfter2).to.be.bignumber.equal(takerAssetFilledAmountAfter1);
@@ -250,7 +250,7 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
});
- const takerAssetFilledAmountBefore = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
@@ -258,7 +258,7 @@ describe('Exchange', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmountAsync(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
@@ -274,20 +274,20 @@ describe('Exchange', () => {
const takerFeePaid = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -303,7 +303,7 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
});
- const takerAssetFilledAmountBefore = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
@@ -311,7 +311,7 @@ describe('Exchange', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmountAsync(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
@@ -327,20 +327,20 @@ describe('Exchange', () => {
const takerFeePaid = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -356,7 +356,7 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerAssetFilledAmountBefore = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
@@ -364,7 +364,7 @@ describe('Exchange', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmountAsync(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(makerAmountBoughtAfter).to.be.bignumber.equal(takerAssetFillAmount);
@@ -380,20 +380,20 @@ describe('Exchange', () => {
const takerFeePaid = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -410,7 +410,7 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
});
- const takerAssetFilledAmountBefore = await exWrapper.getTakerTokenFilledAmountAsync(
+ const takerAssetFilledAmountBefore = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
expect(takerAssetFilledAmountBefore).to.be.bignumber.equal(0);
@@ -418,7 +418,7 @@ describe('Exchange', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const makerAmountBoughtAfter = await exWrapper.getTakerTokenFilledAmountAsync(
+ const makerAmountBoughtAfter = await exWrapper.getTakerAssetFilledAmountAsync(
orderUtils.getOrderHashHex(signedOrder),
);
const expectedMakerAmountBoughtAfter = takerAssetFillAmount.add(takerAssetFilledAmountBefore);
@@ -435,20 +435,20 @@ describe('Exchange', () => {
const takerFeePaid = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFeePaid),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFeePaid),
@@ -471,20 +471,20 @@ describe('Exchange', () => {
);
const newBalances = await dmyBalances.getAsync();
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerAssetAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(signedOrder.takerAssetAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(signedOrder.takerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(signedOrder.takerAssetAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(signedOrder.takerAssetAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerAssetAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(signedOrder.takerFee),
@@ -503,8 +503,8 @@ describe('Exchange', () => {
const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>;
const logArgs = log.args;
- const expectedFilledMakerTokenAmount = signedOrder.makerAssetAmount.div(divisor);
- const expectedFilledTakerTokenAmount = signedOrder.takerAssetAmount.div(divisor);
+ const expectedFilledMakerAssetAmount = signedOrder.makerAssetAmount.div(divisor);
+ const expectedFilledTakerAssetAmount = signedOrder.takerAssetAmount.div(divisor);
const expectedFeeMPaid = signedOrder.makerFee.div(divisor);
const expectedFeeTPaid = signedOrder.takerFee.div(divisor);
@@ -513,8 +513,8 @@ describe('Exchange', () => {
expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
- expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
- expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
+ expect(expectedFilledMakerAssetAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
+ expect(expectedFilledTakerAssetAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid);
expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid);
expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
@@ -532,8 +532,8 @@ describe('Exchange', () => {
const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>;
const logArgs = log.args;
- const expectedFilledMakerTokenAmount = signedOrder.makerAssetAmount.div(divisor);
- const expectedFilledTakerTokenAmount = signedOrder.takerAssetAmount.div(divisor);
+ const expectedFilledMakerAssetAmount = signedOrder.makerAssetAmount.div(divisor);
+ const expectedFilledTakerAssetAmount = signedOrder.takerAssetAmount.div(divisor);
const expectedFeeMPaid = new BigNumber(0);
const expectedFeeTPaid = new BigNumber(0);
@@ -542,8 +542,8 @@ describe('Exchange', () => {
expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
- expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
- expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
+ expect(expectedFilledMakerAssetAmount).to.be.bignumber.equal(logArgs.makerAssetFilledAmount);
+ expect(expectedFilledTakerAssetAmount).to.be.bignumber.equal(logArgs.takerAssetFilledAmount);
expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid);
expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid);
expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
@@ -793,24 +793,24 @@ describe('Exchange', () => {
await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress);
const newBalances = await dmyBalances.getAsync();
- const fillMakerTokenAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
- const fillTakerTokenAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
+ const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
+ const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee);
const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(fillMakerTokenAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(fillMakerAssetAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(fillTakerTokenAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(fillTakerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(fillTakerTokenAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(fillTakerAssetAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(fillMakerTokenAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(fillMakerAssetAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -824,8 +824,8 @@ describe('Exchange', () => {
describe('Testing Exchange of ERC721 Tokens', () => {
it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
- const takerAssetId = erc721TakerTokenIds[1];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
@@ -833,24 +833,24 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify post-conditions
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
});
it('should throw when maker does not own the token with id makerAssetId', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721TakerTokenIds[0];
- const takerAssetId = erc721TakerTokenIds[1];
+ const makerAssetId = erc721TakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
@@ -858,10 +858,10 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.not.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.not.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
@@ -871,8 +871,8 @@ describe('Exchange', () => {
it('should throw when taker does not own the token with id takerAssetId', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
- const takerAssetId = erc721MakerTokenIds[1];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721MakerAssetIds[1];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
@@ -880,10 +880,10 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.not.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
@@ -893,8 +893,8 @@ describe('Exchange', () => {
it('should throw when makerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
- const takerAssetId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(2),
takerAssetAmount: new BigNumber(1),
@@ -902,10 +902,10 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
@@ -915,8 +915,8 @@ describe('Exchange', () => {
it('should throw when takerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
- const takerAssetId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(500),
@@ -924,10 +924,10 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
@@ -937,8 +937,8 @@ describe('Exchange', () => {
it('should throw on partial fill', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
- const takerAssetId = erc721TakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(0),
@@ -946,10 +946,10 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expect(
@@ -959,30 +959,30 @@ describe('Exchange', () => {
it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenIds[0];
+ const makerAssetId = erc721MakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
makerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
- takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerTokenAddress),
+ takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
// Call Exchange
balances = await dmyBalances.getAsync();
const takerAssetFillAmount = signedOrder.takerAssetAmount;
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify ERC721 token was transferred from Maker to Taker
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).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][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
@@ -997,30 +997,30 @@ describe('Exchange', () => {
it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => {
// Construct Exchange parameters
- const takerAssetId = erc721TakerTokenIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: new BigNumber(1),
makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
- makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerTokenAddress),
+ makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
});
// Verify pre-conditions
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
balances = await dmyBalances.getAsync();
const takerAssetFillAmount = signedOrder.takerAssetAmount;
await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify ERC721 token was transferred from Taker to Maker
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).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][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(signedOrder.makerAssetAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(signedOrder.makerAssetAmount),
);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(signedOrder.makerAssetAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(signedOrder.makerAssetAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(signedOrder.makerFee),
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 9c16697bc..0842ca65d 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -52,11 +52,11 @@ describe('Exchange', () => {
let dmyBalances: Balances;
let orderFactory: OrderFactory;
- const erc721MakerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
- const erc721TakerTokenId = new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030');
+ const erc721MakerAssetId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
+ const erc721TakerAssetId = new BigNumber('0x3030303030303030303030303030303030303030303030303030303030303030');
- let defaultMakerTokenAddress: string;
- let defaultTakerTokenAddress: string;
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
@@ -119,8 +119,8 @@ describe('Exchange', () => {
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
exWrapper = new ExchangeWrapper(exchange, zeroEx);
- defaultMakerTokenAddress = rep.address;
- defaultTakerTokenAddress = dgd.address;
+ defaultMakerAssetAddress = rep.address;
+ defaultTakerAssetAddress = dgd.address;
const defaultOrderParams = {
exchangeAddress: exchange.address,
makerAddress,
@@ -129,8 +129,8 @@ describe('Exchange', () => {
takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerTokenAddress),
- takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerTokenAddress),
+ makerAssetData: proxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
+ takerAssetData: proxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
};
const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
@@ -155,8 +155,8 @@ describe('Exchange', () => {
erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, true, {
from: takerAddress,
}),
- erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerTokenId, { from: tokenOwner }),
- erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerTokenId, { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(makerAddress, erc721MakerAssetId, { from: tokenOwner }),
+ erc721Token.mint.sendTransactionAsync(takerAddress, erc721TakerAssetId, { from: tokenOwner }),
]);
});
beforeEach(async () => {
@@ -188,20 +188,20 @@ describe('Exchange', () => {
const takerFee = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -256,20 +256,20 @@ describe('Exchange', () => {
const takerFee = signedOrder.takerFee
.times(makerAssetFilledAmount)
.dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -377,8 +377,8 @@ describe('Exchange', () => {
it('should successfully exchange ERC721 tokens', async () => {
// Construct Exchange parameters
- const makerAssetId = erc721MakerTokenId;
- const takerAssetId = erc721TakerTokenId;
+ const makerAssetId = erc721MakerAssetId;
+ const takerAssetId = erc721TakerAssetId;
const signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
takerAssetAmount: new BigNumber(1),
@@ -386,18 +386,18 @@ describe('Exchange', () => {
takerAssetData: proxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
});
// Verify pre-conditions
- const initialOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerToken).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerToken).to.be.bignumber.equal(takerAddress);
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
// Call Exchange
const takerAssetFillAmount = signedOrder.takerAssetAmount;
await exWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, { takerAssetFillAmount });
// Verify post-conditions
- const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
- const newOwnerTakerToken = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(newOwnerTakerToken).to.be.bignumber.equal(makerAddress);
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
});
});
@@ -630,20 +630,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][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -656,20 +656,20 @@ describe('Exchange', () => {
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
].minus(signedOrder.makerAssetAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
].add(signedOrder.makerAssetAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
@@ -717,20 +717,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][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFilledAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFilledAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -743,20 +743,20 @@ describe('Exchange', () => {
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
].minus(signedOrder.makerAssetAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
].add(signedOrder.makerAssetAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
@@ -804,20 +804,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][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -830,20 +830,20 @@ describe('Exchange', () => {
it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
const makerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
].minus(signedOrder.makerAssetAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
].add(signedOrder.makerAssetAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,
@@ -891,20 +891,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][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][defaultTakerTokenAddress].add(makerAmountBought),
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
);
expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(
balances[makerAddress][zrx.address].minus(makerFee),
);
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultTakerTokenAddress].minus(makerAmountBought),
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(
balances[takerAddress][zrx.address].minus(takerFee),
@@ -917,20 +917,20 @@ describe('Exchange', () => {
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
- balances[makerAddress][defaultMakerTokenAddress] = balances[makerAddress][
- defaultMakerTokenAddress
+ balances[makerAddress][defaultMakerAssetAddress] = balances[makerAddress][
+ defaultMakerAssetAddress
].minus(signedOrder.makerAssetAmount);
- balances[makerAddress][defaultTakerTokenAddress] = balances[makerAddress][
- defaultTakerTokenAddress
+ balances[makerAddress][defaultTakerAssetAddress] = balances[makerAddress][
+ defaultTakerAssetAddress
].add(signedOrder.takerAssetAmount);
balances[makerAddress][zrx.address] = balances[makerAddress][zrx.address].minus(
signedOrder.makerFee,
);
- balances[takerAddress][defaultMakerTokenAddress] = balances[takerAddress][
- defaultMakerTokenAddress
+ balances[takerAddress][defaultMakerAssetAddress] = balances[takerAddress][
+ defaultMakerAssetAddress
].add(signedOrder.makerAssetAmount);
- balances[takerAddress][defaultTakerTokenAddress] = balances[takerAddress][
- defaultTakerTokenAddress
+ balances[takerAddress][defaultTakerAssetAddress] = balances[takerAddress][
+ defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
balances[takerAddress][zrx.address] = balances[takerAddress][zrx.address].minus(
signedOrder.takerFee,