aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-07-14 04:32:06 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-07-18 03:18:16 +0800
commitb6172c396563af179b7d89c8eab2982601d042cf (patch)
tree25a783438af7ad6cb7ac95c6d7ebf51b3e03f602 /packages/contracts/src
parent02ddfa07a70cd0ac6a3061eca6067ff296f4fa1d (diff)
downloaddexon-sol-tools-b6172c396563af179b7d89c8eab2982601d042cf.tar.gz
dexon-sol-tools-b6172c396563af179b7d89c8eab2982601d042cf.tar.zst
dexon-sol-tools-b6172c396563af179b7d89c8eab2982601d042cf.zip
Reorder checks in getOrderInfo
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol16
1 files changed, 9 insertions, 7 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 ec84b1e19..6f435892b 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
@@ -154,6 +154,9 @@ contract MixinExchangeCore is
// Compute the order hash
orderInfo.orderHash = getOrderHash(order);
+ // Fetch filled amount
+ orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];
+
// If order.makerAssetAmount is zero, we also reject the order.
// While the Exchange contract handles them correctly, they create
// edge cases in the supporting infrastructure because they have
@@ -172,6 +175,12 @@ contract MixinExchangeCore is
return orderInfo;
}
+ // Validate order availability
+ if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {
+ orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);
+ return orderInfo;
+ }
+
// Validate order expiration
// solhint-disable-next-line not-rely-on-time
if (block.timestamp >= order.expirationTimeSeconds) {
@@ -189,13 +198,6 @@ contract MixinExchangeCore is
return orderInfo;
}
- // Fetch filled amount and validate order availability
- orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];
- if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {
- orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);
- return orderInfo;
- }
-
// All other statuses are ruled out: order is Fillable
orderInfo.orderStatus = uint8(OrderStatus.FILLABLE);
return orderInfo;