From 02ddfa07a70cd0ac6a3061eca6067ff296f4fa1d Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 10 Jul 2018 20:55:28 -0700 Subject: Add getOrdersInfo function --- .../2.0.0/protocol/Exchange/MixinWrapperFunctions.sol | 16 ++++++++++++++++ .../protocol/Exchange/interfaces/IWrapperFunctions.sol | 8 ++++++++ 2 files changed, 24 insertions(+) (limited to 'packages/contracts/src') diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol index a16d2f897..d420f7e85 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol @@ -529,4 +529,20 @@ contract MixinWrapperFunctions is 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; + } } diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol index ad7a56a06..56a533646 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol @@ -149,4 +149,12 @@ contract IWrapperFunctions { /// @param orders Array of order specifications. function batchCancelOrders(LibOrder.Order[] memory orders) 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); } -- cgit