Please Help! 'Overriding public state variable changes state mutability from "pure" to "view".'

umm suicide is looking like a viable option

I know this has something to do with constant and immutable identifiers??

  • i have tried various compiler versions

  • i have tried switching the immutable identifier with constant

TypeError: Overriding public state variable changes state mutability from "pure" to "view".
   --> /C/Users/rodne/sc20210716_01/contracts/NJP.sol:295:9:
    |
295 |         address public immutable override factory;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: Overridden function is here:
   --> /C/Users/rodne/sc20210716_01/contracts/NJP.sol:153:9:
    |
153 |         function factory() external pure returns (address);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Full Source:
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";

// import "@openzeppelin/contracts/utils/math/SafeMath.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "@openzeppelin/contracts/utils/Address.sol";

import "@openzeppelin/contracts/utils/Context.sol";

// import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";

// import "@uniswap/uniswap-v2-periphery-master/contracts/UniswapV2Router02.sol";

//----------------------------------------------------------------------------------------------------

//SAFEMATH LIBRARY

    pragma solidity >=0.8.0;

    library SafeMath {

    /**

     * @dev Returns the addition of two unsigned integers, with an overflow flag.

     *

     * _Available since v3.4._

     */

    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {

        unchecked {

            uint256 c = a + b;

            if (c < a) return (false, 0);

            return (true, c);

        }

    }

    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {

        unchecked {

            if (b > a) return (false, 0);

            return (true, a - b);

        }

    }

    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {

        unchecked {

            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the

            // benefit is lost if 'b' is also tested.

            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522

            if (a == 0) return (true, 0);

            uint256 c = a * b;

            if (c / a != b) return (false, 0);

            return (true, c);

        }

    }

  

    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {

        unchecked {

            if (b == 0) return (false, 0);

            return (true, a / b);

        }

    }

 

    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {

        unchecked {

            if (b == 0) return (false, 0);

            return (true, a % b);

        }

    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {

        return a + b;

    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {

        return a - b;

    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {

        return a * b;

    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {

        return a / b;

    }

 

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {

        return a % b;

    }

    function sub(

        uint256 a,

        uint256 b,

        string memory errorMessage

    ) internal pure returns (uint256) {

        unchecked {

            require(b <= a, errorMessage);

            return a - b;

        }

    }

    function div(

        uint256 a,

        uint256 b,

        string memory errorMessage

    ) internal pure returns (uint256) {

        unchecked {

            require(b > 0, errorMessage);

            return a / b;

        }

    }

    function mod(

        uint256 a,

        uint256 b,

        string memory errorMessage

    ) internal pure returns (uint256) {

        unchecked {

            require(b > 0, errorMessage);

            return a % b;

        }

    }

 }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//IUniswapV2Factory

    pragma solidity >=0.8.0;

    interface IUniswapV2Factory {

        event PairCreated(address indexed token0, address indexed token1, address pair, uint);

        function feeTo() external view returns (address);

        function feeToSetter() external view returns (address);

        function getPair(address tokenA, address tokenB) external view returns (address pair);

        function allPairs(uint) external view returns (address pair);

        function allPairsLength() external view returns (uint);

        function createPair(address tokenA, address tokenB) external returns (address pair);

        function setFeeTo(address) external;

        function setFeeToSetter(address) external;

    }

    //INTERFACE UNISWAPV2ROUTER 01

    interface IUniswapV2Router01 {

        function factory() external pure returns (address);

        function WETH() external pure returns (address);

        function addLiquidity(

            address tokenA,

            address tokenB,

            uint amountADesired,

            uint amountBDesired,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline

        ) external returns (uint amountA, uint amountB, uint liquidity);

        function addLiquidityETH(

            address token,

            uint amountTokenDesired,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) external payable returns (uint amountToken, uint amountETH, uint liquidity);

        function removeLiquidity(

            address tokenA,

            address tokenB,

            uint liquidity,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline

        ) external returns (uint amountA, uint amountB);

        function removeLiquidityETH(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) external returns (uint amountToken, uint amountETH);

        function removeLiquidityWithPermit(

            address tokenA,

            address tokenB,

            uint liquidity,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external returns (uint amountA, uint amountB);

        function removeLiquidityETHWithPermit(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external returns (uint amountToken, uint amountETH);

        function swapExactTokensForTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external returns (uint[] memory amounts);

        function swapTokensForExactTokens(

            uint amountOut,

            uint amountInMax,

            address[] calldata path,

            address to,

            uint deadline

        ) external returns (uint[] memory amounts);

        function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)

            external

            payable

            returns (uint[] memory amounts);

        function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)

            external

            returns (uint[] memory amounts);

        function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)

            external

            returns (uint[] memory amounts);

        function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)

            external

            payable

            returns (uint[] memory amounts);

        function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);

        function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);

        function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);

        function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);

        function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);

    }

    //INTERFACE UNISWAPV2ROUTER 02

    interface IUniswapV2Router02 is IUniswapV2Router01 {

        function removeLiquidityETHSupportingFeeOnTransferTokens(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) external returns (uint amountETH);

        function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external returns (uint amountETH);

        function swapExactTokensForTokensSupportingFeeOnTransferTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external;

        function swapExactETHForTokensSupportingFeeOnTransferTokens(

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external payable;

        function swapExactTokensForETHSupportingFeeOnTransferTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external;

    }

//UniswapV2Router02

    pragma solidity >=0.8.0;

    contract UniswapV2Router02 is IUniswapV2Router02 {

        // using uniSafeMath for uint;

        address public immutable override factory;

        address public immutable override WETH;

        modifier ensure(uint deadline) {

            require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED');

            _;

        }

        constructor(address _factory, address _WETH) public {

            factory = _factory;

            WETH = _WETH;

        }

        receive() external payable {

            assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract

        }

        // **** ADD LIQUIDITY ****

        function _addLiquidity(

            address tokenA,

            address tokenB,

            uint amountADesired,

            uint amountBDesired,

            uint amountAMin,

            uint amountBMin

        ) internal virtual returns (uint amountA, uint amountB) {

            // create the pair if it doesn't exist yet

            if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {

                IUniswapV2Factory(factory).createPair(tokenA, tokenB);

            }

            (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);

            if (reserveA == 0 && reserveB == 0) {

                (amountA, amountB) = (amountADesired, amountBDesired);

            } else {

                uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);

                if (amountBOptimal <= amountBDesired) {

                    require(amountBOptimal >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');

                    (amountA, amountB) = (amountADesired, amountBOptimal);

                } else {

                    uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);

                    assert(amountAOptimal <= amountADesired);

                    require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');

                    (amountA, amountB) = (amountAOptimal, amountBDesired);

                }

            }

        }

        function addLiquidity(

            address tokenA,

            address tokenB,

            uint amountADesired,

            uint amountBDesired,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline

        ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {

            (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);

            address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);

            TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);

            TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);

            liquidity = IUniswapV2Pair(pair).mint(to);

        }

        function addLiquidityETH(

            address token,

            uint amountTokenDesired,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {

            (amountToken, amountETH) = _addLiquidity(

                token,

                WETH,

                amountTokenDesired,

                msg.value,

                amountTokenMin,

                amountETHMin

            );

            address pair = UniswapV2Library.pairFor(factory, token, WETH);

            TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);

            IWETH(WETH).deposit{value: amountETH}();

            assert(IWETH(WETH).transfer(pair, amountETH));

            liquidity = IUniswapV2Pair(pair).mint(to);

            // refund dust eth, if any

            if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);

        }

        // **** REMOVE LIQUIDITY ****

        function removeLiquidity(

            address tokenA,

            address tokenB,

            uint liquidity,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline

        ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {

            address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);

            IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair

            (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to);

            (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);

            (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);

            require(amountA >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');

            require(amountB >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');

        }

        function removeLiquidityETH(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {

            (amountToken, amountETH) = removeLiquidity(

                token,

                WETH,

                liquidity,

                amountTokenMin,

                amountETHMin,

                address(this),

                deadline

            );

            TransferHelper.safeTransfer(token, to, amountToken);

            IWETH(WETH).withdraw(amountETH);

            TransferHelper.safeTransferETH(to, amountETH);

        }

        function removeLiquidityWithPermit(

            address tokenA,

            address tokenB,

            uint liquidity,

            uint amountAMin,

            uint amountBMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external virtual override returns (uint amountA, uint amountB) {

            address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);

            uint value = approveMax ? uint(-1) : liquidity;

            IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);

            (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);

        }

        function removeLiquidityETHWithPermit(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external virtual override returns (uint amountToken, uint amountETH) {

            address pair = UniswapV2Library.pairFor(factory, token, WETH);

            uint value = approveMax ? uint(-1) : liquidity;

            IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);

            (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);

        }

        // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****

        function removeLiquidityETHSupportingFeeOnTransferTokens(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline

        ) public virtual override ensure(deadline) returns (uint amountETH) {

            (, amountETH) = removeLiquidity(

                token,

                WETH,

                liquidity,

                amountTokenMin,

                amountETHMin,

                address(this),

                deadline

            );

            TransferHelper.safeTransfer(token, to, IERC20(token).balanceOf(address(this)));

            IWETH(WETH).withdraw(amountETH);

            TransferHelper.safeTransferETH(to, amountETH);

        }

        function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(

            address token,

            uint liquidity,

            uint amountTokenMin,

            uint amountETHMin,

            address to,

            uint deadline,

            bool approveMax, uint8 v, bytes32 r, bytes32 s

        ) external virtual override returns (uint amountETH) {

            address pair = UniswapV2Library.pairFor(factory, token, WETH);

            uint value = approveMax ? uint(-1) : liquidity;

            IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);

            amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(

                token, liquidity, amountTokenMin, amountETHMin, to, deadline

            );

        }

        // **** SWAP ****

        // requires the initial amount to have already been sent to the first pair

        function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {

            for (uint i; i < path.length - 1; i++) {

                (address input, address output) = (path[i], path[i + 1]);

                (address token0,) = UniswapV2Library.sortTokens(input, output);

                uint amountOut = amounts[i + 1];

                (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));

                address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;

                IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(

                    amount0Out, amount1Out, to, new bytes(0)

                );

            }

        }

        function swapExactTokensForTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external virtual override ensure(deadline) returns (uint[] memory amounts) {

            amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);

            require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]

            );

            _swap(amounts, path, to);

        }

        function swapTokensForExactTokens(

            uint amountOut,

            uint amountInMax,

            address[] calldata path,

            address to,

            uint deadline

        ) external virtual override ensure(deadline) returns (uint[] memory amounts) {

            amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);

            require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]

            );

            _swap(amounts, path, to);

        }

        function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)

            external

            virtual

            override

            payable

            ensure(deadline)

            returns (uint[] memory amounts)

        {

            require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');

            amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);

            require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

            IWETH(WETH).deposit{value: amounts[0]}();

            assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));

            _swap(amounts, path, to);

        }

        function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)

            external

            virtual

            override

            ensure(deadline)

            returns (uint[] memory amounts)

        {

            require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

            amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);

            require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]

            );

            _swap(amounts, path, address(this));

            IWETH(WETH).withdraw(amounts[amounts.length - 1]);

            TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);

        }

        function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)

            external

            virtual

            override

            ensure(deadline)

            returns (uint[] memory amounts)

        {

            require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

            amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);

            require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]

            );

            _swap(amounts, path, address(this));

            IWETH(WETH).withdraw(amounts[amounts.length - 1]);

            TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);

        }

        function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)

            external

            virtual

            override

            payable

            ensure(deadline)

            returns (uint[] memory amounts)

        {

            require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');

            amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);

            require(amounts[0] <= msg.value, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');

            IWETH(WETH).deposit{value: amounts[0]}();

            assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));

            _swap(amounts, path, to);

            // refund dust eth, if any

            if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);

        }

        // **** SWAP (supporting fee-on-transfer tokens) ****

        // requires the initial amount to have already been sent to the first pair

        function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {

            for (uint i; i < path.length - 1; i++) {

                (address input, address output) = (path[i], path[i + 1]);

                (address token0,) = UniswapV2Library.sortTokens(input, output);

                IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));

                uint amountInput;

                uint amountOutput;

                { // scope to avoid stack too deep errors

                (uint reserve0, uint reserve1,) = pair.getReserves();

                (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);

                amountInput = IERC20(input).balanceOf(address(pair)).sub(reserveInput);

                amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);

                }

                (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));

                address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;

                pair.swap(amount0Out, amount1Out, to, new bytes(0));

            }

        }

        function swapExactTokensForTokensSupportingFeeOnTransferTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        ) external virtual override ensure(deadline) {

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn

            );

            uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);

            _swapSupportingFeeOnTransferTokens(path, to);

            require(

                IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,

                'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'

            );

        }

        function swapExactETHForTokensSupportingFeeOnTransferTokens(

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        )

            external

            virtual

            override

            payable

            ensure(deadline)

        {

            require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');

            uint amountIn = msg.value;

            IWETH(WETH).deposit{value: amountIn}();

            assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn));

            uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to);

            _swapSupportingFeeOnTransferTokens(path, to);

            require(

                IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,

                'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'

            );

        }

        function swapExactTokensForETHSupportingFeeOnTransferTokens(

            uint amountIn,

            uint amountOutMin,

            address[] calldata path,

            address to,

            uint deadline

        )

            external

            virtual

            override

            ensure(deadline)

        {

            require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

            TransferHelper.safeTransferFrom(

                path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn

            );

            _swapSupportingFeeOnTransferTokens(path, address(this));

            uint amountOut = IERC20(WETH).balanceOf(address(this));

            require(amountOut >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

            IWETH(WETH).withdraw(amountOut);

            TransferHelper.safeTransferETH(to, amountOut);

        }

        // **** LIBRARY FUNCTIONS ****

        function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {

            return UniswapV2Library.quote(amountA, reserveA, reserveB);

        }

        function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)

            public

            pure

            virtual

            override

            returns (uint amountOut)

        {

            return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);

        }

        function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)

            public

            pure

            virtual

            override

            returns (uint amountIn)

        {

            return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);

        }

        function getAmountsOut(uint amountIn, address[] memory path)

            public

            view

            virtual

            override

            returns (uint[] memory amounts)

        {

            return UniswapV2Library.getAmountsOut(factory, amountIn, path);

        }

        function getAmountsIn(uint amountOut, address[] memory path)

            public

            view

            virtual

            override

            returns (uint[] memory amounts)

        {

            return UniswapV2Library.getAmountsIn(factory, amountOut, path);

        }

    }

