aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-08-25 07:13:17 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-08-25 07:46:24 +0800
commite21599285941a092a6c6f2dbf58f14f467dcca85 (patch)
tree39af43f14d83cbcdf47e2dceb274f7996296e4a9 /packages/contracts/src
parente6f5cac87887709b5a3baaec059005301723f0a5 (diff)
downloaddexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar.gz
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar.bz2
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar.lz
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar.xz
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.tar.zst
dexon-sol-tools-e21599285941a092a6c6f2dbf58f14f467dcca85.zip
Fix mixin api
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol21
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol14
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol22
3 files changed, 36 insertions, 21 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
index 4fd71092c..dc62db448 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
@@ -95,7 +95,12 @@ contract MixinExchangeCore is
address takerAddress = getCurrentContextAddress();
// Assert that the order is fillable by taker
- assertFillableOrder(order, orderInfo, taker, signature);
+ assertFillableOrder(
+ order,
+ orderInfo,
+ takerAddress,
+ signature
+ );
// Get amount of takerAsset to fill
uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);
@@ -107,10 +112,10 @@ contract MixinExchangeCore is
// Validate context
assertValidFill(
order,
+ orderInfo,
takerAssetFillAmount,
takerAssetFilledAmount,
- fillResults.makerAssetFilledAmount,
- signature
+ fillResults.makerAssetFilledAmount
);
// Update exchange internal state
@@ -270,7 +275,7 @@ contract MixinExchangeCore is
function assertFillableOrder(
Order memory order,
OrderInfo memory orderInfo,
- address taker,
+ address takerAddress,
bytes memory signature
)
internal
@@ -319,16 +324,16 @@ contract MixinExchangeCore is
/// @dev Validates context for fillOrder. Succeeds or throws.
/// @param order to be filled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
/// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
- /// @param signature Proof that the orders was created by its maker.
function assertValidFill(
Order memory order,
- uint256 takerAssetFillAmount,
+ OrderInfo memory orderInfo,
+ uint256 takerAssetFillAmount, // TODO: use FillResults
uint256 takerAssetFilledAmount,
- uint256 makerAssetFilledAmount,
- bytes memory signature
+ uint256 makerAssetFilledAmount
)
internal
view
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
index 5a5b0376e..c860640c4 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
@@ -70,10 +70,10 @@ contract MixinMatchOrders is
leftSignature
);
assertFillableOrder(
- righttOrder,
- righttOrderInfo,
+ rightOrder,
+ rightOrderInfo,
takerAddress,
- leftSignature
+ rightSignature
);
assertValidMatch(leftOrder, rightOrder);
@@ -88,17 +88,17 @@ contract MixinMatchOrders is
// Validate fill contexts
assertValidFill(
leftOrder,
+ leftOrderInfo,
matchedFillResults.left.takerAssetFilledAmount,
matchedFillResults.left.takerAssetFilledAmount,
- matchedFillResults.left.makerAssetFilledAmount,
- leftSignature
+ matchedFillResults.left.makerAssetFilledAmount
);
assertValidFill(
rightOrder,
+ rightOrderInfo,
matchedFillResults.right.takerAssetFilledAmount,
matchedFillResults.right.takerAssetFilledAmount,
- matchedFillResults.right.makerAssetFilledAmount,
- rightSignature
+ matchedFillResults.right.makerAssetFilledAmount
);
// Update exchange state
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol
index eccb6a29d..708cb329e 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol
@@ -83,23 +83,33 @@ contract MExchangeCore is
bytes32 orderHash
)
internal;
-
+
/// @dev Validates context for fillOrder. Succeeds or throws.
/// @param order to be filled.
- /// @param orderInfo Status, orderHash, and amount already filled of order.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
/// @param takerAddress Address of order taker.
+ /// @param signature Proof that the orders was created by its maker.
+ function assertFillableOrder(
+ LibOrder.Order memory order,
+ LibOrder.OrderInfo memory orderInfo,
+ address takerAddress,
+ bytes memory signature
+ )
+ internal
+ view;
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderInfo Status, orderHash, and amount already filled of order.
/// @param takerAssetFillAmount Desired amount of order to fill by taker.
/// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
/// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
- /// @param signature Proof that the orders was created by its maker.
function assertValidFill(
LibOrder.Order memory order,
LibOrder.OrderInfo memory orderInfo,
- address takerAddress,
uint256 takerAssetFillAmount,
uint256 takerAssetFilledAmount,
- uint256 makerAssetFilledAmount,
- bytes memory signature
+ uint256 makerAssetFilledAmount
)
internal
view;