function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {

        
        require(_erc20Addr.isContract());

        
        
        require((_value == 0) || (IERC20(_erc20Addr).allowance(address(this), _spender) == 0));

        (bool success, bytes memory returnValue) =
        
        _erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
        
        require(success);
        
        require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
    }