Updated the DivisionByZeroError to not use assembly

This commit is contained in:
James Towle
2019-06-21 12:39:49 -05:00
committed by Amir Bandeali
parent a2b19a1b9d
commit a1a6c3e40c
3 changed files with 7 additions and 7 deletions

View File

@@ -14,11 +14,7 @@ contract MixinLibMathRichErrors is
pure
returns (bytes memory)
{
bytes4 divisionError = DIVISION_BY_ZERO_SELECTOR;
assembly {
mstore(0, divisionError)
revert(0, 4)
}
return DIVISION_BY_ZERO_ERROR;
}
function RoundingError(

View File

@@ -4,7 +4,11 @@ pragma solidity ^0.5.9;
contract IMixinLibMathRichErrors {
// bytes4(keccak256("DivisionByZeroError()"))
bytes4 internal constant DIVISION_BY_ZERO_SELECTOR =
bytes internal constant DIVISION_BY_ZERO_ERROR =
hex"a791837c";
// bytes4(keccak256("DivisionByZeroError()"))
bytes4 internal constant DIVISION_BY_ZERO_ERROR_SELECTOR =
0xa791837c;
// bytes4(keccak256("RoundingError(uint256,uint256,uint256)"))

View File

@@ -446,7 +446,7 @@ describe('Exchange core internal functions', () => {
const totalFilledAmount = takerAssetFilledAmount.plus(orderTakerAssetFilledAmount);
if (totalFilledAmount.isGreaterThan(MAX_UINT256)) {
// FIXME throw safeMathErrorForSendTransaction(takerAssetFilledAmount, orderTakerAssetFilledAmount);
throw safeMathErrorForSendTransaction();
throw safeMathErrorForSendTransaction;
}
return totalFilledAmount;
}