//       ██████╗ ██████╗ ███╗   ██╗████████╗██████╗  █████╗  ██████╗████████╗    ██████╗ ██╗   ██╗
//      ██╔════╝██╔═══██╗████╗  ██║╚══██╔══╝██╔══██╗██╔══██╗██╔════╝╚══██╔══╝    ██╔══██╗╚██╗ ██╔╝
//      ██║     ██║   ██║██╔██╗ ██║   ██║   ██████╔╝███████║██║        ██║       ██████╔╝ ╚████╔╝
//      ██║     ██║   ██║██║╚██╗██║   ██║   ██╔══██╗██╔══██║██║        ██║       ██╔══██╗  ╚██╔╝
//      ╚██████╗╚██████╔╝██║ ╚████║   ██║   ██║  ██║██║  ██║╚██████╗   ██║       ██████╔╝   ██║
//       ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝   ╚═╝       ╚═════╝    ╚═╝
//
//  ██████╗ ██╗      ██████╗  ██████╗██╗  ██╗███████╗ █████╗ ███████╗██╗   ██╗    ██████╗ ██████╗ ███╗   ███╗
//  ██╔══██╗██║     ██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██╔══██╗██╔════╝██║   ██║   ██╔════╝██╔═══██╗████╗ ████║
//  ██████╔╝██║     ██║   ██║██║     █████╔╝ ███████╗███████║█████╗  ██║   ██║   ██║     ██║   ██║██╔████╔██║
//  ██╔══██╗██║     ██║   ██║██║     ██╔═██╗ ╚════██║██╔══██║██╔══╝  ██║   ██║   ██║     ██║   ██║██║╚██╔╝██║
//  ██████╔╝███████╗╚██████╔╝╚██████╗██║  ██╗███████║██║  ██║██║     ╚██████╔╝██╗╚██████╗╚██████╔╝██║ ╚═╝ ██║
//  ╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═╝      ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝
//

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

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 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;
}

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;
}