//TRANSFER HELPER

    pragma solidity >=0.8.0;

    // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false

    library TransferHelper {

        function safeApprove(address token, address to, uint value) internal {

            // bytes4(keccak256(bytes('approve(address,uint256)')));

            (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));

            require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');

        }

        function safeTransfer(address token, address to, uint value) internal {

            // bytes4(keccak256(bytes('transfer(address,uint256)')));

            (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));

            require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');

        }

        function safeTransferFrom(address token, address from, address to, uint value) internal {

            // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));

            (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));

            require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');

        }

        function safeTransferETH(address to, uint value) internal {

            (bool success,) = to.call{value:value}(new bytes(0));

            require(success, 'TransferHelper: ETH_TRANSFER_FAILED');

        }

    }

//IUNISWAPV2PAIR 

    interface IUniswapV2Pair {

    event Approval(address indexed owner, address indexed spender, uint value);

    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);

    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);

    event Swap(

        address indexed sender,

        uint amount0In,

        uint amount1In,

        uint amount0Out,

        uint amount1Out,

        address indexed to

    );

    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function price0CumulativeLast() external view returns (uint);

    function price1CumulativeLast() external view returns (uint);

    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);

    function burn(address to) external returns (uint amount0, uint amount1);

    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;

    }   

//UNISWAP V2 LIBRARY 

    pragma solidity >=0.8.0;

    library UniswapV2Library {

    

    // using unisafemath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order

    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {

        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');

        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);

        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');

    }

    // calculates the CREATE2 address for a pair without making any external calls

    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {

        (address token0, address token1) = sortTokens(tokenA, tokenB);

        pair = address(uint(keccak256(abi.encodePacked(

                hex'ff',

                factory,

                keccak256(abi.encodePacked(token0, token1)),

                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash

            ))));

    }

    // fetches and sorts the reserves for a pair

    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {

        (address token0,) = sortTokens(tokenA, tokenB);

        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();

        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);

    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset

    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {

        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');

        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');

        amountB = amountA.mul(reserveB) / reserveA;

    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {

        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');

        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');

        uint amountInWithFee = amountIn.mul(997);

        uint numerator = amountInWithFee.mul(reserveOut);

        uint denominator = reserveIn.mul(1000).add(amountInWithFee);

        amountOut = numerator / denominator;

    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {

        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');

        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');

        uint numerator = reserveIn.mul(amountOut).mul(1000);

        uint denominator = reserveOut.sub(amountOut).mul(997);

        amountIn = (numerator / denominator).add(1);

    }

    // performs chained getAmountOut calculations on any number of pairs

    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {

        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');

        amounts = new uint[](path.length);

        amounts[0] = amountIn;

        for (uint i; i < path.length - 1; i++) {

            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);

            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);

        }

    }

    // performs chained getAmountIn calculations on any number of pairs

    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {

        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');

        amounts = new uint[](path.length);

        amounts[amounts.length - 1] = amountOut;

        for (uint i = path.length - 1; i > 0; i--) {

            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);

            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);

        }

    }

    }

