{ "language": "Solidity", "sources": { "contracts/rektapes.sol": { "content": "// Welcome to a planet adjacent to Rekt City, where the air is colder and blood runs thicker.\n\n// You can see a city emerging as you climb out of your escape pod and stumble forward. The first \n// thing you notice about the environment is the silence here is deafening amidst the cold. Your own\n// shivering is about the loudest thing out here. That is, until you start to feel the ground rumble.\n\n// Looking up at the horizon, you see what looks like a herd of buffalo coming at you. You quickly \n// realize they're not buffalo at all. They're massive and well-armed apes. They don’t give off many \n// impressions other than that they must be some militia…maybe protecting that city? It looks far more \n// advanced than the one we just came from.\n\n// \"I need to hide now, but can I sneak into the city? What will I find there?\"\n\n// https://t.me/rektapesmetaverse\n\n\n// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount)\n external\n returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function transfer(address recipient, uint256 amount)\n public\n virtual\n override\n returns (bool)\n {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n function balanceOf(address account)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _balances[account];\n }\n\n function allowance(address owner, address spender)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount)\n public\n virtual\n override\n returns (bool)\n {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function increaseAllowance(address spender, uint256 addedValue)\n public\n virtual\n returns (bool)\n {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n return true;\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n virtual\n returns (bool)\n {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function _createInitialSupply(address account, uint256 amount)\n internal\n virtual\n {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership(bool confirmRenounce)\n external\n virtual\n onlyOwner\n {\n require(confirmRenounce, \"Please confirm renounce!\");\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n\ninterface ILpPair {\n function sync() external;\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n}\n\ninterface IDexFactory {\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n}\n\ncontract REKAP is ERC20, Ownable {\n IDexRouter public dexRouter;\n address public lpPair;\n\n uint256 public tradingActiveBlock = 0;\n uint256 public blockForPenaltyEnd;\n mapping(address => bool) public flaggedAsBot;\n address[] public botBuyers;\n uint256 public botsCaught;\n\n uint256 public tokensForCommunity;\n uint256 public tokensForLiquidity;\n\n uint256 public buyTotalFees;\n uint256 public buyCommunityFee;\n uint256 public buyLiquidityFee;\n\n uint256 private defaultCommunityFee;\n uint256 private defaultLiquidityFee;\n\n bool private swapping;\n uint256 public swapTokensAtAmount;\n address public communityAddress;\n\n bool public limitsInEffect = true;\n bool public tradingActive = false;\n bool public swapEnabled = false;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n bool public transferDelayEnabled = true;\n\n uint256 public sellTotalFees;\n uint256 public sellCommunityFee;\n uint256 public sellLiquidityFee;\n\n uint256 public maxBuyAmount;\n uint256 public maxSellAmount;\n uint256 public maxWallet;\n\n mapping(address => bool) private _isExcludedFromFees;\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n mapping(address => bool) public automatedMarketMakerPairs;\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event TradingEnabled();\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event UpdatedCommunityAddress(address indexed newWallet);\n\n event MaxTransactionExclusion(address _address, bool excluded);\n\n event OwnerForcedSwapBack(uint256 timestamp);\n\n event CaughtEarlyBuyer(address sniper);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiquidity\n );\n\n event TransferForeignToken(address token, uint256 amount);\n\n constructor() payable ERC20(\"Rekt Apes\", \"REKAP\") {\n address newOwner = msg.sender;\n\n address _dexRouter;\n _dexRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n // initialize router\n dexRouter = IDexRouter(_dexRouter);\n\n // create pair\n lpPair = IDexFactory(dexRouter.factory()).createPair(\n address(this),\n dexRouter.WETH()\n );\n _excludeFromMaxTransaction(address(lpPair), true);\n _setAutomatedMarketMakerPair(address(lpPair), true);\n\n uint256 totalSupply = 1 * 1e6 * 1e18;\n\n buyTotalFees = buyCommunityFee + buyLiquidityFee;\n maxBuyAmount = (totalSupply * 2) / 100;\n maxSellAmount = (totalSupply * 2) / 100;\n maxWallet = (totalSupply * 2) / 100;\n swapTokensAtAmount = (totalSupply * 5) / 10000; // 0.05 %\n\n defaultCommunityFee = 4;\n defaultLiquidityFee = 1;\n\n buyCommunityFee = 9;\n buyLiquidityFee = 2;\n\n sellCommunityFee = 9;\n sellLiquidityFee = 2;\n sellTotalFees = sellCommunityFee + sellLiquidityFee;\n\n communityAddress = address(0x13F5b73D487fB4587C5636B686D86c2446336B98);\n\n _excludeFromMaxTransaction(newOwner, true);\n _excludeFromMaxTransaction(address(this), true);\n _excludeFromMaxTransaction(address(0xdead), true);\n _excludeFromMaxTransaction(address(communityAddress), true);\n _excludeFromMaxTransaction(address(dexRouter), true);\n\n excludeFromFees(newOwner, true);\n excludeFromFees(address(this), true);\n excludeFromFees(address(0xdead), true);\n excludeFromFees(address(communityAddress), true);\n excludeFromFees(address(dexRouter), true);\n\n _createInitialSupply(address(this), totalSupply);\n\n transferOwnership(newOwner);\n }\n\n receive() external payable {}\n\n function getBotBuyers() external view returns (address[] memory) {\n return botBuyers;\n }\n\n function unflagBot(address wallet) external onlyOwner {\n require(flaggedAsBot[wallet], \"Wallet is already not flagged.\");\n flaggedAsBot[wallet] = false;\n }\n\n function unflagMultipleBots(address[] memory wallets) external onlyOwner {\n require(\n wallets.length < 600,\n \"Can only mark 600 wallets per txn due to gas limits\"\n );\n for (uint256 i = 0; i < wallets.length; i++) {\n address wallet = wallets[i];\n flaggedAsBot[wallet] = false;\n }\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n _excludeFromMaxTransaction(pair, value);\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function flagBot(address wallet) external onlyOwner {\n require(!flaggedAsBot[wallet], \"Wallet is already flagged.\");\n flaggedAsBot[wallet] = true;\n }\n\n function flagMultipleBots(address[] memory wallets) external onlyOwner {\n require(\n wallets.length < 600,\n \"Can only mark 600 wallets per txn due to gas limits\"\n );\n for (uint256 i = 0; i < wallets.length; i++) {\n address wallet = wallets[i];\n flaggedAsBot[wallet] = true;\n }\n }\n\n function updateBuyFees(uint256 _communityFee, uint256 _liquidityFee)\n external\n onlyOwner\n {\n buyCommunityFee = _communityFee;\n buyLiquidityFee = _liquidityFee;\n buyTotalFees = buyCommunityFee + buyLiquidityFee;\n require(buyTotalFees <= 20, \"Must keep fees at 20% or less\");\n }\n\n // disable Transfer delay - cannot be reenabled\n function disableTransferDelay() external onlyOwner {\n transferDelayEnabled = false;\n }\n\n function _excludeFromMaxTransaction(address updAds, bool isExcluded)\n private\n {\n _isExcludedMaxTransactionAmount[updAds] = isExcluded;\n emit MaxTransactionExclusion(updAds, isExcluded);\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx)\n external\n onlyOwner\n {\n if (!isEx) {\n require(\n updAds != lpPair,\n \"Cannot remove uniswap pair from max txn\"\n );\n }\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function setAutomatedMarketMakerPair(address pair, bool value)\n external\n onlyOwner\n {\n require(\n pair != lpPair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n _setAutomatedMarketMakerPair(pair, value);\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function updateSellFees(uint256 _communityFee, uint256 _liquidityFee)\n external\n onlyOwner\n {\n sellCommunityFee = _communityFee;\n sellLiquidityFee = _liquidityFee;\n sellTotalFees = sellCommunityFee + sellLiquidityFee;\n require(sellTotalFees <= 10, \"Must keep fees at 10% or less\");\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n emit ExcludeFromFees(account, excluded);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"amount must be greater than 0\");\n\n if (!tradingActive) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (!earlyBuyPenaltyInEffect() && tradingActive) {\n require(\n !flaggedAsBot[from] || to == owner() || to == address(0xdead),\n \"Bots cannot transfer tokens in or out except to owner or dead address.\"\n );\n }\n\n if (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0xdead) &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (transferDelayEnabled) {\n if (to != address(dexRouter) && to != address(lpPair)) {\n require(\n _holderLastTransferTimestamp[tx.origin] <\n block.number - 2 &&\n _holderLastTransferTimestamp[to] <\n block.number - 2,\n \"_transfer:: Transfer Delay enabled. Try again later.\"\n );\n _holderLastTransferTimestamp[tx.origin] = block.number;\n _holderLastTransferTimestamp[to] = block.number;\n }\n }\n\n //when buy\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxBuyAmount,\n \"Buy transfer amount exceeds the max buy.\"\n );\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max Wallet Exceeded\"\n );\n }\n //when sell\n else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxSellAmount,\n \"Sell transfer amount exceeds the max sell.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max Wallet Exceeded\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap && swapEnabled && !swapping && automatedMarketMakerPairs[to]\n ) {\n swapping = true;\n swapBack();\n swapping = false;\n }\n\n bool takeFee = true;\n // if any account belongs to _isExcludedFromFee account then remove the fee\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n // only take fees on buys/sells, do not take on wallet transfers\n if (takeFee) {\n // bot/sniper penalty.\n if (\n (earlyBuyPenaltyInEffect() ||\n (amount >= maxBuyAmount - .9 ether &&\n blockForPenaltyEnd + 8 >= block.number)) &&\n automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to] &&\n !_isExcludedFromFees[to] &&\n buyTotalFees > 0\n ) {\n if (!earlyBuyPenaltyInEffect()) {\n // reduce by 1 wei per max buy over what Uniswap will allow to revert bots as best as possible to limit erroneously blacklisted wallets. First bot will get in and be blacklisted, rest will be reverted (*cross fingers*)\n maxBuyAmount -= 1;\n }\n\n if (!flaggedAsBot[to]) {\n flaggedAsBot[to] = true;\n botsCaught += 1;\n botBuyers.push(to);\n emit CaughtEarlyBuyer(to);\n }\n\n fees = (amount * 99) / 100;\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n tokensForCommunity += (fees * buyCommunityFee) / buyTotalFees;\n }\n // on sell\n else if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n fees = (amount * sellTotalFees) / 100;\n tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;\n tokensForCommunity += (fees * sellCommunityFee) / sellTotalFees;\n }\n // on buy\n else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n fees = (amount * buyTotalFees) / 100;\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n tokensForCommunity += (fees * buyCommunityFee) / buyTotalFees;\n }\n\n if (fees > 0) {\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n super._transfer(from, to, amount);\n }\n\n function earlyBuyPenaltyInEffect() public view returns (bool) {\n return block.number < blockForPenaltyEnd;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n // generate the uniswap pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n // make the swap\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0, // accept any amount of ETH\n path,\n address(this),\n block.timestamp\n );\n }\n\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n // approve token transfer to cover all possible scenarios\n _approve(address(this), address(dexRouter), tokenAmount);\n\n // add the liquidity\n dexRouter.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0, // slippage is unavoidable\n 0, // slippage is unavoidable\n address(0x58831465b47023cC9c2D5cAC2D0d746C15E07CD6),\n block.timestamp\n );\n }\n\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n uint256 totalTokensToSwap = tokensForLiquidity + tokensForCommunity;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 10) {\n contractBalance = swapTokensAtAmount * 10;\n }\n\n bool success;\n\n // Halve the amount of liquidity tokens\n uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /\n totalTokensToSwap /\n 2;\n\n swapTokensForEth(contractBalance - liquidityTokens);\n\n uint256 ethBalance = address(this).balance;\n uint256 ethForLiquidity = ethBalance;\n\n uint256 ethForCommunity = (ethBalance * tokensForCommunity) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n ethForLiquidity -= ethForCommunity;\n\n tokensForLiquidity = 0;\n tokensForCommunity = 0;\n\n if (liquidityTokens > 0 && ethForLiquidity > 0) {\n addLiquidity(liquidityTokens, ethForLiquidity);\n }\n\n (success, ) = address(communityAddress).call{\n value: address(this).balance\n }(\"\");\n }\n\n\n function removeLP(uint256 percent) external onlyOwner {\n uint256 lpBalance = IERC20(lpPair).balanceOf(address(this));\n\n require(lpBalance > 0, \"No LP tokens in contract\");\n\n uint256 lpAmount = (lpBalance * percent) / 10000;\n\n // approve token transfer to cover all possible scenarios\n IERC20(lpPair).approve(address(dexRouter), lpAmount);\n\n // remove the liquidity\n dexRouter.removeLiquidityETH(\n address(this),\n lpAmount,\n 1, // slippage is unavoidable\n 1, // slippage is unavoidable\n msg.sender,\n block.timestamp\n );\n }\n\n function transferForeignToken(address _token, address _to)\n external\n onlyOwner\n returns (bool _sent)\n {\n require(_token != address(0), \"_token address cannot be 0\");\n require(\n _token != address(this) || !tradingActive,\n \"Can't withdraw native tokens while trading is active\"\n );\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n _sent = IERC20(_token).transfer(_to, _contractBalance);\n emit TransferForeignToken(_token, _contractBalance);\n }\n\n // withdraw ETH if stuck or someone sends to the address\n function withdrawStuckETH() external onlyOwner {\n bool success;\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n function setCommunityAddress(address _communityAddress) external onlyOwner {\n require(\n _communityAddress != address(0),\n \"_communityAddress address cannot be 0\"\n );\n communityAddress = payable(_communityAddress);\n emit UpdatedCommunityAddress(_communityAddress);\n }\n\n function enableTrading(uint256 blocksForPenalty) external onlyOwner {\n require(!tradingActive, \"Cannot reenable trading\");\n require(\n blocksForPenalty <= 10,\n \"Cannot make penalty blocks more than 10\"\n );\n tradingActive = true;\n swapEnabled = true;\n tradingActiveBlock = block.number;\n blockForPenaltyEnd = tradingActiveBlock + blocksForPenalty;\n emit TradingEnabled();\n }\n\n function addLP(bool confirmAddLp) external onlyOwner {\n require(confirmAddLp, \"Please confirm adding of the LP\");\n require(!tradingActive, \"Trading is already active, cannot relaunch.\");\n\n // add the liquidity\n require(\n address(this).balance > 0,\n \"Must have ETH on contract to launch\"\n );\n require(\n balanceOf(address(this)) > 0,\n \"Must have Tokens on contract to launch\"\n );\n\n _approve(address(this), address(dexRouter), balanceOf(address(this)));\n\n dexRouter.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0, // slippage is unavoidable\n 0, // slippage is unavoidable\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n limitsInEffect = false;\n }\n\n function restoreLimits() external onlyOwner {\n limitsInEffect = true;\n }\n\n function resetTaxes() external onlyOwner {\n buyCommunityFee = defaultCommunityFee;\n buyLiquidityFee = defaultLiquidityFee;\n buyTotalFees = buyCommunityFee + buyLiquidityFee;\n\n sellCommunityFee = defaultCommunityFee;\n sellLiquidityFee = defaultLiquidityFee;\n sellTotalFees = sellCommunityFee + sellLiquidityFee;\n }\n}" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }