aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-10 02:20:06 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-10 02:26:32 +0800
commitb9d8d2d5e3e7aa5f14ae2fd2019460890497bb7e (patch)
tree16c7a6bf3fc0ee332639023eebc5e6dcfd8b09ae /packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol
parentb60a74c8bc4de5c897cefc2fbf9a247d8422d560 (diff)
downloaddexon-sol-tools-b9d8d2d5e3e7aa5f14ae2fd2019460890497bb7e.tar.gz
dexon-sol-tools-b9d8d2d5e3e7aa5f14ae2fd2019460890497bb7e.tar.zst
dexon-sol-tools-b9d8d2d5e3e7aa5f14ae2fd2019460890497bb7e.zip
Make marketBuy functions revert if entire amount not filled
Diffstat (limited to 'packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol')
-rw-r--r--packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol16
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol b/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol
index f3aa483c5..4584bb840 100644
--- a/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol
+++ b/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol
@@ -139,7 +139,7 @@ contract MixinExchangeWrapper is
/// @param makerAssetFillAmount Desired amount of makerAsset to buy.
/// @param signatures Proofs that orders have been signed by makers.
/// @return Amounts filled and fees paid by makers and taker.
- function marketBuyWithWeth(
+ function marketBuyExactAmountWithWeth(
LibOrder.Order[] memory orders,
uint256 makerAssetFillAmount,
bytes[] memory signatures
@@ -180,10 +180,16 @@ contract MixinExchangeWrapper is
addFillResults(totalFillResults, singleFillResults);
// Stop execution if the entire amount of makerAsset has been bought
- if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {
+ uint256 makerAssetFilledAmount = totalFillResults.makerAssetFilledAmount;
+ if (makerAssetFilledAmount >= makerAssetFillAmount) {
break;
}
}
+
+ require(
+ makerAssetFilledAmount >= makerAssetFillAmount,
+ "COMPLETE_FILL_FAILED"
+ );
return totalFillResults;
}
@@ -196,7 +202,7 @@ contract MixinExchangeWrapper is
/// @param zrxBuyAmount Desired amount of ZRX to buy.
/// @param signatures Proofs that orders have been created by makers.
/// @return totalFillResults Amounts filled and fees paid by maker and taker.
- function marketBuyZrxWithWeth(
+ function marketBuyExactZrxWithWeth(
LibOrder.Order[] memory orders,
uint256 zrxBuyAmount,
bytes[] memory signatures
@@ -248,6 +254,10 @@ contract MixinExchangeWrapper is
}
}
+ require(
+ zrxPurchased >= zrxBuyAmount,
+ "COMPLETE_FILL_FAILED"
+ );
return totalFillResults;
}
}