library Address {
    function isContract(address account) internal view returns (bool) {
        return account.code.length > 0;
    }

    function sendValue(address payable recipient, uint256 amount) internal {
        require(
            address(this).balance >= amount,
            "Address: insufficient balance"
        );

        (bool success, ) = recipient.call{value: amount}("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }

    function functionCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                0,
                "Address: low-level call failed"
            );
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                value,
                "Address: low-level call with value failed"
            );
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(
            address(this).balance >= value,
            "Address: insufficient balance for call"
        );
        (bool success, bytes memory returndata) = target.call{value: value}(
            data
        );
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function functionStaticCall(
        address target,
        bytes memory data
    ) internal view returns (bytes memory) {
        return
            functionStaticCall(
                target,
                data,
                "Address: low-level static call failed"
            );
    }

    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function functionDelegateCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory) {
        return
            functionDelegateCall(
                target,
                data,
                "Address: low-level delegate call failed"
            );
    }

    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return
            verifyCallResultFromTarget(
                target,
                success,
                returndata,
                errorMessage
            );
    }

    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(
        bytes memory returndata,
        string memory errorMessage
    ) private pure {
        if (returndata.length > 0) {
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

interface IERC20Permit {
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function nonces(address owner) external view returns (uint256);

    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function transfer(address to, uint256 amount) external returns (bool);

    function allowance(
        address owner,
        address spender
    ) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

library SafeERC20 {
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transfer.selector, to, value)
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(
                oldAllowance >= value,
                "SafeERC20: decreased allowance below zero"
            );
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(
                token,
                abi.encodeWithSelector(
                    token.approve.selector,
                    spender,
                    newAllowance
                )
            );
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(
            nonceAfter == nonceBefore + 1,
            "SafeERC20: permit did not succeed"
        );
    }

    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        bytes memory returndata = address(token).functionCall(
            data,
            "SafeERC20: low-level call failed"
        );
        if (returndata.length > 0) {
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

interface IERC20Metadata is IERC20 {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);
}

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    function name() public view virtual override returns (string memory) {
        return _name;
    }

    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(
        address account
    ) public view virtual override returns (uint256) {
        return _balances[account];
    }

    function transfer(
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    function allowance(
        address owner,
        address spender
    ) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    function approve(
        address spender,
        uint256 amount
    ) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    function increaseAllowance(
        address spender,
        uint256 addedValue
    ) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    function decreaseAllowance(
        address spender,
        uint256 subtractedValue
    ) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(
            currentAllowance >= subtractedValue,
            "ERC20: decreased allowance below zero"
        );
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(
            fromBalance >= amount,
            "ERC20: transfer amount exceeds balance"
        );
        unchecked {
            _balances[from] = fromBalance - amount;

            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;

            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        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 _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(
                currentAllowance >= amount,
                "ERC20: insufficient allowance"
            );
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    constructor() {
        _transferOwnership(_msgSender());
    }

    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        _transferOwnership(newOwner);
    }

    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

contract PepeFlokiEth is ERC20, Ownable {
    using SafeERC20 for IERC20;

    uint256 public marketingTaxBuy;
    uint256 public marketingTaxSell;
    uint256 public marketingTaxTransfer;

    uint256 public buyBackTaxBuy;
    uint256 public buyBackTaxSell;
    uint256 public buyBackTaxTransfer;

    uint256 public immutable antiBotTax;

    uint256 public immutable denominator;

    uint256 public marketingTokenAmount;
    uint256 public buyBackTokenAmount;

    address public marketingWallet;
    address public immutable buyBackToken;

    bool private swapping;
    uint256 public swapTokensAtAmount;
    bool public isSwapBackEnabled;

    IUniswapV2Router02 public immutable uniswapV2Router;
    address public immutable uniswapV2Pair;

    bool public isLiquidityAdded;
    uint256 public antiBotBlockAmount;
    uint256 public antiBotBlockEnd;

    bool public isTokenLeftEnabled;
    uint256 public immutable tokenLeftAmount;

    mapping(address => bool) private _isAutomatedMarketMakerPair;
    mapping(address => bool) private _isExcludedFromFees;

    modifier inSwap() {
        swapping = true;
        _;
        swapping = false;
    }

    event UpdateBuyTax(uint256 marketingTaxBuy, uint256 buyBackTaxBuy);
    event UpdateSellTax(uint256 marketingTaxSell, uint256 buyBackTaxSell);
    event UpdateTransferTax(
        uint256 marketingTaxTransfer,
        uint256 buyBackTaxTransfer
    );
    event UpdateMarketingWallet(address indexed marketingWallet);
    event UpdateSwapTokensAtAmount(uint256 swapTokensAtAmount);
    event UpdateSwapBackStatus(bool status);
    event TriggerLiquidityAdded(uint256 antiBotBlockEnd);
    event UpdateAntiBotBlockAmount(uint256 antiBotBlockAmount);
    event UpdateTokenLeftStatus(bool status);
    event UpdateAutomatedMarketMakerPair(address indexed pair, bool status);
    event UpdateExcludeFromFees(address indexed account, bool isExcluded);

    constructor() ERC20("PepeFlokiEth", "PPeth") {
        _transferOwnership(0x62c3153302f15A356805a308DbCaD41f725443e6);
        address tokenHolder = 0x699BA90D8ACd7AD3220E53c92EED034E1c6Ddf39;

        _mint(tokenHolder, 1_000_000_000 * (10 ** 18));

        marketingTaxBuy = 0;
        marketingTaxSell = 300;
        marketingTaxTransfer = 200;

        buyBackTaxBuy = 0;
        buyBackTaxSell = 200;
        buyBackTaxTransfer = 0;

        antiBotTax = 2_500;

        denominator = 10_000;

        marketingWallet = 0x7f8bfB5661498a35b9Ebb629addD9240f3E42ead;
        buyBackToken = 0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E;

        swapTokensAtAmount = (totalSupply() * 1) / 10_000;
        isSwapBackEnabled = true;

        address router = getRouterAddress();
        uniswapV2Router = IUniswapV2Router02(router);
        uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
            address(this),
            uniswapV2Router.WETH()
        );

        _approve(address(this), address(uniswapV2Router), type(uint256).max);

        antiBotBlockAmount = 2;

        isTokenLeftEnabled = true;
        tokenLeftAmount = 1 * (10 ** 18);

        _isAutomatedMarketMakerPair[address(uniswapV2Pair)] = true;

        _isExcludedFromFees[address(0xdead)] = true;
        _isExcludedFromFees[address(owner())] = true;
        _isExcludedFromFees[address(this)] = true;
        _isExcludedFromFees[address(uniswapV2Router)] = true;
        _isExcludedFromFees[address(tokenHolder)] = true;
    }

    receive() external payable {}

    fallback() external payable {}

    function getRouterAddress() public view returns (address) {
        if (block.chainid == 56) {
            return 0x10ED43C718714eb63d5aA57B78B54704E256024E;
        } else if (block.chainid == 97) {
            return 0xD99D1c33F9fC3444f8101754aBC46c52416550D1;
        } else if (block.chainid == 1 || block.chainid == 5) {
            return 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
        } else {
            revert("Cannot found router on this network");
        }
    }

    function isContract(address account) internal view returns (bool) {
        return account.code.length > 0;
    }

    function claimStuckTokens(address token) external onlyOwner {
        require(token != address(this), "Owner cannot claim native tokens");

        if (token == address(0x0)) {
            payable(msg.sender).transfer(address(this).balance);
            return;
        }
        IERC20 ERC20token = IERC20(token);
        uint256 balance = ERC20token.balanceOf(address(this));
        ERC20token.safeTransfer(msg.sender, balance);
    }

    function SetBuyTax(
        uint256 _marketingTaxBuy,
        uint256 _buyBackTaxBuy
    ) external onlyOwner {
        require(
            marketingTaxBuy != _marketingTaxBuy ||
                buyBackTaxBuy != _buyBackTaxBuy,
            "Buy Tax already on that value"
        );
        require(
            _marketingTaxBuy +
                _buyBackTaxBuy +
                marketingTaxSell +
                buyBackTaxSell <=
                2_500,
            "Buy Tax and Sell Tax cannot be more than 25%"
        );

        marketingTaxBuy = _marketingTaxBuy;
        buyBackTaxBuy = _buyBackTaxBuy;

        emit UpdateBuyTax(_marketingTaxBuy, _buyBackTaxBuy);
    }

    function SetSellTax(
        uint256 _marketingTaxSell,
        uint256 _buyBackTaxSell
    ) external onlyOwner {
        require(
            marketingTaxSell != _marketingTaxSell ||
                buyBackTaxSell != _buyBackTaxSell,
            "Sell Tax already on that value"
        );
        require(
            marketingTaxBuy +
                buyBackTaxBuy +
                _marketingTaxSell +
                _buyBackTaxSell <=
                2_500,
            "Buy Tax and Sell Tax cannot be more than 25%"
        );

        marketingTaxSell = _marketingTaxSell;
        buyBackTaxSell = _buyBackTaxSell;

        emit UpdateSellTax(_marketingTaxSell, _buyBackTaxSell);
    }

    function SetTransferTax(
        uint256 _marketingTaxTransfer,
        uint256 _buyBackTaxTransfer
    ) external onlyOwner {
        require(
            marketingTaxTransfer != _marketingTaxTransfer ||
                buyBackTaxTransfer != _buyBackTaxTransfer,
            "Transfer Tax already on that value"
        );
        require(
            marketingTaxBuy +
                buyBackTaxBuy +
                _marketingTaxTransfer +
                _buyBackTaxTransfer <=
                2_500,
            "Buy Tax and Transfer Tax cannot be more than 25%"
        );

        marketingTaxTransfer = _marketingTaxTransfer;
        buyBackTaxTransfer = _buyBackTaxTransfer;

        emit UpdateTransferTax(_marketingTaxTransfer, _buyBackTaxTransfer);
    }

    function setMarketingWallet(address _marketingWallet) external onlyOwner {
        require(
            _marketingWallet != marketingWallet,
            "Marketing wallet is already that address"
        );
        require(
            _marketingWallet != address(0),
            "Marketing wallet cannot be the zero address"
        );
        require(
            !isContract(_marketingWallet),
            "Marketing wallet cannot be a contract"
        );

        marketingWallet = _marketingWallet;
        emit UpdateMarketingWallet(_marketingWallet);
    }

    function setSwapTokensAtAmount(uint256 amount) external onlyOwner {
        require(
            swapTokensAtAmount != amount,
            "SwapTokensAtAmount already on that amount"
        );
        require(amount >= 1, "Amount must be equal or greater than 1 Wei");

        swapTokensAtAmount = amount;

        emit UpdateSwapTokensAtAmount(amount);
    }

    function toggleSwapBack(bool status) external onlyOwner {
        require(isSwapBackEnabled != status, "SwapBack already on status");

        isSwapBackEnabled = status;
        emit UpdateSwapBackStatus(status);
    }

    function setAntiBotBlockAmount(uint256 amount) external onlyOwner {
        require(
            !isLiquidityAdded,
            "Cannot modify AntiBot block amount after liquidity added"
        );
        require(
            antiBotBlockAmount != amount,
            "antiBotBlockAmount already on that amount"
        );
        require(amount <= 5, "Block amount must be below 5 block");

        antiBotBlockAmount = amount;

        emit UpdateAntiBotBlockAmount(amount);
    }

    function toggleTokenLeft(bool status) external onlyOwner {
        require(isTokenLeftEnabled != status, "TokenLeft already on status");

        isTokenLeftEnabled = status;
        emit UpdateTokenLeftStatus(status);
    }

    function setAutomatedMarketMakerPair(
        address pair,
        bool status
    ) external onlyOwner {
        require(
            _isAutomatedMarketMakerPair[pair] != status,
            "Pair address is already the value of 'status'"
        );
        _isAutomatedMarketMakerPair[pair] = status;

        emit UpdateAutomatedMarketMakerPair(pair, status);
    }

    function isAutomatedMarketMakerPair(
        address pair
    ) external view returns (bool) {
        return _isAutomatedMarketMakerPair[pair];
    }

    function setExcludeFromFees(
        address account,
        bool excluded
    ) external onlyOwner {
        require(
            _isExcludedFromFees[account] != excluded,
            "Account is already the value of 'excluded'"
        );
        _isExcludedFromFees[account] = excluded;

        emit UpdateExcludeFromFees(account, excluded);
    }

    function isExcludedFromFees(address account) external view returns (bool) {
        return _isExcludedFromFees[account];
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        if (amount == 0) {
            super._transfer(from, to, 0);
            return;
        }

        if (!isLiquidityAdded && _isAutomatedMarketMakerPair[to]) {
            isLiquidityAdded = true;
            antiBotBlockEnd = block.number + antiBotBlockAmount;
            emit TriggerLiquidityAdded(antiBotBlockEnd);
        }

        uint256 contractTokenBalance = balanceOf(address(this));

        bool canSwap = contractTokenBalance >= swapTokensAtAmount;

        if (
            canSwap &&
            !swapping &&
            !_isAutomatedMarketMakerPair[from] &&
            isSwapBackEnabled
        ) {
            swapBack();
        }

        bool takeFee = true;

        if (_isExcludedFromFees[from] || _isExcludedFromFees[to] || swapping) {
            takeFee = false;
        }

        if (takeFee) {
            if (!_isAutomatedMarketMakerPair[from] && isTokenLeftEnabled) {
                require(
                    amount > tokenLeftAmount,
                    "PepeFlokiEth: amount must be greater than tokenLeftAmount"
                );
                amount -= tokenLeftAmount;
            }

            uint256 tempAntiBotAmount;
            uint256 tempMarketingAmount;
            uint256 tempBuyBackAmount;

            if (_isAutomatedMarketMakerPair[from]) {
                if (block.number <= antiBotBlockEnd) {
                    tempAntiBotAmount = (amount * antiBotTax) / denominator;
                } else {
                    tempMarketingAmount =
                        (amount * marketingTaxBuy) /
                        denominator;
                    marketingTokenAmount += tempMarketingAmount;
                    tempBuyBackAmount = (amount * buyBackTaxBuy) / denominator;
                    buyBackTokenAmount += tempBuyBackAmount;
                }
            } else if (_isAutomatedMarketMakerPair[to]) {
                tempMarketingAmount = (amount * marketingTaxSell) / denominator;
                marketingTokenAmount += tempMarketingAmount;
                tempBuyBackAmount = (amount * buyBackTaxSell) / denominator;
                buyBackTokenAmount += tempBuyBackAmount;
            } else {
                tempMarketingAmount =
                    (amount * marketingTaxTransfer) /
                    denominator;
                marketingTokenAmount += tempMarketingAmount;
                tempBuyBackAmount = (amount * buyBackTaxTransfer) / denominator;
                buyBackTokenAmount += tempBuyBackAmount;
            }

            uint256 fees = tempAntiBotAmount +
                tempMarketingAmount +
                tempBuyBackAmount;

            if (fees > 0) {
                amount -= fees;
                super._transfer(from, address(this), fees);
            }
        }

        super._transfer(from, to, amount);
    }

    function swapBack() internal inSwap {
        address[] memory swapBackPath = new address[](2);
        swapBackPath[0] = address(this);
        swapBackPath[1] = uniswapV2Router.WETH();

        address[] memory buyBackPath = new address[](3);
        buyBackPath[0] = address(this);
        buyBackPath[1] = uniswapV2Router.WETH();
        buyBackPath[2] = address(buyBackToken);

        uint256 contractTokenBalance = balanceOf(address(this));

        uint256 totalTax = marketingTokenAmount + buyBackTokenAmount;

        uint256 buyBackAmount = (contractTokenBalance * buyBackTokenAmount) /
            totalTax;

        uint256 swapBackAmount = contractTokenBalance - buyBackAmount;

        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            swapBackAmount,
            0,
            swapBackPath,
            address(marketingWallet),
            block.timestamp
        );

        uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
            buyBackAmount,
            0,
            buyBackPath,
            address(0xdead),
            block.timestamp
        );

        marketingTokenAmount = 0;
        buyBackTokenAmount = 0;
    }

    function manualSwapBack() external {
        uint256 contractTokenBalance = balanceOf(address(this));

        require(contractTokenBalance > 0, "Cant Swap Back 0 Token!");

        swapBack();
    }
}