```\nfunction _buy(uint256 minTokenOut, uint256 deadline)\n    public\n    payable\n    nonReentrant\n    returns (bool)\n{\n    // deadline requirement\n    require(deadline >= block.timestamp, "Deadline EXPIRED");\n\n    // Frontrun Guard\n    _lastBuyBlock[msg.sender] = block.number;\n\n    // liquidity is set\n    require(liquidity > 0, "The token has no liquidity");\n\n    // check if trading is open or whether the buying wallet is the migration one\n    require(\n        block.timestamp >= TRADE_OPEN_TIME ||\n            msg.sender == MIGRATION_WALLET,\n        "Trading is not Open"\n    );\n\n    //remove the buy tax\n    uint256 bnbAmount = isFeeExempt[msg.sender]\n        ? msg.value\n        : (msg.value * buyMul) / DIVISOR;\n\n    // how much they should purchase?\n    uint256 tokensToSend = _balances[address(this)] -\n        (liqConst / (bnbAmount + liquidity));\n\n    //revert for max bag\n    require(\n        _balances[msg.sender] + tokensToSend <= maxBag ||\n            isTxLimitExempt[msg.sender],\n        "Max wallet exceeded"\n    );\n\n    // revert if under 1\n    require(tokensToSend > 1, "Must Buy more than 1 decimal of Surge");\n\n    // revert for slippage\n    require(tokensToSend >= minTokenOut, "INSUFFICIENT OUTPUT AMOUNT");\n\n    // transfer the tokens from CA to the buyer\n    buy(msg.sender, tokensToSend);\n\n    //update available tax to extract and Liquidity\n    uint256 taxAmount = msg.value - bnbAmount;\n    taxBalance = taxBalance + taxAmount;\n    liquidity = liquidity + bnbAmount;\n\n    //update volume\n    uint256 cTime = block.timestamp;\n    uint256 dollarBuy = msg.value * getBNBPrice();\n    totalVolume += dollarBuy;\n    indVol[msg.sender] += dollarBuy;\n    tVol[cTime] += dollarBuy;\n\n    //update candleStickData\n    totalTx += 1;\n    txTimeStamp[totalTx] = cTime;\n    uint256 cPrice = calculatePrice() * getBNBPrice();\n    candleStickData[cTime].time = cTime;\n    if (candleStickData[cTime].open == 0) {\n        if (totalTx == 1) {\n            candleStickData[cTime].open =\n                ((liquidity - bnbAmount) / (_totalSupply)) *\n                getBNBPrice();\n        } else {\n            candleStickData[cTime].open = candleStickData[\n                txTimeStamp[totalTx - 1]\n            ].close;\n        }\n    }\n    candleStickData[cTime].close = cPrice;\n\n    if (\n        candleStickData[cTime].high < cPrice ||\n        candleStickData[cTime].high == 0\n    ) {\n        candleStickData[cTime].high = cPrice;\n    }\n\n    if (\n        candleStickData[cTime].low > cPrice ||\n        candleStickData[cTime].low == 0\n    ) {\n        candleStickData[cTime].low = cPrice;\n    }\n\n    //emit transfer and buy events\n    emit Transfer(address(this), msg.sender, tokensToSend);\n    emit Bought(\n        msg.sender,\n        address(this),\n        tokensToSend,\n        msg.value,\n        bnbAmount * getBNBPrice()\n    );\n    return true;\n}\n```\n