//IWETH

    pragma solidity >=0.8.0;

    interface IWETH {

    function deposit() external payable;

    function transfer(address to, uint value) external returns (bool);

    function withdraw(uint) external;

    }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//NJP CONTRACT

    contract NJP is Context, IERC20, Ownable {

        using SafeMath for uint256;

        using Address for address;

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//GLOBAL MAPPINGS AND VARIABLES

    mapping (address => uint256) private _rOwned;

    mapping (address => uint256) private _tOwned;

    mapping (address => mapping (address => uint256)) private _allowances;

    mapping (address => bool) private _isExcludedFromFee;

    mapping (address => bool) private _isExcluded;

    address[] private _excluded;

    uint256 private constant MAX = ~uint256(0);

    uint256 private _tTotal = 1000000000 * 10**6 * 10**9;

    uint256 private _rTotal = (MAX - (MAX % _tTotal));

    uint256 private _tFeeTotal;

    string private _name = "NJP";

    string private _symbol = "NJP";

    uint8 private _decimals = 9;

    uint256 public _taxFee = 5;

    uint256 private _previousTaxFee = _taxFee;

    uint256 public _liquidityFee = 5;

    uint256 private _previousLiquidityFee = _liquidityFee;

    IUniswapV2Router02 public immutable uniswapV2Router;

    address public immutable uniswapV2Pair;

    bool inSwapAndLiquify;

    bool public swapAndLiquifyEnabled = true;

    uint256 public _maxTxAmount = 5000000 * 10**6 * 10**9;

    uint256 public numTokensSellToAddToLiquidity = 500000 * 10**6 * 10**9;

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//CONTRACT EVENTS

    event TaxFeeUpdated(uint256 taxFee);

    event LiquidityFeeUpdated(uint256 liquidityFee);

    event ExcludeFromRewardUpdated(address account);

    event IncludeInRewardUpdated(address account);

    event ExcludeFromFeeUpdated(address account);

    event IncludeInFeeUpdated(address account);

    event MaxTxAmountUpdated(uint _maxTxAmount);

    event SwapAndLiquifyEnabledUpdated(bool enabled);

    event NumTokensSellToAddToLiquidityUpdated(uint256 _numTokensSellToAddToLiquidity);

    event SwapAndLiquify(

        uint256 tokensSwapped,

        uint256 ethReceived,

        uint256 tokensIntoLiqudity

    );

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//TIME LOCK

    modifier lockTheSwap {

        inSwapAndLiquify = true;

        _;

        inSwapAndLiquify = false;

    }

    enum Lock {

      TAX_FEE,

      LIQUIDITY_FEE,

      EXCLUDE_FROM_REWARD,

      INCLUDE_IN_REWARD,

      EXCLUDE_FROM_FEE,

      INCLUDE_IN_FEE,

      MAX_TX,

      SWAP_AND_LIQUIFY_ENABLED,

      NUM_TOKENS_SELL_TO_ADD_TO_LIQUIDITY

    }

    uint256 private constant _TIMELOCK = 1 days;

    mapping(Lock => uint256) public timelocks;

    modifier unlocked(Lock _lock) {

      require(timelocks[_lock] != 0 && timelocks[_lock] <= block.timestamp, "Function is timelocked");

      _;

      timelocks[_lock] = 0;

    }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//CONSTRUCTOR

    constructor () {

            _rOwned[_msgSender()] = _rTotal;

            IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);

            // Create a uniswap pair for this new token

            uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())

                .createPair(address(this), _uniswapV2Router.WETH());

            // set the rest of the contract variables

            uniswapV2Router = _uniswapV2Router;

            //exclude owner and this contract from fee

            _isExcludedFromFee[owner()] = true;

            _isExcludedFromFee[address(this)] = true;

            emit Transfer(address(0), _msgSender(), _tTotal);

        }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//ERC20 STANDARDS

    function name() public view returns (string memory) {

        return _name;

    }

    function symbol() public view returns (string memory) {

        return _symbol;

    }

    function decimals() public view returns (uint8) {

        return _decimals;

    }

    function totalSupply() public view override returns (uint256) {

        return _tTotal;

    }

    function balanceOf(address account) public view override returns (uint256) {

        if (_isExcluded[account]) return _tOwned[account];

        return tokenFromReflection(_rOwned[account]);

    }

    function transfer(address recipient, uint256 amount) public override returns (bool) {

        _transfer(_msgSender(), recipient, amount);

        return true;

    }

    function allowance(address owner, address spender) public view override returns (uint256) {

        return _allowances[owner][spender];

    }

    function approve(address spender, uint256 amount) public override returns (bool) {

        _approve(_msgSender(), spender, amount);

        return true;

    }

    function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {

        _transfer(sender, recipient, amount);

        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));

        return true;

    }

    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {

        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));

        return true;

    }

    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {

        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));

        return true;

    }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//REWARD -- REFLECTIONS -- FEES -- TAXES

    function isExcludedFromReward(address account) public view returns (bool) {

            return _isExcluded[account];

        }

    function totalFees() public view returns (uint256) {

            return _tFeeTotal;

        }

    function deliver(uint256 tAmount) public {

            address sender = _msgSender();

            require(!_isExcluded[sender], "Excluded addresses cannot call this function");

            (uint256 rAmount,,,,,) = _getValues(tAmount);

            _rOwned[sender] = _rOwned[sender].sub(rAmount);

            _rTotal = _rTotal.sub(rAmount);

            _tFeeTotal = _tFeeTotal.add(tAmount);

        }

    function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {

            require(tAmount <= _tTotal, "Amount must be less than supply");

            if (!deductTransferFee) {

                (uint256 rAmount,,,,,) = _getValues(tAmount);

                return rAmount;

            } else {

                (,uint256 rTransferAmount,,,,) = _getValues(tAmount);

                return rTransferAmount;

            }

        }

    function tokenFromReflection(uint256 rAmount) public view returns(uint256) {

            require(rAmount <= _rTotal, "Amount must be less than total reflections");

            uint256 currentRate =  _getRate();

            return rAmount.div(currentRate);

        }

    function excludeFromReward(address account) public onlyOwner unlocked(Lock.EXCLUDE_FROM_REWARD) {

            require(!_isExcluded[account], "Account is already excluded");

            if(_rOwned[account] > 0) {

                _tOwned[account] = tokenFromReflection(_rOwned[account]);

            }

            _isExcluded[account] = true;

            _excluded.push(account);

            emit ExcludeFromRewardUpdated(account);

        }

    function includeInReward(address account) external onlyOwner unlocked(Lock.INCLUDE_IN_REWARD) {

            require(_isExcluded[account], "Account is already excluded");

            for (uint256 i = 0; i < _excluded.length; i++) {

                if (_excluded[i] == account) {

                    _excluded[i] = _excluded[_excluded.length - 1];

                    _tOwned[account] = 0;

                    _isExcluded[account] = false;

                    _excluded.pop();

                    break;

                }

            }

            emit IncludeInRewardUpdated(account);

        }

    function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {

            (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);

            _tOwned[sender] = _tOwned[sender].sub(tAmount);

            _rOwned[sender] = _rOwned[sender].sub(rAmount);

            _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);

            _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);

            _takeLiquidity(tLiquidity);

            _reflectFee(rFee, tFee);

            emit Transfer(sender, recipient, tTransferAmount);

        }

    function excludeFromFee(address account) public onlyOwner unlocked(Lock.EXCLUDE_FROM_FEE) {

            _isExcludedFromFee[account] = true;

            emit ExcludeFromFeeUpdated(account);

        }

    function includeInFee(address account) public onlyOwner unlocked(Lock.INCLUDE_IN_FEE) {

            _isExcludedFromFee[account] = false;

            emit IncludeInFeeUpdated(account);

        }

    function setTaxFeePercent(uint256 taxFee) external onlyOwner unlocked(Lock.TAX_FEE) {

            require(taxFee <= 15, "Amount must be less than or equal to 15");

            _taxFee = taxFee;

            emit TaxFeeUpdated(taxFee);

        }

    function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner unlocked(Lock.LIQUIDITY_FEE) {

            require(liquidityFee <= 15, "Amount must be less than or equal to 15");

            _liquidityFee = liquidityFee;

            emit LiquidityFeeUpdated(liquidityFee);

        }

    function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner unlocked(Lock.MAX_TX) {

            require(maxTxPercent > 0, "Amount must be greater than 0");

            _maxTxAmount = _tTotal.mul(maxTxPercent).div(

                10**2

            );

            emit MaxTxAmountUpdated(_maxTxAmount);

        }

    function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner unlocked(Lock.SWAP_AND_LIQUIFY_ENABLED) {

            swapAndLiquifyEnabled = _enabled;

            emit SwapAndLiquifyEnabledUpdated(_enabled);

        }

    function setNumTokensSellToAddToLiquidity(uint256 _numTokensSellToAddToLiquidity) external onlyOwner unlocked(Lock.NUM_TOKENS_SELL_TO_ADD_TO_LIQUIDITY) {

        numTokensSellToAddToLiquidity = _numTokensSellToAddToLiquidity;

        emit NumTokensSellToAddToLiquidityUpdated(_numTokensSellToAddToLiquidity);

        }

        //to recieve ETH from uniswapV2Router when swapping

        receive() external payable {}

    function _reflectFee(uint256 rFee, uint256 tFee) private {

            _rTotal = _rTotal.sub(rFee);

            _tFeeTotal = _tFeeTotal.add(tFee);

        }

    function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {

            (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);

            (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());

            return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);

        }

    function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {

            uint256 tFee = calculateTaxFee(tAmount);

            uint256 tLiquidity = calculateLiquidityFee(tAmount);

            uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);

            return (tTransferAmount, tFee, tLiquidity);

        }

    function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {

            uint256 rAmount = tAmount.mul(currentRate);

            uint256 rFee = tFee.mul(currentRate);

            uint256 rLiquidity = tLiquidity.mul(currentRate);

            uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);

            return (rAmount, rTransferAmount, rFee);

        }

    function _getRate() private view returns(uint256) {

            (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();

            return rSupply.div(tSupply);

        }

    function _getCurrentSupply() private view returns(uint256, uint256) {

            uint256 rSupply = _rTotal;

            uint256 tSupply = _tTotal;

            for (uint256 i = 0; i < _excluded.length; i++) {

                if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);

                rSupply = rSupply.sub(_rOwned[_excluded[i]]);

                tSupply = tSupply.sub(_tOwned[_excluded[i]]);

            }

            if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);

            return (rSupply, tSupply);

        }

    function _takeLiquidity(uint256 tLiquidity) private {

            uint256 currentRate =  _getRate();

            uint256 rLiquidity = tLiquidity.mul(currentRate);

            _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);

            if(_isExcluded[address(this)])

                _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);

        }

    function calculateTaxFee(uint256 _amount) private view returns (uint256) {

            return _amount.mul(_taxFee).div(

                10**2

            );

        }

    function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {

            return _amount.mul(_liquidityFee).div(

                10**2

            );

        }

    function removeAllFee() private {

            if(_taxFee == 0 && _liquidityFee == 0) return;

            _previousTaxFee = _taxFee;

            _previousLiquidityFee = _liquidityFee;

            _taxFee = 0;

            _liquidityFee = 0;

        }

    function restoreAllFee() private {

            _taxFee = _previousTaxFee;

            _liquidityFee = _previousLiquidityFee;

        }

    function isExcludedFromFee(address account) public view returns(bool) {

            return _isExcludedFromFee[account];

        }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//INTERNAL (PRIVATE)

    function _approve(address owner, address spender, uint256 amount) private {

            require(owner != address(0), "ERC20: approve from the zero address");

            require(spender != address(0), "ERC20: approve to the zero address");

            _allowances[owner][spender] = amount;

            emit Approval(owner, spender, amount);

        }

    function _transfer(

            address from,

            address to,

            uint256 amount

        ) private {

            require(from != address(0), "ERC20: transfer from the zero address");

            require(to != address(0), "ERC20: transfer to the zero address");

            require(amount > 0, "Transfer amount must be greater than zero");

            if(from != owner() && to != owner())

                require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");

            // is the token balance of this contract address over the min number of

            // tokens that we need to initiate a swap + liquidity lock?

            // also, don't get caught in a circular liquidity event.

            // also, don't swap & liquify if sender is uniswap pair.

            uint256 contractTokenBalance = balanceOf(address(this));

            if(contractTokenBalance >= _maxTxAmount)

            {

                contractTokenBalance = _maxTxAmount;

            }

            bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;

            if (

                overMinTokenBalance &&

                !inSwapAndLiquify &&

                from != uniswapV2Pair &&

                swapAndLiquifyEnabled

            ) {

                contractTokenBalance = numTokensSellToAddToLiquidity;

                //add liquidity

                swapAndLiquify(contractTokenBalance);

            }

            //indicates if fee should be deducted from transfer

            bool takeFee = true;

            //if any account belongs to _isExcludedFromFee account then remove the fee

            if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){

                takeFee = false;

            }

            //transfer amount, it will take tax, burn, liquidity fee

            _tokenTransfer(from,to,amount,takeFee);

        }

