Token 10X: Africa's First Cryptocurrency Hub
Invasion Toknen Token
We are recruiting soldiers to help take over the Smart Chain. Join the army now and reap the rewards of defeating our enemies in war%u2694%uFE0F
We are executing a plan to flank the enemy tokens and take the field by storm.
Tokenomics
7% buy tax
14% sell tax
If we manage ...
About Invasion Toknen
We are recruiting soldiers to help take over the Smart Chain. Join the army now and reap the rewards of defeating our enemies in war%u2694%uFE0F
We are executing a plan to flank the enemy tokens and take the field by storm.
Tokenomics
7% buy tax
14% sell tax
If we manage to hit 100k mc we will implement a utility around the token and have Custom NFTs made to represent the most successful invaders in the History of War.
We are executing a plan to flank the enemy tokens and take the field by storm.
Tokenomics
7% buy tax
14% sell tax
If we manage to hit 100k mc we will implement a utility around the token and have Custom NFTs made to represent the most successful invaders in the History of War.
53 total visits
Token information and links
Circulating Supply
1000000000000000000000
Token Contract (BSC Chain)
0XC79C5DBA38279CEA4F3510AB54F8AD5053C15911
Contract license:
Launch Date
20/02/2022
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
{{
"language": "Solidity",
"sources": {
"contracts/Invasion.sol": {
"content": "// ( ) ( ( ) ) ) ) ) \n// )\\ ) ( /( ( )\\ ))\\ ) ( /( ( /( * ) ( /( ( /( ( /( \n// (()/( )\\())( ( )\\ (()/(()/( )\\()) )\\()) ` ) /( )\\()) )\\())( )\\()) \n// /(_)|(_)\\ )\\ )((((_)( /(_))(_)|(_)\\ ((_)\\ ( )(_)|(_)\\|((_)\\ )\\ ((_)\\ \n// (_)) _((_|(_)((_)\\ _ )\\(_))(_)) ((_) _((_) (_(_()) ((_)_ ((_|(_) _((_) \n// |_ _|| \\| \\ \\ / /(_)_\\(_) __|_ _| / _ \\| \\| | |_ _| / _ \\ |/ /| __| \\| | \n// | | | .` |\\ V / / _ \\ \\__ \\| | | (_) | .` | | | | (_) |' < | _|| .` | \n// |___||_|\\_| \\_/ /_/ \\_\\|___/___| \\___/|_|\\_| |_| \\___/_|\\_\\|___|_|\\_| \n \n \n// Welcome to the Invasion! \n// Only the dead have seen the end of war\n//\n// https://invasiontoken.com/\n// https://t.me/InvasionToken\n\npragma solidity 0.8.9;\npragma experimental ABIEncoderV2;\n\n// SPDX-License-Identifier: MIT\n\ninterface IBEP20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function transfer(address recipient, uint256 amount)\n external\n returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\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\n// Dex Factory contract interface\ninterface IDexFactory {\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n}\n\n// Dex Router02 contract interface\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\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 swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\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 return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _setOwner(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any _account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new _account (`newOwner`).\n * Can only be called by the current owner.\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 _setOwner(newOwner);\n }\n\n /**\n * @dev set the owner for the first time.\n * Can only be called by the contract or deployer.\n */\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n\ncontract Invasion is Context, IBEP20, Ownable {\n using SafeMath for uint256;\n\n // all private variables and functions are only for contract use\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n mapping(address => bool) private _isExcludedFromReward;\n\n uint256 private constant MAX = ~uint256(0);\n uint256 private _tTotal = 1000000000000 * 1e9; // 1 trillion total supply\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n string private _name = \"Invasion\"; // token name\n string private _symbol = \"INVADE\"; // token ticker\n uint8 private _decimals = 9; // token decimals\n\n IDexRouter public dexRouter; // Dex router address\n address public dexPair; // LP token address\n address payable public marketWallet; // market wallet address\n address public burnAddress = 0x0000000000000000000000000000000000000000;\n\n uint256 public minTokenToSwap = 1000000 * 1e9; // 1M amount will trigger the swap and add liquidity\n uint256 private excludedTSupply; // for contract use\n uint256 private excludedRSupply; // for contract use\n\n bool public swapAndLiquifyEnabled = true; // should be true to turn on to liquidate the pool\n bool public Fees = true;\n\n // buy tax fee\n uint256 public reflectionFeeOnBuying = 20; // 2% will be distributed among holder as token divideneds\n uint256 public liquidityFeeOnBuying = 0; // 0% will be added to the liquidity pool\n uint256 public marketWalletFeeOnBuying = 50; // 5% will go to the market/dev address\n uint256 public burnFeeOnBuying = 0; //0% will go to dead address\n\n // sell tax fee\n uint256 public reflectionFeeOnSelling = 20; // 2% will be distributed among holder as token divideneds\n uint256 public liquidityFeeOnSelling = 30; // 3% will be added to the liquidity pool\n uint256 public marketWalletFeeOnSelling = 90; // 9% will go to the market/dev address \n uint256 public burnFeeOnSelling = 0; //0% will go to dead address\n\n // for smart contract use\n uint256 private _currentReflectionFee;\n uint256 private _currentLiquidityFee;\n uint256 private _currentmarketWalletFee;\n uint256 private _currentBurnFee;\n\n uint256 private _accumulatedLiquidity;\n uint256 private _accumulatedMarketWallet;\n\n //Events for blockchain\n event SwapAndLiquifyEnabledUpdated(bool enabled);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 bnbReceived,\n uint256 tokensIntoLiqudity\n );\n\n // constructor for initializing the contract\n constructor(address payable _marketWallet) {\n _rOwned[owner()] = _rTotal;\n marketWallet = _marketWallet;\n\n IDexRouter _dexRouter = IDexRouter(\n 0x10ED43C718714eb63d5aA57B78B54704E256024E\n // 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3 //testnet\n );\n // Create a Dex pair for this new token\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n // set the rest of the contract variables\n dexRouter = _dexRouter;\n\n //exclude owner and this contract from fee\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n\n emit Transfer(address(0), owner(), _tTotal);\n }\n\n // token standards by Blockchain\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address _account)\n public\n view\n override\n returns (uint256)\n {\n if (_isExcludedFromReward[_account]) return _tOwned[_account];\n return tokenFromReflection(_rOwned[_account]);\n }\n\n function allowance(address owner, address spender)\n public\n view\n override\n returns (uint256)\n {\n return _allowances[owner][spender];\n }\n\n function transfer(address recipient, uint256 amount)\n public\n override\n returns (bool)\n {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\n function approve(address spender, uint256 amount)\n public\n override\n returns (bool)\n {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"Token: transfer amount exceeds allowance\"\n )\n );\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].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n virtual\n returns (bool)\n {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"Token: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n // public view able functions\n\n // to check wether the address is excluded from reward or not\n function isExcludedFromReward(address _account) public view returns (bool) {\n return _isExcludedFromReward[_account];\n }\n\n // to check how much tokens get redistributed among holders till now\n function totalHolderDistribution() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n // to check wether the address is excluded from fee or not\n function isExcludedFromFee(address _account) public view returns (bool) {\n return _isExcludedFromFee[_account];\n }\n\n // For manual distribution to the holders\n function deliver(uint256 tAmount) public {\n address sender = _msgSender();\n require(\n !_isExcludedFromReward[sender],\n \"Token: Excluded addresses cannot call this function\"\n );\n uint256 rAmount = tAmount.mul(_getRate());\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rTotal = _rTotal.sub(rAmount);\n _tFeeTotal = _tFeeTotal.add(tAmount);\n }\n\n function reflectionFromToken(uint256 tAmount, bool deductTransferFee)\n public\n view\n returns (uint256)\n {\n require(tAmount <= _tTotal, \"BEP20: Amount must be less than supply\");\n if (!deductTransferFee) {\n uint256 rAmount = tAmount.mul(_getRate());\n return rAmount;\n } else {\n uint256 rAmount = tAmount.mul(_getRate());\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(_getRate())\n );\n return rTransferAmount;\n }\n }\n\n function tokenFromReflection(uint256 rAmount)\n public\n view\n returns (uint256)\n {\n require(\n rAmount <= _rTotal,\n \"Token: Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n //to include any address in reward\n function excludeFromReward(address _account) public onlyOwner {\n require(\n !_isExcludedFromReward[_account],\n \"Token: _Account is already excluded\"\n );\n if (_rOwned[_account] > 0) {\n _tOwned[_account] = tokenFromReflection(_rOwned[_account]);\n }\n _isExcludedFromReward[_account] = true;\n excludedTSupply = excludedTSupply.add(_tOwned[_account]);\n excludedRSupply = excludedRSupply.add(_rOwned[_account]);\n }\n\n // to include any address in reward\n function includeInReward(address _account) external onlyOwner {\n require(\n _isExcludedFromReward[_account],\n \"Token: _Account is already excluded\"\n );\n excludedTSupply = excludedTSupply.sub(_tOwned[_account]);\n excludedRSupply = excludedRSupply.sub(_rOwned[_account]);\n _rOwned[_account] = _tOwned[_account].mul(_getRate());\n _tOwned[_account] = 0;\n _isExcludedFromReward[_account] = false;\n }\n\n //only owner can change SellFeePercentages any time after deployment\n function setSellFeePercent(\n uint256 _redistributionFee,\n uint256 _liquidityFee,\n uint256 _marketWalletFee,\n uint256 _burnFee\n ) external onlyOwner {\n reflectionFeeOnSelling = _redistributionFee;\n liquidityFeeOnSelling = _liquidityFee;\n marketWalletFeeOnSelling = _marketWalletFee;\n burnFeeOnSelling = _burnFee;\n }\n\n //to include or exludde any address from fee\n function includeOrExcludeFromFee(address _account, bool _value)\n public\n onlyOwner\n {\n _isExcludedFromFee[_account] = _value;\n }\n\n //only owner can change MinTokenToSwap\n function setMinTokenToSwap(uint256 _amount) public onlyOwner {\n minTokenToSwap = _amount;\n }\n\n //only owner can change BuyFeePercentages any time after deployment\n function setBuyFeePercent(\n uint256 _redistributionFee,\n uint256 _liquidityFee,\n uint256 _marketWalletFee,\n uint256 _burnFee\n ) external onlyOwner {\n reflectionFeeOnBuying = _redistributionFee;\n liquidityFeeOnBuying = _liquidityFee;\n marketWalletFeeOnBuying = _marketWalletFee;\n burnFeeOnBuying = _burnFee;\n }\n\n \n //only owner can change state of swapping, he can turn it in to true or false any time after deployment\n function enableOrDisableSwapAndLiquify(bool _state) public onlyOwner {\n swapAndLiquifyEnabled = _state;\n emit SwapAndLiquifyEnabledUpdated(_state);\n }\n\n //To enable or disable all fees when set it to true fees will be disabled\n function enableOrDisableFees(bool _state) external onlyOwner {\n Fees = _state;\n }\n\n // owner can change market address\n function setmarketWalletAddress(address payable _newAddress)\n external\n onlyOwner\n {\n marketWallet = _newAddress;\n }\n\n // owner can change router and pair address\n function setRoute(IDexRouter _router, address _pair) external onlyOwner {\n dexRouter = _router;\n dexPair = _pair;\n }\n\n //to receive BNB from dexRouter when swapping\n receive() external payable {}\n\n // internal functions for contract use\n\n function totalFeePerTx(uint256 tAmount) internal view returns (uint256) {\n uint256 percentage = tAmount\n .mul(\n _currentReflectionFee.add(_currentLiquidityFee).add(\n _currentmarketWalletFee.add(_currentBurnFee)\n )\n )\n .div(1e3);\n return percentage;\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\n function setBuyFee() private {\n _currentReflectionFee = reflectionFeeOnBuying;\n _currentLiquidityFee = liquidityFeeOnBuying;\n _currentmarketWalletFee = marketWalletFeeOnBuying;\n _currentBurnFee = burnFeeOnBuying; \n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n rSupply = rSupply.sub(excludedRSupply);\n tSupply = tSupply.sub(excludedTSupply);\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n\n function removeAllFee() private {\n _currentReflectionFee = 0;\n _currentLiquidityFee = 0;\n _currentmarketWalletFee = 0;\n _currentBurnFee = 0;\n }\n\n function setSellFee() private {\n _currentReflectionFee = reflectionFeeOnSelling;\n _currentLiquidityFee = liquidityFeeOnSelling;\n _currentmarketWalletFee = marketWalletFeeOnSelling;\n _currentBurnFee = burnFeeOnSelling;\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) private {\n require(owner != address(0), \"Token: approve from the zero address\");\n require(spender != address(0), \"Token: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n // base function to transafer tokens\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) private {\n require(from != address(0), \"Token: transfer from the zero address\");\n require(to != address(0), \"Token: transfer to the zero address\");\n require(amount > 0, \"Token: transfer amount must be greater than zero\");\n\n // swap and liquify\n swapAndLiquify(from, to);\n\n //indicates if fee should be deducted from transfer\n bool takeFee = true;\n\n //if any _account belongs to _isExcludedFromFee _account then remove the fee\n if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || !Fees) {\n takeFee = false;\n }\n\n //transfer amount, it will take tax, burn, liquidity fee\n _tokenTransfer(from, to, amount, takeFee);\n }\n\n //this method is responsible for taking all fee, if takeFee is true\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n // buying handler\n if (sender == dexPair && takeFee) {\n setBuyFee();\n }\n // selling handler\n else if (recipient == dexPair && takeFee) {\n setSellFee();\n }\n // normal transaction handler\n else {\n removeAllFee();\n }\n\n // check if sender or reciver excluded from reward then do transfer accordingly\n if (\n _isExcludedFromReward[sender] && !_isExcludedFromReward[recipient]\n ) {\n _transferFromExcluded(sender, recipient, amount);\n } else if (\n !_isExcludedFromReward[sender] && _isExcludedFromReward[recipient]\n ) {\n _transferToExcluded(sender, recipient, amount);\n } else if (\n _isExcludedFromReward[sender] && _isExcludedFromReward[recipient]\n ) {\n _transferBothExcluded(sender, recipient, amount);\n } else {\n _transferStandard(sender, recipient, amount);\n }\n }\n\n // if both sender and receiver are not excluded from reward\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(currentRate)\n );\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if sender is excluded from reward\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(currentRate)\n );\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n excludedTSupply = excludedTSupply.sub(tAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if both sender and receiver are excluded from reward\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n excludedTSupply = excludedTSupply.sub(tAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n excludedTSupply = excludedTSupply.add(tAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if receiver is excluded from reward\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n excludedTSupply = excludedTSupply.add(tAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // for automatic redistribution among all holders on each tx\n function _reflectFee(uint256 tAmount) private {\n uint256 tFee = tAmount.mul(_currentReflectionFee).div(1e3);\n uint256 rFee = tFee.mul(_getRate());\n _rTotal = _rTotal.sub(rFee);\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n // take fees for liquidity, market/dev\n function _takeAllFee(address sender,uint256 tAmount, uint256 currentRate) internal {\n uint256 tFee = tAmount\n .mul(_currentLiquidityFee.add(_currentmarketWalletFee))\n .div(1e3);\n\n if (tFee > 0) {\n _accumulatedLiquidity = _accumulatedLiquidity.add(\n tAmount.mul(_currentLiquidityFee).div(1e3)\n );\n _accumulatedMarketWallet = _accumulatedMarketWallet.add(\n tAmount.mul(_currentmarketWalletFee).div(1e3)\n );\n\n uint256 rFee = tFee.mul(currentRate);\n if (_isExcludedFromReward[address(this)])\n _tOwned[address(this)] = _tOwned[address(this)].add(tFee);\n else _rOwned[address(this)] = _rOwned[address(this)].add(rFee);\n\n emit Transfer(sender, address(this), tFee);\n }\n }\n function _takeBurnFee(address sender,uint256 tAmount, uint256 currentRate) internal {\n uint256 burnFee = tAmount.mul(_currentBurnFee).div(1e3);\n uint256 rBurnFee = burnFee.mul(currentRate);\n _rOwned[burnAddress] = _rOwned[burnAddress].add(rBurnFee);\n\n emit Transfer(sender, burnAddress, burnFee);\n }\n\n function swapAndLiquify(address from, address to) private {\n // is the token balance of this contract address over the min number of\n // tokens that we need to initiate a swap liquidity lock?\n // also, don't get caught in a circular liquidity event.\n // also, don't swap & liquify if sender is Dex pair.\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool shouldSell = contractTokenBalance >= minTokenToSwap;\n\n if (\n shouldSell &&\n from != dexPair &&\n swapAndLiquifyEnabled &&\n !(from == address(this) && to == address(dexPair)) // swap 1 time\n ) {\n // approve contract\n _approve(address(this), address(dexRouter), contractTokenBalance);\n\n uint256 halfLiquid = _accumulatedLiquidity.div(2);\n uint256 otherHalfLiquid = _accumulatedLiquidity.sub(halfLiquid);\n\n uint256 tokenAmountToBeSwapped = contractTokenBalance.sub(\n otherHalfLiquid\n );\n\n // now is to lock into liquidty pool\n Utils.swapTokensForEth(address(dexRouter), tokenAmountToBeSwapped);\n\n uint256 deltaBalance = address(this).balance;\n uint256 bnbToBeAddedToLiquidity = deltaBalance.mul(halfLiquid).div(\n tokenAmountToBeSwapped\n );\n uint256 bnbFormarketWallet = deltaBalance.sub(\n bnbToBeAddedToLiquidity\n );\n\n // sending bnb to market wallet\n if (bnbFormarketWallet > 0)\n marketWallet.transfer(bnbFormarketWallet);\n\n // add liquidity to Dex\n if (bnbToBeAddedToLiquidity > 0) {\n Utils.addLiquidity(\n address(dexRouter),\n owner(),\n otherHalfLiquid,\n bnbToBeAddedToLiquidity\n );\n\n emit SwapAndLiquify(\n halfLiquid,\n bnbToBeAddedToLiquidity,\n otherHalfLiquid\n );\n }\n\n // Reset current accumulated amount\n _accumulatedLiquidity = 0;\n _accumulatedMarketWallet = 0;\n }\n }\n}\n\n// Library for doing a swap on Dex\nlibrary Utils {\n using SafeMath for uint256;\n\n function swapTokensForEth(address routerAddress, uint256 tokenAmount)\n internal\n {\n IDexRouter dexRouter = IDexRouter(routerAddress);\n\n // generate the Dex pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = dexRouter.WETH();\n\n // make the swap\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0, // accept any amount of BNB\n path,\n address(this),\n block.timestamp 300\n );\n }\n\n function addLiquidity(\n address routerAddress,\n address owner,\n uint256 tokenAmount,\n uint256 ethAmount\n ) internal {\n IDexRouter dexRouter = IDexRouter(routerAddress);\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 owner,\n block.timestamp 300\n );\n }\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}}
"language": "Solidity",
"sources": {
"contracts/Invasion.sol": {
"content": "// ( ) ( ( ) ) ) ) ) \n// )\\ ) ( /( ( )\\ ))\\ ) ( /( ( /( * ) ( /( ( /( ( /( \n// (()/( )\\())( ( )\\ (()/(()/( )\\()) )\\()) ` ) /( )\\()) )\\())( )\\()) \n// /(_)|(_)\\ )\\ )((((_)( /(_))(_)|(_)\\ ((_)\\ ( )(_)|(_)\\|((_)\\ )\\ ((_)\\ \n// (_)) _((_|(_)((_)\\ _ )\\(_))(_)) ((_) _((_) (_(_()) ((_)_ ((_|(_) _((_) \n// |_ _|| \\| \\ \\ / /(_)_\\(_) __|_ _| / _ \\| \\| | |_ _| / _ \\ |/ /| __| \\| | \n// | | | .` |\\ V / / _ \\ \\__ \\| | | (_) | .` | | | | (_) |' < | _|| .` | \n// |___||_|\\_| \\_/ /_/ \\_\\|___/___| \\___/|_|\\_| |_| \\___/_|\\_\\|___|_|\\_| \n \n \n// Welcome to the Invasion! \n// Only the dead have seen the end of war\n//\n// https://invasiontoken.com/\n// https://t.me/InvasionToken\n\npragma solidity 0.8.9;\npragma experimental ABIEncoderV2;\n\n// SPDX-License-Identifier: MIT\n\ninterface IBEP20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function transfer(address recipient, uint256 amount)\n external\n returns (bool);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\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\n// Dex Factory contract interface\ninterface IDexFactory {\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n}\n\n// Dex Router02 contract interface\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\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 swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\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 return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _setOwner(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any _account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new _account (`newOwner`).\n * Can only be called by the current owner.\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 _setOwner(newOwner);\n }\n\n /**\n * @dev set the owner for the first time.\n * Can only be called by the contract or deployer.\n */\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n}\n\ncontract Invasion is Context, IBEP20, Ownable {\n using SafeMath for uint256;\n\n // all private variables and functions are only for contract use\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n mapping(address => bool) private _isExcludedFromReward;\n\n uint256 private constant MAX = ~uint256(0);\n uint256 private _tTotal = 1000000000000 * 1e9; // 1 trillion total supply\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n string private _name = \"Invasion\"; // token name\n string private _symbol = \"INVADE\"; // token ticker\n uint8 private _decimals = 9; // token decimals\n\n IDexRouter public dexRouter; // Dex router address\n address public dexPair; // LP token address\n address payable public marketWallet; // market wallet address\n address public burnAddress = 0x0000000000000000000000000000000000000000;\n\n uint256 public minTokenToSwap = 1000000 * 1e9; // 1M amount will trigger the swap and add liquidity\n uint256 private excludedTSupply; // for contract use\n uint256 private excludedRSupply; // for contract use\n\n bool public swapAndLiquifyEnabled = true; // should be true to turn on to liquidate the pool\n bool public Fees = true;\n\n // buy tax fee\n uint256 public reflectionFeeOnBuying = 20; // 2% will be distributed among holder as token divideneds\n uint256 public liquidityFeeOnBuying = 0; // 0% will be added to the liquidity pool\n uint256 public marketWalletFeeOnBuying = 50; // 5% will go to the market/dev address\n uint256 public burnFeeOnBuying = 0; //0% will go to dead address\n\n // sell tax fee\n uint256 public reflectionFeeOnSelling = 20; // 2% will be distributed among holder as token divideneds\n uint256 public liquidityFeeOnSelling = 30; // 3% will be added to the liquidity pool\n uint256 public marketWalletFeeOnSelling = 90; // 9% will go to the market/dev address \n uint256 public burnFeeOnSelling = 0; //0% will go to dead address\n\n // for smart contract use\n uint256 private _currentReflectionFee;\n uint256 private _currentLiquidityFee;\n uint256 private _currentmarketWalletFee;\n uint256 private _currentBurnFee;\n\n uint256 private _accumulatedLiquidity;\n uint256 private _accumulatedMarketWallet;\n\n //Events for blockchain\n event SwapAndLiquifyEnabledUpdated(bool enabled);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 bnbReceived,\n uint256 tokensIntoLiqudity\n );\n\n // constructor for initializing the contract\n constructor(address payable _marketWallet) {\n _rOwned[owner()] = _rTotal;\n marketWallet = _marketWallet;\n\n IDexRouter _dexRouter = IDexRouter(\n 0x10ED43C718714eb63d5aA57B78B54704E256024E\n // 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3 //testnet\n );\n // Create a Dex pair for this new token\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n // set the rest of the contract variables\n dexRouter = _dexRouter;\n\n //exclude owner and this contract from fee\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n\n emit Transfer(address(0), owner(), _tTotal);\n }\n\n // token standards by Blockchain\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address _account)\n public\n view\n override\n returns (uint256)\n {\n if (_isExcludedFromReward[_account]) return _tOwned[_account];\n return tokenFromReflection(_rOwned[_account]);\n }\n\n function allowance(address owner, address spender)\n public\n view\n override\n returns (uint256)\n {\n return _allowances[owner][spender];\n }\n\n function transfer(address recipient, uint256 amount)\n public\n override\n returns (bool)\n {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\n function approve(address spender, uint256 amount)\n public\n override\n returns (bool)\n {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"Token: transfer amount exceeds allowance\"\n )\n );\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].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n virtual\n returns (bool)\n {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"Token: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n // public view able functions\n\n // to check wether the address is excluded from reward or not\n function isExcludedFromReward(address _account) public view returns (bool) {\n return _isExcludedFromReward[_account];\n }\n\n // to check how much tokens get redistributed among holders till now\n function totalHolderDistribution() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n // to check wether the address is excluded from fee or not\n function isExcludedFromFee(address _account) public view returns (bool) {\n return _isExcludedFromFee[_account];\n }\n\n // For manual distribution to the holders\n function deliver(uint256 tAmount) public {\n address sender = _msgSender();\n require(\n !_isExcludedFromReward[sender],\n \"Token: Excluded addresses cannot call this function\"\n );\n uint256 rAmount = tAmount.mul(_getRate());\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rTotal = _rTotal.sub(rAmount);\n _tFeeTotal = _tFeeTotal.add(tAmount);\n }\n\n function reflectionFromToken(uint256 tAmount, bool deductTransferFee)\n public\n view\n returns (uint256)\n {\n require(tAmount <= _tTotal, \"BEP20: Amount must be less than supply\");\n if (!deductTransferFee) {\n uint256 rAmount = tAmount.mul(_getRate());\n return rAmount;\n } else {\n uint256 rAmount = tAmount.mul(_getRate());\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(_getRate())\n );\n return rTransferAmount;\n }\n }\n\n function tokenFromReflection(uint256 rAmount)\n public\n view\n returns (uint256)\n {\n require(\n rAmount <= _rTotal,\n \"Token: Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n //to include any address in reward\n function excludeFromReward(address _account) public onlyOwner {\n require(\n !_isExcludedFromReward[_account],\n \"Token: _Account is already excluded\"\n );\n if (_rOwned[_account] > 0) {\n _tOwned[_account] = tokenFromReflection(_rOwned[_account]);\n }\n _isExcludedFromReward[_account] = true;\n excludedTSupply = excludedTSupply.add(_tOwned[_account]);\n excludedRSupply = excludedRSupply.add(_rOwned[_account]);\n }\n\n // to include any address in reward\n function includeInReward(address _account) external onlyOwner {\n require(\n _isExcludedFromReward[_account],\n \"Token: _Account is already excluded\"\n );\n excludedTSupply = excludedTSupply.sub(_tOwned[_account]);\n excludedRSupply = excludedRSupply.sub(_rOwned[_account]);\n _rOwned[_account] = _tOwned[_account].mul(_getRate());\n _tOwned[_account] = 0;\n _isExcludedFromReward[_account] = false;\n }\n\n //only owner can change SellFeePercentages any time after deployment\n function setSellFeePercent(\n uint256 _redistributionFee,\n uint256 _liquidityFee,\n uint256 _marketWalletFee,\n uint256 _burnFee\n ) external onlyOwner {\n reflectionFeeOnSelling = _redistributionFee;\n liquidityFeeOnSelling = _liquidityFee;\n marketWalletFeeOnSelling = _marketWalletFee;\n burnFeeOnSelling = _burnFee;\n }\n\n //to include or exludde any address from fee\n function includeOrExcludeFromFee(address _account, bool _value)\n public\n onlyOwner\n {\n _isExcludedFromFee[_account] = _value;\n }\n\n //only owner can change MinTokenToSwap\n function setMinTokenToSwap(uint256 _amount) public onlyOwner {\n minTokenToSwap = _amount;\n }\n\n //only owner can change BuyFeePercentages any time after deployment\n function setBuyFeePercent(\n uint256 _redistributionFee,\n uint256 _liquidityFee,\n uint256 _marketWalletFee,\n uint256 _burnFee\n ) external onlyOwner {\n reflectionFeeOnBuying = _redistributionFee;\n liquidityFeeOnBuying = _liquidityFee;\n marketWalletFeeOnBuying = _marketWalletFee;\n burnFeeOnBuying = _burnFee;\n }\n\n \n //only owner can change state of swapping, he can turn it in to true or false any time after deployment\n function enableOrDisableSwapAndLiquify(bool _state) public onlyOwner {\n swapAndLiquifyEnabled = _state;\n emit SwapAndLiquifyEnabledUpdated(_state);\n }\n\n //To enable or disable all fees when set it to true fees will be disabled\n function enableOrDisableFees(bool _state) external onlyOwner {\n Fees = _state;\n }\n\n // owner can change market address\n function setmarketWalletAddress(address payable _newAddress)\n external\n onlyOwner\n {\n marketWallet = _newAddress;\n }\n\n // owner can change router and pair address\n function setRoute(IDexRouter _router, address _pair) external onlyOwner {\n dexRouter = _router;\n dexPair = _pair;\n }\n\n //to receive BNB from dexRouter when swapping\n receive() external payable {}\n\n // internal functions for contract use\n\n function totalFeePerTx(uint256 tAmount) internal view returns (uint256) {\n uint256 percentage = tAmount\n .mul(\n _currentReflectionFee.add(_currentLiquidityFee).add(\n _currentmarketWalletFee.add(_currentBurnFee)\n )\n )\n .div(1e3);\n return percentage;\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\n function setBuyFee() private {\n _currentReflectionFee = reflectionFeeOnBuying;\n _currentLiquidityFee = liquidityFeeOnBuying;\n _currentmarketWalletFee = marketWalletFeeOnBuying;\n _currentBurnFee = burnFeeOnBuying; \n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n rSupply = rSupply.sub(excludedRSupply);\n tSupply = tSupply.sub(excludedTSupply);\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n\n function removeAllFee() private {\n _currentReflectionFee = 0;\n _currentLiquidityFee = 0;\n _currentmarketWalletFee = 0;\n _currentBurnFee = 0;\n }\n\n function setSellFee() private {\n _currentReflectionFee = reflectionFeeOnSelling;\n _currentLiquidityFee = liquidityFeeOnSelling;\n _currentmarketWalletFee = marketWalletFeeOnSelling;\n _currentBurnFee = burnFeeOnSelling;\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) private {\n require(owner != address(0), \"Token: approve from the zero address\");\n require(spender != address(0), \"Token: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n // base function to transafer tokens\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) private {\n require(from != address(0), \"Token: transfer from the zero address\");\n require(to != address(0), \"Token: transfer to the zero address\");\n require(amount > 0, \"Token: transfer amount must be greater than zero\");\n\n // swap and liquify\n swapAndLiquify(from, to);\n\n //indicates if fee should be deducted from transfer\n bool takeFee = true;\n\n //if any _account belongs to _isExcludedFromFee _account then remove the fee\n if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || !Fees) {\n takeFee = false;\n }\n\n //transfer amount, it will take tax, burn, liquidity fee\n _tokenTransfer(from, to, amount, takeFee);\n }\n\n //this method is responsible for taking all fee, if takeFee is true\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n // buying handler\n if (sender == dexPair && takeFee) {\n setBuyFee();\n }\n // selling handler\n else if (recipient == dexPair && takeFee) {\n setSellFee();\n }\n // normal transaction handler\n else {\n removeAllFee();\n }\n\n // check if sender or reciver excluded from reward then do transfer accordingly\n if (\n _isExcludedFromReward[sender] && !_isExcludedFromReward[recipient]\n ) {\n _transferFromExcluded(sender, recipient, amount);\n } else if (\n !_isExcludedFromReward[sender] && _isExcludedFromReward[recipient]\n ) {\n _transferToExcluded(sender, recipient, amount);\n } else if (\n _isExcludedFromReward[sender] && _isExcludedFromReward[recipient]\n ) {\n _transferBothExcluded(sender, recipient, amount);\n } else {\n _transferStandard(sender, recipient, amount);\n }\n }\n\n // if both sender and receiver are not excluded from reward\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(currentRate)\n );\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if sender is excluded from reward\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(\n totalFeePerTx(tAmount).mul(currentRate)\n );\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n excludedTSupply = excludedTSupply.sub(tAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if both sender and receiver are excluded from reward\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n excludedTSupply = excludedTSupply.sub(tAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n excludedTSupply = excludedTSupply.add(tAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // if receiver is excluded from reward\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n uint256 tTransferAmount = tAmount.sub(totalFeePerTx(tAmount));\n uint256 rAmount = tAmount.mul(currentRate);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n excludedTSupply = excludedTSupply.add(tAmount);\n _takeAllFee(sender,tAmount, currentRate);\n _takeBurnFee(sender,tAmount, currentRate);\n _reflectFee(tAmount);\n\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n // for automatic redistribution among all holders on each tx\n function _reflectFee(uint256 tAmount) private {\n uint256 tFee = tAmount.mul(_currentReflectionFee).div(1e3);\n uint256 rFee = tFee.mul(_getRate());\n _rTotal = _rTotal.sub(rFee);\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n // take fees for liquidity, market/dev\n function _takeAllFee(address sender,uint256 tAmount, uint256 currentRate) internal {\n uint256 tFee = tAmount\n .mul(_currentLiquidityFee.add(_currentmarketWalletFee))\n .div(1e3);\n\n if (tFee > 0) {\n _accumulatedLiquidity = _accumulatedLiquidity.add(\n tAmount.mul(_currentLiquidityFee).div(1e3)\n );\n _accumulatedMarketWallet = _accumulatedMarketWallet.add(\n tAmount.mul(_currentmarketWalletFee).div(1e3)\n );\n\n uint256 rFee = tFee.mul(currentRate);\n if (_isExcludedFromReward[address(this)])\n _tOwned[address(this)] = _tOwned[address(this)].add(tFee);\n else _rOwned[address(this)] = _rOwned[address(this)].add(rFee);\n\n emit Transfer(sender, address(this), tFee);\n }\n }\n function _takeBurnFee(address sender,uint256 tAmount, uint256 currentRate) internal {\n uint256 burnFee = tAmount.mul(_currentBurnFee).div(1e3);\n uint256 rBurnFee = burnFee.mul(currentRate);\n _rOwned[burnAddress] = _rOwned[burnAddress].add(rBurnFee);\n\n emit Transfer(sender, burnAddress, burnFee);\n }\n\n function swapAndLiquify(address from, address to) private {\n // is the token balance of this contract address over the min number of\n // tokens that we need to initiate a swap liquidity lock?\n // also, don't get caught in a circular liquidity event.\n // also, don't swap & liquify if sender is Dex pair.\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool shouldSell = contractTokenBalance >= minTokenToSwap;\n\n if (\n shouldSell &&\n from != dexPair &&\n swapAndLiquifyEnabled &&\n !(from == address(this) && to == address(dexPair)) // swap 1 time\n ) {\n // approve contract\n _approve(address(this), address(dexRouter), contractTokenBalance);\n\n uint256 halfLiquid = _accumulatedLiquidity.div(2);\n uint256 otherHalfLiquid = _accumulatedLiquidity.sub(halfLiquid);\n\n uint256 tokenAmountToBeSwapped = contractTokenBalance.sub(\n otherHalfLiquid\n );\n\n // now is to lock into liquidty pool\n Utils.swapTokensForEth(address(dexRouter), tokenAmountToBeSwapped);\n\n uint256 deltaBalance = address(this).balance;\n uint256 bnbToBeAddedToLiquidity = deltaBalance.mul(halfLiquid).div(\n tokenAmountToBeSwapped\n );\n uint256 bnbFormarketWallet = deltaBalance.sub(\n bnbToBeAddedToLiquidity\n );\n\n // sending bnb to market wallet\n if (bnbFormarketWallet > 0)\n marketWallet.transfer(bnbFormarketWallet);\n\n // add liquidity to Dex\n if (bnbToBeAddedToLiquidity > 0) {\n Utils.addLiquidity(\n address(dexRouter),\n owner(),\n otherHalfLiquid,\n bnbToBeAddedToLiquidity\n );\n\n emit SwapAndLiquify(\n halfLiquid,\n bnbToBeAddedToLiquidity,\n otherHalfLiquid\n );\n }\n\n // Reset current accumulated amount\n _accumulatedLiquidity = 0;\n _accumulatedMarketWallet = 0;\n }\n }\n}\n\n// Library for doing a swap on Dex\nlibrary Utils {\n using SafeMath for uint256;\n\n function swapTokensForEth(address routerAddress, uint256 tokenAmount)\n internal\n {\n IDexRouter dexRouter = IDexRouter(routerAddress);\n\n // generate the Dex pair path of token -> weth\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = dexRouter.WETH();\n\n // make the swap\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0, // accept any amount of BNB\n path,\n address(this),\n block.timestamp 300\n );\n }\n\n function addLiquidity(\n address routerAddress,\n address owner,\n uint256 tokenAmount,\n uint256 ethAmount\n ) internal {\n IDexRouter dexRouter = IDexRouter(routerAddress);\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 owner,\n block.timestamp 300\n );\n }\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}}