abstract contract MaxBuyDynamic is ERC20 {
    uint256 startMaxBuy;
    uint256 constant maxBuyIncrementMinutesTimer = 2; // increment maxbuy minutes
    uint256 constant maxBuyIncrementPercentil = 1; // increment maxbyu percentil 1000=100%
    uint256 public maxBuyIncrementValue; // value for increment maxBuy
    uint256 public incrementTime; // last increment time
    uint256 public maxWallet; // maximum wallet value

    function startMaxBuyDynamic() internal {
        incrementTime = block.timestamp;
        maxBuyIncrementValue = (_totalSupply * maxBuyIncrementPercentil) / 1000;
        maxWallet = _totalSupply / 100;
    }

    function checkMaxBuy(
        uint256 currentCount,
        uint256 addingAmount
    ) view internal {
        // maxBuy limitation
        require(addingAmount <= getMaxBuy(), "max buy limit");
        // check max wallet
        require(currentCount + addingAmount <= maxWallet, "max wallet limit");
    }

    function getMaxBuy() public view returns (uint256) {
        uint256 incrementCount = (block.timestamp - incrementTime) /
            (maxBuyIncrementMinutesTimer * 1 minutes);
        return startMaxBuy + maxBuyIncrementValue * incrementCount;
    }

    function _setMaxBuyPercentil(uint256 percentil) internal {
        incrementTime = block.timestamp;
        startMaxBuy = (_totalSupply * percentil) / 1000;
    }
}
function startMaxBuyDynamic() internal {
    incrementTime = block.timestamp;
    maxBuyIncrementValue = (_totalSupply * maxBuyIncrementPercentil) / 1000;
    maxWallet = _totalSupply / 100;
}

// maximum wallet value