aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-05-17 07:57:02 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-05-19 08:01:06 +0800
commit636dae6a797ecdbdea186c1590ee35eec4521f41 (patch)
tree5fe9e188dad0c2aae34cdaf253b94f08aa7476c4
parentc8f65a1bf9c664b21ee21b08a3a91881d7f3dce1 (diff)
downloaddexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar.gz
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar.bz2
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar.lz
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar.xz
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.tar.zst
dexon-sol-tools-636dae6a797ecdbdea186c1590ee35eec4521f41.zip
The OrderInfo struct is now returned by the getOrderInfo function
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol76
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol16
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol11
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol9
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MMatchOrders.sol8
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts8
-rw-r--r--packages/contracts/src/utils/types.ts6
-rw-r--r--packages/contracts/test/exchange/match_orders.ts105
8 files changed, 98 insertions, 141 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
index 9d455246d..7e9c4f8fa 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
@@ -81,10 +81,7 @@ contract MixinExchangeCore is
returns (FillResults memory fillResults)
{
// Fetch order info
- bytes32 orderHash;
- uint8 orderStatus;
- uint256 orderFilledAmount;
- (orderStatus, orderHash, orderFilledAmount) = getOrderInfo(order);
+ OrderInfo memory orderInfo = getOrderInfo(order);
// Fetch taker address
address takerAddress = getCurrentContextAddress();
@@ -92,10 +89,10 @@ contract MixinExchangeCore is
// Either our context is valid or we revert
assertValidFill(
order,
- orderStatus,
- orderHash,
+ orderInfo.orderStatus,
+ orderInfo.orderHash,
takerAddress,
- orderFilledAmount,
+ orderInfo.orderFilledAmount,
takerAssetFillAmount,
signature
);
@@ -104,12 +101,12 @@ contract MixinExchangeCore is
uint8 status;
(status, fillResults) = calculateFillResults(
order,
- orderStatus,
- orderFilledAmount,
+ orderInfo.orderStatus,
+ orderInfo.orderFilledAmount,
takerAssetFillAmount
);
if (status != uint8(Status.SUCCESS)) {
- emit ExchangeStatus(uint8(status), orderHash);
+ emit ExchangeStatus(uint8(status), orderInfo.orderHash);
return fillResults;
}
@@ -120,8 +117,8 @@ contract MixinExchangeCore is
updateFilledState(
order,
takerAddress,
- orderHash,
- orderFilledAmount,
+ orderInfo.orderHash,
+ orderInfo.orderFilledAmount,
fillResults
);
return fillResults;
@@ -138,15 +135,13 @@ contract MixinExchangeCore is
returns (bool)
{
// Fetch current order status
- bytes32 orderHash;
- uint8 orderStatus;
- (orderStatus, orderHash, ) = getOrderInfo(order);
+ OrderInfo memory orderInfo = getOrderInfo(order);
// Validate context
- assertValidCancel(order, orderStatus, orderHash);
+ assertValidCancel(order, orderInfo.orderStatus, orderInfo.orderHash);
// Perform cancel
- return updateCancelledState(order, orderStatus, orderHash);
+ return updateCancelledState(order, orderInfo.orderStatus, orderInfo.orderHash);
}
/// @dev Validates context for fillOrder. Succeeds or throws.
@@ -393,28 +388,23 @@ contract MixinExchangeCore is
/// @dev Gets information about an order: status, hash, and amount filled.
/// @param order Order to gather information on.
- /// @return status Status of order. See LibStatus for a complete description of order statuses.
- /// @return orderHash Keccak-256 EIP712 hash of the order.
- /// @return orderFilledAmount Amount of order that has been filled.
+ /// @return OrderInfo Information about the order and its state.
+ /// See LibOrder.OrderInfo for a complete description.
function getOrderInfo(Order memory order)
public
view
- returns (
- uint8 orderStatus,
- bytes32 orderHash,
- uint256 orderFilledAmount
- )
+ returns (LibOrder.OrderInfo memory orderInfo)
{
// Compute the order hash
- orderHash = getOrderHash(order);
+ orderInfo.orderHash = getOrderHash(order);
// If order.makerAssetAmount is zero, we also reject the order.
// While the Exchange contract handles them correctly, they create
// edge cases in the supporting infrastructure because they have
// an 'infinite' price when computed by a simple division.
if (order.makerAssetAmount == 0) {
- orderStatus = uint8(Status.ORDER_INVALID_MAKER_ASSET_AMOUNT);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderStatus = uint8(Status.ORDER_INVALID_MAKER_ASSET_AMOUNT);
+ return orderInfo;
}
// If order.takerAssetAmount is zero, then the order will always
@@ -422,35 +412,35 @@ contract MixinExchangeCore is
// Instead of distinguishing between unfilled and filled zero taker
// amount orders, we choose not to support them.
if (order.takerAssetAmount == 0) {
- orderStatus = uint8(Status.ORDER_INVALID_TAKER_ASSET_AMOUNT);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderStatus = uint8(Status.ORDER_INVALID_TAKER_ASSET_AMOUNT);
+ return orderInfo;
}
// Validate order expiration
if (block.timestamp >= order.expirationTimeSeconds) {
- orderStatus = uint8(Status.ORDER_EXPIRED);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderStatus = uint8(Status.ORDER_EXPIRED);
+ return orderInfo;
}
// Check if order has been cancelled
- if (cancelled[orderHash]) {
- orderStatus = uint8(Status.ORDER_CANCELLED);
- return (orderStatus, orderHash, orderFilledAmount);
+ if (cancelled[orderInfo.orderHash]) {
+ orderInfo.orderStatus = uint8(Status.ORDER_CANCELLED);
+ return orderInfo;
}
if (makerEpoch[order.makerAddress] > order.salt) {
- orderStatus = uint8(Status.ORDER_CANCELLED);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderStatus = uint8(Status.ORDER_CANCELLED);
+ return orderInfo;
}
// Fetch filled amount and validate order availability
- orderFilledAmount = filled[orderHash];
- if (orderFilledAmount >= order.takerAssetAmount) {
- orderStatus = uint8(Status.ORDER_FULLY_FILLED);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderFilledAmount = filled[orderInfo.orderHash];
+ if (orderInfo.orderFilledAmount >= order.takerAssetAmount) {
+ orderInfo.orderStatus = uint8(Status.ORDER_FULLY_FILLED);
+ return orderInfo;
}
// All other statuses are ruled out: order is Fillable
- orderStatus = uint8(Status.ORDER_FILLABLE);
- return (orderStatus, orderHash, orderFilledAmount);
+ orderInfo.orderStatus = uint8(Status.ORDER_FILLABLE);
+ return orderInfo;
}
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
index 70b6b8ff8..d53653fbf 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinMatchOrders.sol
@@ -58,19 +58,9 @@ contract MixinMatchOrders is
public
returns (MatchedFillResults memory matchedFillResults)
{
- // Get left status
- OrderInfo memory leftOrderInfo;
- ( leftOrderInfo.orderStatus,
- leftOrderInfo.orderHash,
- leftOrderInfo.orderFilledAmount
- ) = getOrderInfo(leftOrder);
-
- // Get right status
- OrderInfo memory rightOrderInfo;
- ( rightOrderInfo.orderStatus,
- rightOrderInfo.orderHash,
- rightOrderInfo.orderFilledAmount
- ) = getOrderInfo(rightOrder);
+ // Get left & right order info
+ OrderInfo memory leftOrderInfo = getOrderInfo(leftOrder);
+ OrderInfo memory rightOrderInfo = getOrderInfo(rightOrder);
// Fetch taker address
address takerAddress = getCurrentContextAddress();
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
index 2ee957faa..958a89c39 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IExchangeCore.sol
@@ -51,15 +51,10 @@ contract IExchangeCore {
/// @dev Gets information about an order: status, hash, and amount filled.
/// @param order Order to gather information on.
- /// @return status Status of order. See LibStatus for a complete description of order statuses.
- /// @return orderHash Keccak-256 EIP712 hash of the order.
- /// @return orderFilledAmount Amount of order that has been filled.
+ /// @return OrderInfo Information about the order and its state.
+ /// See LibOrder.OrderInfo for a complete description.
function getOrderInfo(LibOrder.Order memory order)
public
view
- returns (
- uint8 orderStatus,
- bytes32 orderHash,
- uint256 orderFilledAmount
- );
+ returns (LibOrder.OrderInfo memory orderInfo);
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
index 0fe8c8c96..5f00b87f0 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/libs/LibOrder.sol
@@ -51,6 +51,15 @@ contract LibOrder {
bytes takerAssetData;
}
+ struct OrderInfo {
+ // See LibStatus for a complete description of order statuses
+ uint8 orderStatus;
+ // Keccak-256 EIP712 hash of the order
+ bytes32 orderHash;
+ // Amount of order that has been filled
+ uint256 orderFilledAmount;
+ }
+
/// @dev Calculates Keccak-256 hash of the order.
/// @param order The order structure.
/// @return Keccak-256 EIP712 hash of the order.
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MMatchOrders.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MMatchOrders.sol
index 7c9a481f1..d71f4e120 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MMatchOrders.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MMatchOrders.sol
@@ -27,14 +27,6 @@ contract MMatchOrders is
IMatchOrders
{
- /// This struct exists solely to avoid the stack limit constraint
- /// in matchOrders
- struct OrderInfo {
- uint8 orderStatus;
- bytes32 orderHash;
- uint256 orderFilledAmount;
- }
-
/// @dev Validates context for matchOrders. Succeeds or throws.
/// @param leftOrder First order to match.
/// @param rightOrder Second order to match.
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 5b026fce0..7032db386 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -9,7 +9,7 @@ import { constants } from './constants';
import { formatters } from './formatters';
import { LogDecoder } from './log_decoder';
import { orderUtils } from './order_utils';
-import { AssetProxyId, SignedOrder, SignedTransaction } from './types';
+import { AssetProxyId, OrderInfo, SignedOrder, SignedTransaction } from './types';
export class ExchangeWrapper {
private _exchange: ExchangeContract;
@@ -225,10 +225,8 @@ export class ExchangeWrapper {
const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
return filledAmount;
}
- public async getOrderInfoAsync(
- signedOrder: SignedOrder,
- ): Promise<[number /* orderStatus */, string /* orderHash */, BigNumber /* orderTakerAssetAmountFilled */]> {
- const orderInfo: [number, string, BigNumber] = await this._exchange.getOrderInfo.callAsync(signedOrder);
+ public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
+ const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
return orderInfo;
}
public async matchOrdersAsync(
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index 0e3b2c9a8..518776214 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -174,3 +174,9 @@ export interface TransferAmountsByMatchOrders {
feeReceivedLeft: BigNumber;
feeReceivedRight: BigNumber;
}
+
+export interface OrderInfo {
+ orderStatus: number;
+ orderHash: string;
+ orderFilledAmount: BigNumber;
+}
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index 74e4f6760..cc1486298 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -29,6 +29,7 @@ import {
ERC20BalancesByOwner,
ERC721TokenIdsByOwner,
ExchangeStatus,
+ OrderInfo,
SignedOrder,
} from '../../src/utils/types';
import { chaiSetup } from '../utils/chai_setup';
@@ -180,13 +181,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was fully filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
});
it('should transfer the correct amounts when orders completely fill each other and taker doesnt take a profit', async () => {
@@ -224,13 +223,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was fully filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify taker did not take a profit
expect(takerInitialBalances).to.be.deep.equal(
newERC20BalancesByOwner[takerAddress][defaultERC20MakerAssetAddress],
@@ -265,13 +262,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was fully filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was partially filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
});
it('should transfer the correct amounts when right order is completely filled and left order is partially filled', async () => {
@@ -302,13 +297,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was partially filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
});
it('should transfer the correct amounts when consecutive calls are used to completely fill the left order', async () => {
@@ -344,13 +337,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was partially filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Construct second right order
// Note: This order needs makerAssetAmount=90/takerAssetAmount=[anything <= 45] to fully fill the right order.
// However, we use 100/50 to ensure a partial fill as we want to go down the "left fill"
@@ -377,15 +368,11 @@ describe('matchOrders', () => {
rightTakerAssetFilledAmount,
);
// Verify left order was fully filled
- const leftOrderInfo2: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderLeft,
- );
- expect(leftOrderInfo2[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo2: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo2.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify second right order was partially filled
- const rightOrderInfo2: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight2,
- );
- expect(rightOrderInfo2[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const rightOrderInfo2: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight2);
+ expect(rightOrderInfo2.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
});
it('should transfer the correct amounts when consecutive calls are used to completely fill the right order', async () => {
@@ -422,13 +409,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was partially filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
// Create second left order
// Note: This order needs makerAssetAmount=96/takerAssetAmount=48 to fully fill the right order.
// However, we use 100/50 to ensure a partial fill as we want to go down the "right fill"
@@ -458,15 +443,11 @@ describe('matchOrders', () => {
rightTakerAssetFilledAmount,
);
// Verify second left order was partially filled
- const leftOrderInfo2: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderLeft2,
- );
- expect(leftOrderInfo2[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
+ const leftOrderInfo2: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft2);
+ expect(leftOrderInfo2.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FILLABLE);
// Verify right order was fully filled
- const rightOrderInfo2: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo2[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo2: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo2.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
});
it('should transfer the correct amounts if fee recipient is the same across both matched orders', async () => {
@@ -821,13 +802,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was fully filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
});
it('should transfer correct amounts when right order maker asset is an ERC721 token', async () => {
@@ -859,13 +838,11 @@ describe('matchOrders', () => {
erc721TokenIdsByOwner,
);
// Verify left order was fully filled
- const leftOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- expect(leftOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const leftOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ expect(leftOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
// Verify right order was fully filled
- const rightOrderInfo: [number, string, BigNumber] = await exchangeWrapper.getOrderInfoAsync(
- signedOrderRight,
- );
- expect(rightOrderInfo[0] as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
+ const rightOrderInfo: OrderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ expect(rightOrderInfo.orderStatus as ExchangeStatus).to.be.equal(ExchangeStatus.ORDER_FULLY_FILLED);
});
});
}); // tslint:disable-line:max-file-line-count