Updated the DivisionByZeroError to not use assembly
This commit is contained in:
		
				
					committed by
					
						
						Amir Bandeali
					
				
			
			
				
	
			
			
			
						parent
						
							a2b19a1b9d
						
					
				
				
					commit
					a1a6c3e40c
				
			@@ -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(
 | 
			
		||||
 
 | 
			
		||||
@@ -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)"))
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user