// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function getAllowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract XToken is IERC20 {
    string public constant name = "Pondcoin2.0";
    string public constant symbol = "Pndc2.0";
    uint8 public constant decimals = 18;
    uint256 private constant _totalSupply = 220000 * 10 ** uint256(decimals);
    
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    mapping(address => bool) private _blacklist;
    
    uint256 private _maxHoldingPercentage = 10; // Maximal 2% der Gesamtzirkulation

    uint256 public constant buyTaxPercentage = 0; // 0% Kaufsteuer
    uint256 public constant sellTaxPercentage = 0; // 5% Verkaufssteuer

    address private _owner;

    constructor() {
        _owner = msg.sender;
        _balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

    function totalSupply() external view override returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) external view override returns (uint256) {
        return _balances[account];
    }

    function transfer(address recipient, uint256 amount) external override returns (bool) {
        _transfer(msg.sender, recipient, amount);
        return true;
    }

    function getAllowance(address owner, address spender) external view override returns (uint256) {
        return _allowances[owner][spender];
    }

    function approve(address spender, uint256 amount) external override returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
        return true;
    }

    function addToBlacklist(address account) external {
        require(msg.sender == _owner, "Only the contract owner can add to the blacklist");
        _blacklist[account] = true;
    }

    function removeFromBlacklist(address account) external {
        require(msg.sender == _owner, "Only the contract owner can remove from the blacklist");
        _blacklist[account] = false;
    }

    function isBlacklisted(address account) external view returns (bool) {
        return _blacklist[account];
    }

    function _transfer(address sender, address recipient, uint256 amount) internal {
        // Rest des Transfer-Codes bleibt unverändert
    }

    function _approve(address owner, address spender, uint256 amount) internal {
        // Rest des Approve-Codes bleibt unverändert
    }

    function owner() public view returns (address) {
        return _owner;
    }

    function getMaxHoldingPercentage() external view returns (uint256) {
        return _maxHoldingPercentage;
    }

    function setMaxHoldingPercentage(uint256 newPercentage) external {
        require(msg.sender == _owner, "Only the contract owner can set the maximum holding percentage");
        require(newPercentage <= 100, "Percentage must be less than or equal to 100");
        _maxHoldingPercentage = newPercentage;
    }
}