//----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------

//UNISWAP FUNCTIONS

    function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {

        // split the contract balance into halves

        uint256 half = contractTokenBalance.div(2);

        uint256 otherHalf = contractTokenBalance.sub(half);

        // capture the contract's current ETH balance.

        // this is so that we can capture exactly the amount of ETH that the

        // swap creates, and not make the liquidity event include any ETH that

        // has been manually sent to the contract

        uint256 initialBalance = address(this).balance;

        // swap tokens for ETH

        swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered

        // how much ETH did we just swap into?

        uint256 newBalance = address(this).balance.sub(initialBalance);

        // add liquidity to uniswap

        addLiquidity(otherHalf, newBalance);

        emit SwapAndLiquify(half, newBalance, otherHalf);

    }

    function swapTokensForEth(uint256 tokenAmount) private {

        // generate the uniswap pair path of token -> weth

        address[] memory path = new address[](2);

        path[0] = address(this);

        path[1] = uniswapV2Router.WETH();

        _approve(address(this), address(uniswapV2Router), tokenAmount);

        // make the swap

        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(

            tokenAmount,

            0, // accept any amount of ETH

            path,

            address(this),

            block.timestamp

        );

    }

    function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {

        // approve token transfer to cover all possible scenarios

        _approve(address(this), address(uniswapV2Router), tokenAmount);

        // add the liquidity

        uniswapV2Router.addLiquidityETH{value: ethAmount}(

            address(this),

            tokenAmount,

            0, // slippage is unavoidable

            0, // slippage is unavoidable

            address(0),

            block.timestamp

        );

    }

    //this method is responsible for taking all fee, if takeFee is true

    function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {

        if(!takeFee)

            removeAllFee();

        if (_isExcluded[sender] && !_isExcluded[recipient]) {

            _transferFromExcluded(sender, recipient, amount);

        } else if (!_isExcluded[sender] && _isExcluded[recipient]) {

            _transferToExcluded(sender, recipient, amount);

        } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {

            _transferStandard(sender, recipient, amount);

        } else if (_isExcluded[sender] && _isExcluded[recipient]) {

            _transferBothExcluded(sender, recipient, amount);

        } else {

            _transferStandard(sender, recipient, amount);

        }

        if(!takeFee)

            restoreAllFee();

    }

    function _transferStandard(address sender, address recipient, uint256 tAmount) private {

        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);

        _rOwned[sender] = _rOwned[sender].sub(rAmount);

        _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);

        _takeLiquidity(tLiquidity);

        _reflectFee(rFee, tFee);

        emit Transfer(sender, recipient, tTransferAmount);

    }

    function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {

        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);

        _rOwned[sender] = _rOwned[sender].sub(rAmount);

        _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);

        _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);

        _takeLiquidity(tLiquidity);

        _reflectFee(rFee, tFee);

        emit Transfer(sender, recipient, tTransferAmount);

    }

    function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {

        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);

        _tOwned[sender] = _tOwned[sender].sub(tAmount);

        _rOwned[sender] = _rOwned[sender].sub(rAmount);

        _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);

        _takeLiquidity(tLiquidity);

        _reflectFee(rFee, tFee);

        emit Transfer(sender, recipient, tTransferAmount);

    }

    function unlock(Lock _lock) public onlyOwner {

      timelocks[_lock] = block.timestamp + _TIMELOCK;

    }

    function lock(Lock _lock) public onlyOwner {

      timelocks[_lock] = 0;

    }}

//----------------------------------------------------------------------------------------------------
1 Like

Suicide was not optimal.

However, the real solution was just to set the compiler version to <0.7.0
as the code is designed for 0.6.12 (the last version before 0.7.0)

0.7.0 implemented error codes I was receiving.

I learned that when debugging, its good to check the docs for the quirks and features of the compiler version and finesse between compatible versions so that everything works. :smiley: