From 09a2c982da74b347f2eb441f1f5cf593acb7ac88 Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Mon, 11 Mar 2019 15:24:21 +0800 Subject: Add orderbook contract interface --- .../contracts/src/interfaces/IOrderbook.sol | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/contracts/exchange/contracts/src/interfaces/IOrderbook.sol b/contracts/exchange/contracts/src/interfaces/IOrderbook.sol index f42517087..74179d8aa 100644 --- a/contracts/exchange/contracts/src/interfaces/IOrderbook.sol +++ b/contracts/exchange/contracts/src/interfaces/IOrderbook.sol @@ -16,7 +16,44 @@ */ pragma solidity ^0.4.24; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol"; +import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol"; contract IOrderbook { + + /// @dev Place a limit order into orderbook. + /// @param order Order struct containing order specifications. + /// @return Amounts filled and fees paid by maker and taker. + function placeLimitOrder( + LibOrder.Order memory order + ) + public + returns (LibFillResults.FillResults memory fillResults); + + /// @dev Fill orders in orderbook that match desired specifications. + /// But unlike 'placeLimitOrder', remaining amount will not be put into orderbook. + /// @param order Order struct containing order specifications. + /// @return Amounts filled and fees paid by maker and taker. + function placeMarketOrder( + LibOrder.Order memory order + ) + public + returns (LibFillResults.FillResults memory fillResults); + + /// @dev Get a list of valid orders on orderbook of a specific pair. + /// @param makerAssetData Maker asset data of the pair. + /// @param takerAssetData Taker asset data of the pair. + /// @param limit Maximum number of orders to be returned. + /// @return Orders of the pair, sorted by price. + function getOrders( + bytes makerAssetData, + bytes takerAssetData, + uint8 limit + ) + public + view + returns (LibOrder.Order[] memory orders); } -- cgit