diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-04-10 01:44:39 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 84d836f22b4bc5410c5d96137eff261b698b622e (patch) | |
tree | 8555f8d4ec64a57c495fea44f403c3fac77ef0bd /packages/contracts/src | |
parent | 5d05a2da7416d37da81d004d489c69d7326d9cce (diff) | |
download | dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar.gz dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar.bz2 dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar.lz dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar.xz dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.tar.zst dexon-0x-contracts-84d836f22b4bc5410c5d96137eff261b698b622e.zip |
Add back require statements and tests (will move to another PR)
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol index e93b7a3eb..000977cf6 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol @@ -109,6 +109,8 @@ contract MixinExchangeCore is // Validate order and maker only if first time seen // TODO: Read filled and cancelled only once if (filled[orderHash] == 0) { + require(order.makerTokenAmount > 0); + require(order.takerTokenAmount > 0); require(isValidSignature(orderHash, order.makerAddress, signature)); } @@ -116,6 +118,7 @@ contract MixinExchangeCore is if (order.takerAddress != address(0)) { require(order.takerAddress == msg.sender); } + require(takerTokenFillAmount > 0); // Validate order expiration if (block.timestamp >= order.expirationTimeSeconds) { @@ -124,14 +127,14 @@ contract MixinExchangeCore is } // Validate order availability - uint256 remainingMakerBuyAmount = safeSub(order.takerTokenAmount, filled[orderHash]); - if (remainingMakerBuyAmount == 0) { + uint256 remainingTakerTokenFillAmount = safeSub(order.takerTokenAmount, filled[orderHash]); + if (remainingTakerTokenFillAmount == 0) { emit ExchangeError(uint8(Errors.ORDER_FULLY_FILLED), orderHash); return fillResults; } // Validate fill order rounding - fillResults.takerTokenFilledAmount = min256(takerTokenFillAmount, remainingMakerBuyAmount); + fillResults.takerTokenFilledAmount = min256(takerTokenFillAmount, remainingTakerTokenFillAmount); if (isRoundingError(fillResults.takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount)) { emit ExchangeError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), orderHash); fillResults.takerTokenFilledAmount = 0; @@ -173,6 +176,8 @@ contract MixinExchangeCore is bytes32 orderHash = getOrderHash(order); // Validate the order + require(order.makerTokenAmount > 0); + require(order.takerTokenAmount > 0); require(order.makerAddress == msg.sender); if (block.timestamp >= order.expirationTimeSeconds) { |