diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-07-23 12:16:35 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-07-23 23:02:51 +0800 |
commit | e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a (patch) | |
tree | 2f658bbb54abfa22e1d32fe7ffabeab2b5c577fe /packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol | |
parent | dcc0908617b83de8f45af3e9ca6854b897be3d72 (diff) | |
download | dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar.gz dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar.bz2 dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar.lz dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar.xz dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.tar.zst dexon-sol-tools-e5e68de2d7bf8bfc319200b8dc9f27cf8a081b4a.zip |
Use != instead of > in loops, add sanity checks to market fill functions
Diffstat (limited to 'packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol')
-rw-r--r-- | packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol b/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol index e230767b7..e150791da 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinExchangeWrapper.sol @@ -104,7 +104,7 @@ contract MixinExchangeWrapper is bytes memory wethAssetData = WETH_ASSET_DATA; uint256 ordersLength = orders.length; - for (uint256 i = 0; i < ordersLength; i++) { + for (uint256 i = 0; i != ordersLength; i++) { // We assume that asset being bought by taker is the same for each order. // We assume that asset being sold by taker is WETH for each order. @@ -125,7 +125,7 @@ contract MixinExchangeWrapper is addFillResults(totalFillResults, singleFillResults); // Stop execution if the entire amount of takerAsset has been sold - if (totalFillResults.takerAssetFilledAmount == wethSellAmount) { + if (totalFillResults.takerAssetFilledAmount >= wethSellAmount) { break; } } @@ -151,7 +151,7 @@ contract MixinExchangeWrapper is bytes memory wethAssetData = WETH_ASSET_DATA; uint256 ordersLength = orders.length; - for (uint256 i = 0; i < ordersLength; i++) { + for (uint256 i = 0; i != ordersLength; i++) { // We assume that asset being bought by taker is the same for each order. // We assume that asset being sold by taker is WETH for each order. @@ -180,7 +180,7 @@ contract MixinExchangeWrapper is addFillResults(totalFillResults, singleFillResults); // Stop execution if the entire amount of makerAsset has been bought - if (totalFillResults.makerAssetFilledAmount == makerAssetFillAmount) { + if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) { break; } } @@ -214,7 +214,7 @@ contract MixinExchangeWrapper is uint256 zrxPurchased = 0; uint256 ordersLength = orders.length; - for (uint256 i = 0; i < ordersLength; i++) { + for (uint256 i = 0; i != ordersLength; i++) { // All of these are ZRX/WETH, so we can drop the respective assetData from calldata. orders[i].makerAssetData = zrxAssetData; |