Add getOrdersInfo function

This commit is contained in:
Amir Bandeali 2018-07-10 20:55:28 -07:00
parent 5022878680
commit 02ddfa07a7
2 changed files with 24 additions and 0 deletions

View File

@ -529,4 +529,20 @@ contract MixinWrapperFunctions is
cancelOrder(orders[i]); cancelOrder(orders[i]);
} }
} }
/// @dev Fetches information for all passed in orders.
/// @param orders Array of order specifications.
/// @return Array of OrderInfo instances that correspond to each order.
function getOrdersInfo(LibOrder.Order[] memory orders)
public
view
returns (LibOrder.OrderInfo[] memory)
{
uint256 length = orders.length;
LibOrder.OrderInfo[] memory ordersInfo = new LibOrder.OrderInfo[](length);
for (uint256 i = 0; i < length; i++) {
ordersInfo[i] = getOrderInfo(orders[i]);
}
return ordersInfo;
}
} }

View File

@ -149,4 +149,12 @@ contract IWrapperFunctions {
/// @param orders Array of order specifications. /// @param orders Array of order specifications.
function batchCancelOrders(LibOrder.Order[] memory orders) function batchCancelOrders(LibOrder.Order[] memory orders)
public; public;
/// @dev Fetches information for all passed in orders
/// @param orders Array of order specifications.
/// @return Array of OrderInfo instances that correspond to each order.
function getOrdersInfo(LibOrder.Order[] memory orders)
public
view
returns (LibOrder.OrderInfo[] memory);
} }