aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol119
1 files changed, 119 insertions, 0 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
index 5b78e70da..eb97be8b0 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
@@ -17,6 +17,7 @@
*/
pragma solidity ^0.4.23;
+pragma experimental ABIEncoderV2;
import "../libs/LibOrder.sol";
import "../libs/LibFillResults.sol";
@@ -63,4 +64,122 @@ contract MExchangeCore is
bytes32 orderHash,
LibFillResults.FillResults memory fillResults)
internal;
+
+ /// @dev Gets information about an order.
+ /// @param order Order to gather information on.
+ /// @return status Status of order. Statuses are defined in the LibStatus.Status struct.
+ /// @return orderHash Keccak-256 EIP712 hash of the order.
+ /// @return takerAssetFilledAmount Amount of order that has been filled.
+ function getOrderInfo(LibOrder.Order memory order)
+ public
+ view
+ returns (
+ uint8 orderStatus,
+ bytes32 orderHash,
+ uint256 takerAssetFilledAmount);
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderStatus Status of order to be filled.
+ /// @param orderHash Hash of order to be filled.
+ /// @param takerAssetFilledAmount Amount of order already filled.
+ /// @param signature Proof that the orders was created by its maker.
+ /// @param takerAddress Address of order taker.
+ /// @param takerAssetFillAmount Desired amount of order to fill by taker.
+ function validateFillOrderContextOrRevert(
+ LibOrder.Order memory order,
+ uint8 orderStatus,
+ bytes32 orderHash,
+ uint256 takerAssetFilledAmount,
+ bytes memory signature,
+ address takerAddress,
+ uint256 takerAssetFillAmount)
+ internal;
+
+ /// @dev Calculates amounts filled and fees paid by maker and taker.
+ /// @param order to be filled.
+ /// @param orderStatus Status of order to be filled.
+ /// @param takerAssetFilledAmount Amount of order already filled.
+ /// @param takerAssetFillAmount Desired amount of order to fill by taker.
+ /// @return status Return status of calculating fill amounts. Returns Status.SUCCESS on success.
+ /// @return fillResults Amounts filled and fees paid by maker and taker.
+ function calculateFillResults(
+ LibOrder.Order memory order,
+ uint8 orderStatus,
+ uint256 takerAssetFilledAmount,
+ uint256 takerAssetFillAmount)
+ public
+ pure
+ returns (
+ uint8 status,
+ LibFillResults.FillResults memory fillResults);
+
+ /// @dev Updates state with results of a fill order.
+ /// @param order that was filled.
+ /// @param takerAddress Address of taker who filled the order.
+ /// @return fillResults Amounts filled and fees paid by maker and taker.
+ function updateFilledState(
+ LibOrder.Order memory order,
+ address takerAddress,
+ bytes32 orderHash,
+ LibFillResults.FillResults memory fillResults)
+ internal;
+
+ /// @dev Fills the input order.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerToken to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature)
+ public
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev Validates context for cancelOrder. Succeeds or throws.
+ /// @param order that was cancelled.
+ /// @param orderStatus Status of order that was cancelled.
+ /// @param orderHash Hash of order that was cancelled.
+ function validateCancelOrderContextOrRevert(
+ LibOrder.Order memory order,
+ uint8 orderStatus,
+ bytes32 orderHash)
+ internal;
+
+ /// @dev Updates state with results of cancelling an order.
+ /// State is only updated if the order is currently fillable.
+ /// Otherwise, updating state would have no effect.
+ /// @param order that was cancelled.
+ /// @param orderStatus Status of order that was cancelled.
+ /// @param orderHash Hash of order that was cancelled.
+ /// @return stateUpdated Returns true only if state was updated.
+ function updateCancelledState(
+ LibOrder.Order memory order,
+ uint8 orderStatus,
+ bytes32 orderHash)
+ internal
+ returns (bool stateUpdated);
+
+ /// @dev After calling, the order can not be filled anymore.
+ /// @param order Order struct containing order specifications.
+ /// @return True if the order state changed to cancelled.
+ /// False if the transaction was already cancelled or expired.
+ function cancelOrder(LibOrder.Order memory order)
+ public
+ returns (bool);
+
+ /// @param salt Orders created with a salt less or equal to this value will be cancelled.
+ function cancelOrdersUpTo(uint256 salt)
+ external;
+
+/*
+ /// @dev Checks if rounding error > 0.1%.
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to multiply with numerator/denominator.
+ /// @return Rounding error is present.
+ function isRoundingError(uint256 numerator, uint256 denominator, uint256 target)
+ public pure
+ returns (bool isError); */
}